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.
131 lines
4.0 KiB
131 lines
4.0 KiB
using EasyBL.WebApi.Message;
|
|
using Entity.Sugar;
|
|
using SqlSugar;
|
|
using SqlSugar.Base;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace EasyBL.WEBAPP.SYS
|
|
{
|
|
public class ExhibStatMaintain_QryService : ServiceBase
|
|
{
|
|
|
|
#region 展覽統計管理(List 查詢展覽統計)
|
|
|
|
/// <summary>
|
|
/// 展覽統計管理(List 查詢展覽統計)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
///
|
|
public ResponseMessage QueryStatisticsList(RequestMessage i_crm)
|
|
{
|
|
|
|
ResponseMessage rm = null;
|
|
string sMsg = null;
|
|
var db = SugarBase.GetIntance();
|
|
|
|
List<SETB_CMS_Exhibition_Statistics> saStats = new List<SETB_CMS_Exhibition_Statistics>();
|
|
|
|
try
|
|
{
|
|
do
|
|
{
|
|
|
|
var sExhibitionID = _fetchString(i_crm, @"ExhibitionID");
|
|
|
|
saStats = db.Queryable<SETB_CMS_Exhibition_Statistics>()
|
|
.Where(t1 => t1.OrgID == i_crm.ORIGID && t1.Effective == "Y" && t1.DelStatus == "N")
|
|
.Where(t1 => t1.ExhibitionID == sExhibitionID)
|
|
.Select((t1) => new SETB_CMS_Exhibition_Statistics
|
|
{
|
|
|
|
StatisticsID = SqlFunc.GetSelfAndAutoFill(t1.StatisticsID)
|
|
|
|
})
|
|
.OrderBy(t1 => t1.Year, OrderByType.Desc)
|
|
.ToList();
|
|
|
|
rm = new SuccessResponseMessage(null, i_crm);
|
|
rm.DATA.Add(BLWording.REL, saStats);
|
|
} while (false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sMsg = Util.GetLastExceptionMsg(ex);
|
|
LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(ExhibStatMaintain_QryService), "", "QueryStatisticsList 展覽統計(List 查詢展覽統計)", "", "", "");
|
|
}
|
|
finally
|
|
{
|
|
if (null != sMsg)
|
|
{
|
|
rm = new ErrorResponseMessage(sMsg, i_crm);
|
|
}
|
|
}
|
|
return rm;
|
|
|
|
}
|
|
|
|
#endregion 展覽統計管理(List 查詢展覽統計)
|
|
|
|
#region 展覽統計管理(Boolean 檢查是否存在)
|
|
|
|
/// <summary>
|
|
/// 展覽統計管理(Boolean 檢查是否存在)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
///
|
|
public Boolean Exists(RequestMessage i_crm, string sExhibitionID, string sYear)
|
|
{
|
|
|
|
Boolean found = false;
|
|
|
|
ResponseMessage rm = null;
|
|
string sMsg = null;
|
|
var db = SugarBase.GetIntance();
|
|
|
|
int count = 0;
|
|
|
|
try
|
|
{
|
|
do
|
|
{
|
|
|
|
|
|
count = db.Queryable<SETB_CMS_Exhibition_Statistics>()
|
|
.Where(x => x.OrgID == i_crm.ORIGID && x.Effective == "Y" && x.DelStatus == "N")
|
|
.Where(t1 => t1.ExhibitionID == sExhibitionID)
|
|
.Where(t1 => t1.Year == sYear)
|
|
.Count();
|
|
|
|
rm = new SuccessResponseMessage(null, i_crm);
|
|
rm.DATA.Add(BLWording.REL, count);
|
|
} while (false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sMsg = Util.GetLastExceptionMsg(ex);
|
|
LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(ExhibStatMaintain_QryService), "", "Exists 展覽統計管理(Boolean 檢查是否存在)", "", "", "");
|
|
|
|
}
|
|
finally
|
|
{
|
|
if (null != sMsg)
|
|
{
|
|
rm = new ErrorResponseMessage(sMsg, i_crm);
|
|
}
|
|
}
|
|
|
|
if (count > 0)
|
|
{
|
|
found = true;
|
|
}
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
#endregion 展覽統計管理(Boolean 檢查是否存在)
|
|
}
|
|
}
|