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.
189 lines
6.1 KiB
189 lines
6.1 KiB
using EasyBL.WebApi.Message;
|
|
using Entity.Sugar;
|
|
using SqlSugar;
|
|
using SqlSugar.Base;
|
|
using System;
|
|
using EasyBL.WEBAPP.SYS;
|
|
using Entity.ViewModels;
|
|
using Newtonsoft.Json;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace EasyBL.WEBAPP.WSM
|
|
{
|
|
public class ExhibMediaMaintain_UpdService : ServiceBase
|
|
{
|
|
|
|
public static string LANGUAGEID = ExhibMaintain_QryService.LANGUAGEID;
|
|
public static string EN_US = ExhibMaintain_QryService.EN_US;
|
|
|
|
#region 展覽多媒體維護(新增)
|
|
|
|
/// <summary>
|
|
/// 展覽多媒體維護(新增)
|
|
/// </summary>
|
|
/// <param name="i_crm"></param>
|
|
/// <returns></returns>
|
|
///
|
|
public ResponseMessage Insert(RequestMessage i_crm, SETB_CMS_Exhibition_Media Media)
|
|
{
|
|
ResponseMessage rm = null;
|
|
string sMsg = null;
|
|
try
|
|
{
|
|
rm = SugarBase.ExecTran(db =>
|
|
{
|
|
do
|
|
{
|
|
var sMediaID = _fetchString(i_crm, @"MediaID");
|
|
|
|
if (string.IsNullOrEmpty(sMediaID))
|
|
{
|
|
|
|
sMediaID = Guid.NewGuid().ToString();
|
|
|
|
}
|
|
|
|
Media.MediaID = sMediaID;
|
|
Media.DelStatus = "N";
|
|
Media.Effective = "Y";
|
|
_setEntityBase(Media, i_crm);
|
|
|
|
var iRel = 0;
|
|
|
|
iRel = db.Insertable(Media).ExecuteCommand();
|
|
rm = new SuccessResponseMessage(null, i_crm);
|
|
rm.DATA.Add(BLWording.REL, Media);
|
|
} 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(ExhibMediaMaintain_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_Media Media)
|
|
{
|
|
ResponseMessage rm = null;
|
|
string sMsg = null;
|
|
try
|
|
{
|
|
rm = SugarBase.ExecTran(db =>
|
|
{
|
|
do
|
|
{
|
|
_setEntityBase(Media, i_crm);
|
|
Media.DelStatus = "N";
|
|
Media.Effective = "Y";
|
|
|
|
// Update self
|
|
var iRel = db.Updateable(Media)
|
|
.Where(t1 => t1.MediaID == Media.MediaID)
|
|
.Where(t1 => t1.ExhibitionID == Media.ExhibitionID)
|
|
.Where(t1 => t1.OrgID == Media.OrgID)
|
|
.IgnoreColumns(x => new
|
|
{
|
|
x.CreateUser,
|
|
x.CreateDate
|
|
|
|
}).ExecuteCommand();
|
|
|
|
rm = new SuccessResponseMessage(null, i_crm);
|
|
rm.DATA.Add(BLWording.REL, Media);
|
|
} 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(ExhibMediaMaintain_UpdService), "", "Update 展覽多媒體維護(修改)", "", "", "");
|
|
|
|
}
|
|
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
|
|
{
|
|
|
|
System.Diagnostics.Debug.WriteLine("Delete sExhibitionID" + ": " + sExhibitionID);
|
|
|
|
var iRel = db.Deleteable<SETB_CMS_Exhibition_Media>()
|
|
.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(ExhibMediaMaintain_UpdService), "", "HardDeleteAll 展覽多媒體維護(Hard 刪除全部)", "", "", "");
|
|
|
|
}
|
|
finally
|
|
{
|
|
if (null != sMsg)
|
|
{
|
|
rm = new ErrorResponseMessage(sMsg, i_crm);
|
|
}
|
|
}
|
|
return rm;
|
|
}
|
|
|
|
#endregion 展覽多媒體維護(Hard 刪除全部)
|
|
|
|
}
|
|
}
|