You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
172 lines
5.1 KiB
172 lines
5.1 KiB
|
|
using EasyBL.WebApi;
|
|
using EasyBL.WebApi.Common;
|
|
using EasyBL.WebApi.Message;
|
|
using Entity.ShowEasyDtos;
|
|
using Entity.Sugar;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
|
|
namespace EasyBL.WEBAPP.SYS
|
|
{
|
|
public class ExhibMediaService : ServiceBase
|
|
{
|
|
|
|
#region 展覽多媒體管理(List API 查詢展覽多媒體列表)
|
|
|
|
/// <summary>
|
|
/// 展覽多媒體管理(List API 查詢展覽多媒體列表)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
public HttpResponseMessage GetMediaList(string sLanguageID, string sExhibitionID, string sMediaTypeID)
|
|
{
|
|
|
|
RequestMessage i_crm = new RequestMessage();
|
|
i_crm.ORIGID = WebAppGlobalConstWord.TG_ORGID;
|
|
i_crm.DATA.Add("LanguageID", sLanguageID);
|
|
i_crm.DATA.Add("ExhibitionID", sExhibitionID);
|
|
i_crm.DATA.Add("MediaTypeID", sMediaTypeID);
|
|
|
|
SuccessResponseMessage srm = null;
|
|
string sError = null;
|
|
|
|
try
|
|
{
|
|
do
|
|
{
|
|
if (string.IsNullOrEmpty(sLanguageID))
|
|
{
|
|
sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE;
|
|
}
|
|
|
|
ExhibMediaMaintain_QryService emm_qry = new ExhibMediaMaintain_QryService();
|
|
var rsResult = emm_qry.QueryMediaList(i_crm);
|
|
|
|
//返回token信息
|
|
srm = new SuccessResponseMessage(null, null);
|
|
|
|
var rsExhibMediaList = new List<ExhibMediaDTO>();
|
|
|
|
rsExhibMediaList = ExhibMediaEntityToDTO(rsResult.DATA[BLWording.REL]);
|
|
|
|
srm.DATA.Add(BLWording.REL, rsExhibMediaList);
|
|
|
|
} while (false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sError = Util.GetLastExceptionMsg(ex);
|
|
srm = new SuccessResponseMessage(null, null)
|
|
{
|
|
STATUSCODE = (int)StatusCodeEnum.Error,
|
|
MSG = StatusCodeEnum.Error.GetEnumText()
|
|
};
|
|
srm.DATA.Add(BLWording.REL, "");
|
|
}
|
|
return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm));
|
|
|
|
|
|
}
|
|
|
|
#endregion 展覽多媒體管理(List API 查詢展覽多媒體列表)
|
|
|
|
#region 展覽多媒體管理(List API 查詢展覽多媒體檔案列表)
|
|
|
|
/// <summary>
|
|
/// 展覽多媒體管理(List API 查詢展覽多媒體檔案列表)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
public HttpResponseMessage GetMediaFileList(string sExhibitionID)
|
|
{
|
|
|
|
SuccessResponseMessage srm = null;
|
|
string sError = null;
|
|
|
|
try
|
|
{
|
|
do
|
|
{
|
|
|
|
ExhibMediaMaintain_QryService emm_qry = new ExhibMediaMaintain_QryService();
|
|
var rsResult = emm_qry.QueryMediaFileList(sExhibitionID);
|
|
|
|
//返回token信息
|
|
srm = new SuccessResponseMessage(null, null);
|
|
|
|
var rsExhibMediaList = new List<ExhibMediaDTO>();
|
|
|
|
//rsExhibMediaList = ExhibMediaEntityToDTO(rsResult.DATA[BLWording.REL]);
|
|
|
|
srm.DATA.Add(BLWording.REL, rsResult);
|
|
|
|
} while (false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sError = Util.GetLastExceptionMsg(ex);
|
|
srm = new SuccessResponseMessage(null, null)
|
|
{
|
|
STATUSCODE = (int)StatusCodeEnum.Error,
|
|
MSG = StatusCodeEnum.Error.GetEnumText()
|
|
};
|
|
srm.DATA.Add(BLWording.REL, "");
|
|
}
|
|
return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm));
|
|
|
|
|
|
}
|
|
|
|
#endregion 展覽多媒體管理(List API 查詢展覽多媒體檔案列表)
|
|
|
|
|
|
|
|
|
|
private List<ExhibMediaDTO> ExhibMediaEntityToDTO(Object Data)
|
|
{
|
|
|
|
var Entities = new List<SETB_CMS_Exhibition_Media>();
|
|
|
|
if (Data.GetType() == typeof(List<SETB_CMS_Exhibition_Media>))
|
|
{
|
|
|
|
Entities = ((IEnumerable)Data).Cast<SETB_CMS_Exhibition_Media>().ToList();
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
Entities.Add((SETB_CMS_Exhibition_Media)Data);
|
|
|
|
}
|
|
|
|
List<ExhibMediaDTO> result = new List<ExhibMediaDTO>();
|
|
|
|
foreach (var Entity in Entities)
|
|
{
|
|
|
|
var ExhibMedia = new ExhibMediaDTO();
|
|
|
|
ExhibMedia.MediaID = Entity.MediaID;
|
|
ExhibMedia.ExhibitionID = Entity.ExhibitionID;
|
|
ExhibMedia.MediaName = Entity.MediaName;
|
|
ExhibMedia.MediaTypeID = Entity.MediaTypeID;
|
|
ExhibMedia.Data = Entity.Data;
|
|
ExhibMedia.Link = Entity.Link;
|
|
|
|
result.Add(ExhibMedia);
|
|
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|