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.
228 lines
7.3 KiB
228 lines
7.3 KiB
using EasyBL.WebApi.Message;
|
|
using Entity.Sugar;
|
|
using SqlSugar.Base;
|
|
using System;
|
|
|
|
namespace EasyBL.WEBAPP.WSM
|
|
{
|
|
public class ExhibStatMaintain_UpdService : ServiceBase
|
|
{
|
|
|
|
#region 展覽統計維護(新增)
|
|
|
|
/// <summary>
|
|
/// 展覽統計維護(新增)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
///
|
|
public ResponseMessage Insert(RequestMessage i_crm, SETB_CMS_Exhibition_Statistics Stat)
|
|
{
|
|
ResponseMessage rm = null;
|
|
string sMsg = null;
|
|
try
|
|
{
|
|
rm = SugarBase.ExecTran(db =>
|
|
{
|
|
do
|
|
{
|
|
var sStatisticID = _fetchString(i_crm, @"StatisticID");
|
|
|
|
if (string.IsNullOrEmpty(sStatisticID))
|
|
{
|
|
|
|
sStatisticID = Guid.NewGuid().ToString();
|
|
|
|
}
|
|
|
|
Stat.StatisticsID = sStatisticID;
|
|
Stat.DelStatus = "N";
|
|
Stat.Effective = "Y";
|
|
_setEntityBase(Stat, i_crm);
|
|
|
|
var iRel = 0;
|
|
|
|
iRel = db.Insertable(Stat).ExecuteCommand();
|
|
rm = new SuccessResponseMessage(null, i_crm);
|
|
rm.DATA.Add(BLWording.REL, Stat);
|
|
} while (false);
|
|
|
|
return rm;
|
|
});
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sMsg = Util.GetLastExceptionMsg(ex);
|
|
LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(ExhibStatMaintain_UpdService), "", "Insert 展覽統計維護(新增)", "", "", "");
|
|
}
|
|
finally
|
|
{
|
|
if (null != sMsg)
|
|
{
|
|
rm = new ErrorResponseMessage(sMsg, i_crm);
|
|
}
|
|
}
|
|
return rm;
|
|
}
|
|
|
|
#endregion 展覽統計維護(新增)
|
|
|
|
#region 展覽統計維護(修改)
|
|
|
|
/// <summary>
|
|
/// 展覽統計維護(修改)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
/// Origtek framwork API
|
|
public ResponseMessage Update(RequestMessage i_crm, SETB_CMS_Exhibition_Statistics Stat)
|
|
{
|
|
ResponseMessage rm = null;
|
|
string sMsg = null;
|
|
try
|
|
{
|
|
rm = SugarBase.ExecTran(db =>
|
|
{
|
|
do
|
|
{
|
|
_setEntityBase(Stat, i_crm);
|
|
Stat.DelStatus = "N";
|
|
Stat.Effective = "Y";
|
|
|
|
// Update self
|
|
var iRel = db.Updateable(Stat)
|
|
.Where(x => x.ExhibitionID == Stat.ExhibitionID)
|
|
.Where(x => x.Year == Stat.Year)
|
|
.Where(x => x.OrgID == Stat.OrgID)
|
|
.IgnoreColumns(x => new
|
|
{
|
|
x.CreateUser,
|
|
x.CreateDate
|
|
|
|
}).ExecuteCommand();
|
|
|
|
rm = new SuccessResponseMessage(null, i_crm);
|
|
rm.DATA.Add(BLWording.REL, Stat);
|
|
} while (false);
|
|
|
|
return rm;
|
|
});
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sMsg = Util.GetLastExceptionMsg(ex);
|
|
LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(ExhibStatMaintain_UpdService), "", "Update 展覽統計維護(修改)", "", "", "");
|
|
|
|
}
|
|
finally
|
|
{
|
|
if (null != sMsg)
|
|
{
|
|
rm = new ErrorResponseMessage(sMsg, i_crm);
|
|
}
|
|
}
|
|
return rm;
|
|
}
|
|
|
|
#endregion 展覽統計維護(修改)
|
|
|
|
#region 展覽統計維護(刪除)
|
|
|
|
/// <summary>
|
|
/// 展覽統計維護(刪除)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
/// Origtek framwork API
|
|
public ResponseMessage Delete(RequestMessage i_crm)
|
|
{
|
|
ResponseMessage rm = null;
|
|
string sMsg = null;
|
|
try
|
|
{
|
|
rm = SugarBase.ExecTran(db =>
|
|
{
|
|
do
|
|
{
|
|
|
|
// hard delete Exhibition
|
|
var sExhibitionID = _fetchString(i_crm, @"ExhibitionID");
|
|
|
|
var iRel = db.Deleteable<SETB_CMS_Exhibition_Statistics>()
|
|
.Where(t1 => t1.ExhibitionID == sExhibitionID)
|
|
.ExecuteCommand();
|
|
|
|
rm = new SuccessResponseMessage(null, i_crm);
|
|
rm.DATA.Add(BLWording.REL, iRel);
|
|
} while (false);
|
|
|
|
return rm;
|
|
});
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sMsg = Util.GetLastExceptionMsg(ex);
|
|
LogAndSendEmail(sMsg + @"Param:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(ExhibStatMaintain_UpdService), "", "Delete 展覽統計維護(刪除)", "", "", "");
|
|
}
|
|
finally
|
|
{
|
|
if (null != sMsg)
|
|
{
|
|
rm = new ErrorResponseMessage(sMsg, i_crm);
|
|
}
|
|
}
|
|
return rm;
|
|
}
|
|
|
|
#endregion 展覽統計維護(刪除)
|
|
|
|
#region 展覽統計維護(Hard 刪除全部)
|
|
|
|
/// <summary>
|
|
/// 展覽統計維護(Hard 刪除全部)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
///
|
|
public ResponseMessage HardDeleteAll(RequestMessage i_crm, string sExhibitionID)
|
|
{
|
|
ResponseMessage rm = null;
|
|
string sMsg = null;
|
|
try
|
|
{
|
|
rm = SugarBase.ExecTran(db =>
|
|
{
|
|
do
|
|
{
|
|
|
|
var iRel = db.Deleteable<SETB_CMS_Exhibition_Statistics>()
|
|
.Where(t1 => t1.OrgID == i_crm.ORIGID)
|
|
.Where(t1 => t1.ExhibitionID == sExhibitionID).ExecuteCommand();
|
|
|
|
rm = new SuccessResponseMessage(null, i_crm);
|
|
rm.DATA.Add(BLWording.REL, iRel);
|
|
} while (false);
|
|
|
|
return rm;
|
|
});
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sMsg = Util.GetLastExceptionMsg(ex);
|
|
LogAndSendEmail(sMsg + @"Param:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(ExhibStatMaintain_UpdService), "", "HardDeleteAll 展覽統計維護(Hard 刪除全部)", "", "", "");
|
|
|
|
}
|
|
finally
|
|
{
|
|
if (null != sMsg)
|
|
{
|
|
rm = new ErrorResponseMessage(sMsg, i_crm);
|
|
}
|
|
}
|
|
return rm;
|
|
}
|
|
|
|
#endregion 展覽統計維護(Hard 刪除全部)
|
|
|
|
}
|
|
}
|