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.
 
 
 
 
 

813 lines
28 KiB

using EasyBL.WebApi.Message;
using EasyBL.WEBAPP.ShowEasy;
using EasyBL.WEBAPP.SYS;
using Entity.Sugar;
using Entity.ViewModels;
using Newtonsoft.Json;
using SqlSugar.Base;
using System;
using System.Collections.Generic;
using System.Linq;
namespace EasyBL.WEBAPP.WSM
{
public class ExhibMaintain_UpdService : ServiceBase
{
#region 展覽維護(單筆查詢 call ExhibMaintain_QryService QueryOne)
/// <summary>
/// 展覽維護(單筆查詢 call ExhibMaintain_QryService QueryOne)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
/// Origtek framwork API
public ResponseMessage QueryOne(RequestMessage i_crm)
{
ExhibMaintain_QryService em_qry = new ExhibMaintain_QryService();
ResponseMessage rm = em_qry.QueryOne(i_crm);
return rm;
}
#endregion 展覽維護(單筆查詢 call ExhibMaintain_QryService QueryOne)
public ResponseMessage SaveExhibition(RequestMessage i_crm) {
ResponseMessage rm = null;
var sExhibitionID = _fetchString(i_crm, @"ExhibitionID");
if (string.IsNullOrEmpty(sExhibitionID))
{
sExhibitionID = Guid.NewGuid().ToString();
i_crm.DATA["ExhibitionID"] = sExhibitionID;
Insert(i_crm);
}
else {
Update(i_crm);
}
ExhibMaintain_QryService em_qry = new ExhibMaintain_QryService();
rm = em_qry.QueryOne(i_crm);
return rm;
}
#region 展覽維護(新增)
/// <summary>
/// 展覽維護(新增)
/// </summary>
/// <param name="i_crm">todo: describe i_crm parameter on UpdImportCustomers</param>
/// <returns></returns>
/// Origtek framwork API
public ResponseMessage Insert(RequestMessage i_crm)
{
ResponseMessage rm = null;
string sMsg = null;
try
{
rm = SugarBase.ExecTran(db =>
{
do
{
var sExhibitionID = _fetchString(i_crm, @"ExhibitionID");
if (string.IsNullOrEmpty(sExhibitionID))
{
sExhibitionID = Guid.NewGuid().ToString();
}
LanguageMaintain_QryService lm_qry = new LanguageMaintain_QryService();
List<SETB_SYS_Language> saLanguageList = lm_qry.QueryLanguageList(i_crm);
var iRel = 0;
foreach (SETB_SYS_Language language in saLanguageList)
{
iRel = InsertByLanguage(i_crm, sExhibitionID, language.LanguageID);
}
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 + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(ExhibMaintain_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>
///
public int InsertByLanguage(RequestMessage i_crm, string sExhibitionID, string sLanguage)
{
ResponseMessage rm = null;
string sMsg = null;
var db = SugarBase.GetIntance();
var iRel = 0;
try
{
do
{
if (string.IsNullOrEmpty(sExhibitionID))
{
sExhibitionID = Guid.NewGuid().ToString();
}
var sMainCategoryID = _fetchString(i_crm, @"MainCategoryID");
var sSubCategoryID = _fetchString(i_crm, @"SubCategoryID");
var oEntity = _fetchEntity<SETB_CMS_Exhibition>(i_crm);
_setEntityBase(oEntity, i_crm);
oEntity.ExhibitionID = sExhibitionID;
oEntity.LanguageID = sLanguage;
//oEntity.MainCategoryIDs = sMainCategoryID;
//oEntity.SubCategoryIDs = sSubCategoryID;
oEntity.DelStatus = "N";
if (sLanguage == WebAppGlobalConstWord.EN_US)
{
oEntity.ExhibitionName = _fetchString(i_crm, @"ExhibitionName");
}
iRel = db.Insertable(oEntity).ExecuteCommand();
rm = new SuccessResponseMessage(null, i_crm);
rm.DATA.Add(BLWording.REL, iRel);
} while (false);
}
catch (Exception ex)
{
sMsg = Util.GetLastExceptionMsg(ex);
LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(ExhibMaintain_UpdService), "", "InsertByLanguage 展覽維護(以語言新增)", "", "", "");
}
finally
{
if (null != sMsg)
{
rm = new ErrorResponseMessage(sMsg, i_crm);
}
}
return iRel;
}
#endregion 展覽維護(以語言新增)
#region 展覽維護(修改)
/// <summary>
/// 展覽維護(修改)
/// </summary>
/// <param name="i_crm">todo: describe i_crm parameter on UpdImportCustomers</param>
/// <returns></returns>
/// Origtek framwork API
public ResponseMessage Update(RequestMessage i_crm)
{
ResponseMessage rm = null;
string sMsg = null;
try
{
rm = SugarBase.ExecTran(db =>
{
do
{
var sMainCategoryID = _fetchString(i_crm, @"MainCategoryID");
var sSubCategoryID = _fetchString(i_crm, @"SubCategoryID");
ExhibMaintain_QryService em_qry = new ExhibMaintain_QryService();
var oNewEntity = _fetchEntity<SETB_CMS_Exhibition>(i_crm);
_setEntityBase(oNewEntity, i_crm);
oNewEntity.DelStatus = "N";
var oOldEntity = em_qry.FindOneByIDs(oNewEntity.ExhibitionID, oNewEntity.LanguageID);
if (oNewEntity.OrderByValue > oOldEntity.OrderByValue)
{
var iRelUp = db.Updateable<SETB_CMS_Exhibition>()
.UpdateColumns(x => new SETB_CMS_Exhibition { OrderByValue = x.OrderByValue - 1 })
.Where(x => x.OrgID == oNewEntity.OrgID && x.ExhibitionID == oNewEntity.ExhibitionID && x.OrderByValue <= oNewEntity.OrderByValue && x.OrderByValue > oOldEntity.OrderByValue).ExecuteCommand();
}
else
{
var iRelDown = db.Updateable<SETB_CMS_Exhibition>()
.UpdateColumns(x => new SETB_CMS_Exhibition { OrderByValue = x.OrderByValue + 1 })
.Where(x => x.OrgID == oNewEntity.OrgID && x.ExhibitionID == oNewEntity.ExhibitionID && x.OrderByValue >= oNewEntity.OrderByValue && x.OrderByValue < oOldEntity.OrderByValue).ExecuteCommand();
}
// Update all
var iRelAll = db.Updateable<SETB_CMS_Exhibition>(oNewEntity).IgnoreColumns(x => new
{
x.CreateUser,
x.CreateDate,
x.LanguageID,
x.ExhibitionName,
x.AbbreviatedName
}).Where(x => x.OrgID == oNewEntity.OrgID && x.ExhibitionID == oNewEntity.ExhibitionID).ExecuteCommand();
// Update self
var iRel = db.Updateable(oNewEntity)
.IgnoreColumns(x => new
{
x.CreateUser,
x.CreateDate
}).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(ExhibMaintain_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>()
.Where(t1 => t1.ExhibitionID == sExhibitionID)
.ExecuteCommand();
// hard delete ExhibInfo
ExhibInfoMaintain_UpdService em_upd = new ExhibInfoMaintain_UpdService();
em_upd.Delete(i_crm);
// hard delete ExhibStatistics
ExhibStatMaintain_UpdService esm_upd = new ExhibStatMaintain_UpdService();
esm_upd.Delete(i_crm);
// hard delete ExhibMedia
ExhibMediaMaintain_UpdService emm_upd = new ExhibMediaMaintain_UpdService();
emm_upd.Delete(i_crm);
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(ExhibMaintain_UpdService), "", "Delete 展覽維護(刪除)", "", "", "");
}
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 UpdateOrderByValue(RequestMessage i_crm)
{
ResponseMessage rm = null;
string sMsg = null;
try
{
rm = SugarBase.ExecTran(db =>
{
do
{
var sExhibitionID = _fetchString(i_crm, @"Id");
if (!String.IsNullOrEmpty(_fetchString(i_crm, @"ExhibitionID")))
{
sExhibitionID = _fetchString(i_crm, @"ExhibitionID");
}
var sLanguageID = _fetchString(i_crm, @"LanguageID");
if (string.IsNullOrEmpty(sLanguageID))
{
sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE;
}
var iOldOrderByValue = _fetchInt(i_crm, @"OldOrderByValue");
var iNewOrderByValue = _fetchInt(i_crm, @"NewOrderByValue");
var oOrderEntity = db.Queryable<SETB_CMS_Exhibition>().Single(x => x.OrgID == i_crm.ORIGID && x.ExhibitionID == sExhibitionID && x.LanguageID == sLanguageID);
if (iNewOrderByValue > iOldOrderByValue)
{
var iRelUp = db.Updateable<SETB_CMS_Exhibition>()
.UpdateColumns(x => new SETB_CMS_Exhibition { OrderByValue = x.OrderByValue - 1 })
.Where(x => x.OrgID == oOrderEntity.OrgID && x.OrderByValue <= iNewOrderByValue && x.OrderByValue > iOldOrderByValue)
.ExecuteCommand();
}
else
{
var iRelDown = db.Updateable<SETB_CMS_Exhibition>()
.UpdateColumns(x => new SETB_CMS_Exhibition { OrderByValue = x.OrderByValue + 1 })
.Where(x => x.OrgID == oOrderEntity.OrgID && x.OrderByValue >= iNewOrderByValue && x.OrderByValue < iOldOrderByValue)
.ExecuteCommand();
}
var iRelSelf = db.Updateable(new SETB_CMS_Exhibition { OrderByValue = iNewOrderByValue })
.UpdateColumns(x => x.OrderByValue)
.Where(x => x.OrgID == i_crm.ORIGID && x.ExhibitionID == sExhibitionID).ExecuteCommand();
rm = new SuccessResponseMessage(null, i_crm);
rm.DATA.Add(BLWording.REL, iRelSelf);
} 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(ExhibMaintain_UpdService), "", "UpdateOrderByValue 展覽維護(更新排序)", "", "", "");
}
finally
{
if (null != sMsg)
{
rm = new ErrorResponseMessage(sMsg, i_crm);
}
}
return rm;
}
#endregion 展覽維護(更新排序)
#region 展覽維護(查詢筆數 call ExhibMaintain_QryService QueryCout)
/// <summary>
/// 展覽維護(查詢筆數 call ExhibMaintain_QryService QueryCout)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
/// Origtek framwork API
public ResponseMessage QueryCout(RequestMessage i_crm)
{
ExhibMaintain_QryService em_qry = new ExhibMaintain_QryService();
ResponseMessage rm = em_qry.QueryCout(i_crm);
return rm;
}
#endregion 展覽維護(查詢筆數 call ExhibMaintain_QryService QueryCout)
#region 展覽主類別查詢 (List call ExhibMainCategoryMaintain_QryService QueryExhibMainCategoryList)
public ResponseMessage QueryExhibMainCategoryList(RequestMessage i_crm)
{
ExhibMainCategoryMaintain_QryService emcm_qry = new ExhibMainCategoryMaintain_QryService();
ResponseMessage rm = emcm_qry.QueryExhibMainCategoryList(i_crm);
return rm;
}
#endregion 展覽主類別查詢 (List call ExhibMainCategoryMaintain_QryService QueryExhibMainCategoryList)
#region 展覽子類別查詢 (List call ExhibSubCategoryMaintain_QryService QueryExhibSubCategoryList)
public ResponseMessage QueryExhibSubCategoryList(RequestMessage i_crm)
{
ExhibSubCategoryMaintain_QryService escm_qry = new ExhibSubCategoryMaintain_QryService();
ResponseMessage rm = escm_qry.QueryExhibSubCategoryList(i_crm);
return rm;
}
#endregion 展覽子類別查詢 (List call ExhibSubCategoryMaintain_QryService QueryExhibSubCategoryList)
#region 展覽維護(查詢展覽資訊 call ExhibInfoMaintain_QryService QueryExhibInfo)
/// <summary>
/// 展覽維護(查詢展覽資訊 call ExhibMaintain_QryService QueryExhibInfo)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage QueryOneExhibInfo(RequestMessage i_crm)
{
ExhibInfoMaintain_QryService eim_qry = new ExhibInfoMaintain_QryService();
ResponseMessage rm = eim_qry.QueryOneExhibInfo2(i_crm);
return rm;
}
#endregion 展覽維護(查詢展覽資訊 call ExhibInfoMaintain_QryService QueryExhibInfo)
#region 展覽維護(處存展覽資訊 call ExhibInfoMaintain_UpdService Insert/Update)
/// <summary>
/// 展覽維護(處存展覽資訊 call ExhibInfoMaintain_UpdService Insert/Update)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage SaveExhibInfo(RequestMessage i_crm)
{
ResponseMessage rm = null;
var ExhibInfo = _fetchEntity<SETB_CMS_Exhibition_Info>(i_crm);
System.Diagnostics.Debug.WriteLine("ExhibInfo.ExhibitionInfoID" + ": " + ExhibInfo.ExhibitionInfoID);
ExhibInfoMaintain_UpdService eim_upd = new ExhibInfoMaintain_UpdService();
if (string.IsNullOrEmpty(ExhibInfo.ExhibitionInfoID))
{
rm = eim_upd.Insert(i_crm);
}
else
{
rm = eim_upd.Update(i_crm);
}
return rm;
}
#endregion 展覽維護(處存展覽資訊 call ExhibInfoMaintain_UpdService Insert/Update)
#region 展覽維護(處存統計 call ExhibInfoMaintain_UpdService Insert/Update)
/// <summary>
/// 展覽維護(處存統計 call ExhibInfoMaintain_UpdService Insert/Update)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage SaveStat(RequestMessage i_crm)
{
ResponseMessage rm = null;
var Stats = JsonConvert.DeserializeObject<List<SETB_CMS_Exhibition_Statistics>>(_fetchString(i_crm, @"Stats"));
ExhibStatMaintain_UpdService esm_upd = new ExhibStatMaintain_UpdService();
ExhibStatMaintain_QryService esm_qry = new ExhibStatMaintain_QryService();
// Hard delete all
esm_upd.HardDeleteAll(i_crm, Stats.FirstOrDefault().ExhibitionID);
foreach (var stat in Stats)
{
if (esm_qry.Exists(i_crm, stat.ExhibitionID, stat.Year))
{
rm = esm_upd.Update(i_crm, stat);
}
else
{
rm = esm_upd.Insert(i_crm, stat);
}
}
rm = new SuccessResponseMessage(null, i_crm);
rm.DATA.Add(BLWording.REL, Stats);
return rm;
}
#endregion 展覽維護(處存統計 call ExhibInfoMaintain_UpdService Insert/Update)
#region 展覽維護(List 查詢展覽統計 call ExhibStatMaintain_QryService QueryStatisticList)
/// 展覽維護(List 查詢展覽統計 call ExhibStatMaintain_QryService QueryStatisticList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage QueryStatisticsList(RequestMessage i_crm)
{
ExhibStatMaintain_QryService esm_qry = new ExhibStatMaintain_QryService();
ResponseMessage rm = esm_qry.QueryStatisticsList(i_crm);
return rm;
}
#endregion 展覽維護(List 查詢展覽統計 call ExhibStatMaintain_QryService QueryStatisticList)
#region 展覽維護(List 查詢洲別選單 call RegionMaintain_QryService QueryRegionList)
/// 展覽維護(List 查詢洲別選單 call RegionMaintain_QryService QueryRegionList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage QueryRegionList(RequestMessage i_crm)
{
RegionMaintain_QryService rm_qry = new RegionMaintain_QryService();
ResponseMessage rm = rm_qry.QueryRegionList(i_crm);
return rm;
}
#endregion 展覽維護(List 查詢洲別選單 call RegionMaintain_QryService QueryRegionList)
#region 展覽維護(List 查詢國家選單 call CountryMaintain_QryService QueryCountryList)
/// 展覽維護(List 查詢國家選單 call CountryMaintain_QryService QueryCountryList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage QueryCountryList(RequestMessage i_crm)
{
CountryMaintain_QryService cm_qry = new CountryMaintain_QryService();
ResponseMessage rm = cm_qry.QueryCountryList(i_crm);
return rm;
}
#endregion 展覽維護(List 查詢國家選單 call CountryMaintain_QryService QueryCountryList)
#region 展覽維護(List 查詢國家選單 call CityMaintain_QryService QueryCityList)
/// 展覽維護(List 查詢國家選單 call CityMaintain_QryService QueryCityList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage QueryCityList(RequestMessage i_crm)
{
CityMaintain_QryService cm_qry = new CityMaintain_QryService();
ResponseMessage rm = cm_qry.QueryCityList(i_crm);
return rm;
}
#endregion 展覽維護(List 查詢國家選單 call CityMaintain_QryService QueryCityList)
#region 展覽維護(List 查詢展館選單 call VenueMaintain_QryService QueryVenueList)
/// 展覽維護(List 查詢展館選單 call VenueMaintain_QryService QueryVenueList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage QueryVenueList(RequestMessage i_crm)
{
VenueMaintain_QryService vm_qry = new VenueMaintain_QryService();
ResponseMessage rm = vm_qry.QueryVenueList(i_crm);
return rm;
}
#endregion 展覽維護(List 查詢展館選單 call VenueMaintain_QryService QueryVenueList)
#region 展覽維護(List 查詢主辦單位選單 call OrganizerMaintain_QryService QueryOrganizerList)
/// 展覽維護(List 查詢主辦單位選單 call OrganizerMaintain_QryService QueryOrganizerList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage QueryOrganizerList(RequestMessage i_crm)
{
OrganizerMaintain_QryService om_qry = new OrganizerMaintain_QryService();
ResponseMessage rm = om_qry.QueryOrganizerList(i_crm);
return rm;
}
#endregion 展覽維護(List 查詢主辦單位選單 call OrganizerMaintain_QryService QueryOrganizerList)
#region 語言選單(call LanguageMaintainQryService QueryList)
/// <summary>
/// 語言選單(call LanguageMaintainQryService QueryList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
public ResponseMessage QueryLanguageList(RequestMessage i_crm)
{
LanguageMaintain_QryService lm_upd = new LanguageMaintain_QryService();
ResponseMessage rm = lm_upd.QueryList(i_crm);
return rm;
}
#endregion 語言選單(call LanguageMaintainQryService QueryList)
#region 展覽管理(List 查詢展覽狀態 call ExhibMaintain_QryService QueryShowStatusList)
/// <summary>
/// 展覽管理(List 查詢展覽狀態 call ExhibMaintain_QryService QueryShowStatusList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
public ResponseMessage QueryShowStatusList(RequestMessage i_crm)
{
ExhibMaintain_QryService em_qry = new ExhibMaintain_QryService();
ResponseMessage rm = em_qry.QueryShowStatusList(i_crm);
return rm;
}
#endregion 展覽管理(List 查詢展覽狀態 call ExhibMaintain_QryService QueryShowStatusList)
#region 展覽管理(List 查詢展覽週期選單 call ExhibMaintain_QryService QueryFrequencyList)
/// <summary>
/// 展覽管理(List 查詢展覽週期選單 call ExhibMaintain_QryService QueryFrequencyList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
public ResponseMessage QueryFrequencyList(RequestMessage i_crm)
{
ExhibMaintain_QryService em_qry = new ExhibMaintain_QryService();
ResponseMessage rm = em_qry.QueryFrequencyList(i_crm);
return rm;
}
#endregion 展覽管理(List 查詢展覽週期選單 call ExhibMaintain_QryService QueryFrequencyList)
#region 展覽管理(List 查詢多媒體 call ExhibMaintain_QryService QueryMediaList)
/// <summary>
/// 展覽管理(List 查詢多媒體 call ExhibMaintain_QryService QueryMediaList)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
public ResponseMessage QueryMediaList(RequestMessage i_crm)
{
ExhibMediaMaintain_QryService emm_qry = new ExhibMediaMaintain_QryService();
ResponseMessage rm = emm_qry.QueryMediaList(i_crm);
return rm;
}
#endregion 展覽管理(List 查詢多媒體 call ExhibMaintain_QryService QueryMediaList)
#region 展覽維護(處存展覽多媒體 call ExhibMediaMaintain_UpdService Insert/Update)
/// <summary>
/// 展覽維護(處存展覽多媒體 call ExhibMediaMaintain_UpdService Insert/Update)
/// </summary>
/// <param name="i_crm"></param>
/// <returns></returns>
///
public ResponseMessage SaveMediaList(RequestMessage i_crm)
{
ResponseMessage rm = null;
var MediaList = JsonConvert.DeserializeObject<List<SETB_CMS_Exhibition_Media>>(_fetchString(i_crm, @"MediaList"));
ExhibMediaMaintain_UpdService emm_upd = new ExhibMediaMaintain_UpdService();
ExhibMediaMaintain_QryService emm_qry = new ExhibMediaMaintain_QryService();
// Hard delete all
emm_upd.HardDeleteAll(i_crm, MediaList.FirstOrDefault().ExhibitionID);
foreach (var Media in MediaList)
{
if (emm_qry.Exists(i_crm, Media.MediaID, Media.ExhibitionID))
{
rm = emm_upd.Update(i_crm, Media);
}
else
{
rm = emm_upd.Insert(i_crm, Media);
}
}
rm = new SuccessResponseMessage(null, i_crm);
rm.DATA.Add(BLWording.REL, MediaList);
return rm;
}
#endregion 展覽維護(處存展覽多媒體 call ExhibMediaMaintain_UpdService Insert/Update)
}
}