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.
157 lines
4.7 KiB
157 lines
4.7 KiB
using EasyBL.WebApi;
|
|
using EasyBL.WebApi.Common;
|
|
using EasyBL.WebApi.Message;
|
|
using EasyBL.WEBAPP.WSM;
|
|
using Entity.ShowEasyDtos;
|
|
using Entity.Sugar;
|
|
using Entity.ViewModels;
|
|
using Newtonsoft.Json;
|
|
using SqlSugar;
|
|
using SqlSugar.Base;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
|
|
namespace EasyBL.WEBAPP.SYS
|
|
{
|
|
public class VenueService : ServiceBase
|
|
{
|
|
|
|
#region 展館管理(以ID查詢)
|
|
|
|
/// 展館管理(以ID查詢)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
///
|
|
|
|
public View_ORG_Venue FindByIDs(string sVenueID, string sLangType)
|
|
{
|
|
string sMsg = null;
|
|
var rsVenue = new View_ORG_Venue();
|
|
|
|
var db = SugarBase.GetIntance();
|
|
|
|
try
|
|
{
|
|
do
|
|
{
|
|
|
|
rsVenue = db.Queryable<SETB_ORG_Venue, SETB_SYS_Region, SETB_SYS_Country, SETB_UTL_City>
|
|
((t1, t2, t3, t4) => new object[] {
|
|
|
|
JoinType.Left, t1.RegionID == t2.RegionID && t1.LangType == t2.LangType,
|
|
JoinType.Left, t1.CountryID == t3.CountryID && t1.LangType == t3.LangType,
|
|
JoinType.Left, t1.CityID == t4.CityID && t1.LangType == t4.LangType
|
|
|
|
})
|
|
.Where((t1) => t1.VenueID == sVenueID)
|
|
.Where((t1) => t1.LangType == sLangType)
|
|
.Select((t1, t2, t3, t4) => new View_ORG_Venue {
|
|
|
|
VenueID = SqlFunc.GetSelfAndAutoFill(t1.VenueID),
|
|
RegionName = t2.RegionName,
|
|
CountryName = t3.CountryName,
|
|
CityName = t4.CityName
|
|
|
|
})
|
|
.Single();
|
|
|
|
} while (false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sMsg = Util.GetLastExceptionMsg(ex);
|
|
|
|
}
|
|
finally
|
|
{
|
|
|
|
}
|
|
|
|
return rsVenue;
|
|
|
|
}
|
|
|
|
#endregion 展館管理(以ID查詢)
|
|
|
|
|
|
|
|
|
|
#region 展館管理(VenueDTO API 查詢單筆展館)
|
|
|
|
/// <summary>
|
|
/// 展館管理(VenueDTO API 查詢單筆展館)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
public HttpResponseMessage GetOneVenue(string sLanguageID, string sVenueID)
|
|
{
|
|
|
|
RequestMessage i_crm = new RequestMessage();
|
|
i_crm.ORIGID = WebAppGlobalConstWord.TG_ORGID;
|
|
i_crm.DATA.Add("LangType", sLanguageID);
|
|
i_crm.DATA.Add("VenueID", sVenueID);
|
|
|
|
SuccessResponseMessage srm = null;
|
|
string sError = null;
|
|
|
|
try
|
|
{
|
|
do
|
|
{
|
|
if (string.IsNullOrEmpty(sLanguageID))
|
|
{
|
|
sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE;
|
|
}
|
|
|
|
VenueMaintain_UpdService vm_qry = new VenueMaintain_UpdService();
|
|
var rsResult = vm_qry.QueryOne(i_crm);
|
|
|
|
//返回token信息
|
|
srm = new SuccessResponseMessage(null, null);
|
|
|
|
var rsVenue = new VenueDTO();
|
|
|
|
rsVenue = EntityToDTO(rsResult.DATA[BLWording.REL] as View_ORG_Venue);
|
|
|
|
srm.DATA.Add(BLWording.REL, rsVenue);
|
|
|
|
} 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 展館管理(VenueDTO API 查詢單筆展館)
|
|
|
|
public static VenueDTO EntityToDTO(View_ORG_Venue Entity)
|
|
{
|
|
|
|
var rsVenueDTO = new VenueDTO();
|
|
|
|
rsVenueDTO.VenueID = Entity.VenueID;
|
|
rsVenueDTO.VenueName = Entity.VenueName;
|
|
rsVenueDTO.RegionName = Entity.RegionName;
|
|
rsVenueDTO.CountryName = Entity.CountryName;
|
|
rsVenueDTO.CityName = Entity.CityName;
|
|
rsVenueDTO.Website = Entity.Website;
|
|
rsVenueDTO.Address = Entity.Address;
|
|
|
|
return rsVenueDTO;
|
|
}
|
|
|
|
}
|
|
}
|