public void Update(HotSaleCategory entity) { DataCommand dataCommand = DataCommandManager.GetDataCommand("WebSite_UpdateHotSaleCategory"); SetCommand(dataCommand, entity); dataCommand.ExecuteNonQuery(); }
public List <HotSaleCategory> GetByPosition(HotSaleCategory query) { DataCommand dataCommand = DataCommandManager.GetDataCommand("WebSite_GetHotSaleCategoryByPosition"); dataCommand.SetParameterValue("@Position", query.Position); dataCommand.SetParameterValue("@CompanyCode", query.CompanyCode); dataCommand.SetParameterValue("@GroupName", query.GroupName); return(dataCommand.ExecuteEntityList <HotSaleCategory>()); }
//验证:同一位置有效记录的组名必须相同 public string GetExistsGroupNameByPosition(HotSaleCategory query) { DataCommand dataCommand = DataCommandManager.GetDataCommand("WebSite_ExistHotSaleCategoryByPosition"); dataCommand.SetParameterValue("@Position", query.Position); dataCommand.SetParameterValue("@CompanyCode", query.CompanyCode); dataCommand.SetParameterValue("@GroupName", query.GroupName); dataCommand.SetParameterValue("@SysNo", query.SysNo); return(dataCommand.ExecuteScalar <string>()); }
//验证同位置同组下是否存在重复的分类设置 public bool CheckDuplicateCategory(HotSaleCategory query) { DataCommand dataCommand = DataCommandManager.GetDataCommand("WebSite_ExistHotSaleCategoryByCategory2"); dataCommand.SetParameterValue("@Position", query.Position); dataCommand.SetParameterValue("@CompanyCode", query.CompanyCode); dataCommand.SetParameterValue("@GroupName", query.GroupName); dataCommand.SetParameterValue("@C3SysNo", query.C3SysNo); dataCommand.SetParameterValue("@ExcludeSysNo", query.SysNo); return(dataCommand.ExecuteScalar <int>() > 0); }
private void SetCommand(DataCommand command, HotSaleCategory entity) { command.SetParameterValue("@C3SysNo", entity.C3SysNo); command.SetParameterValue("@GroupName", entity.GroupName); command.SetParameterValue("@ItemName", entity.ItemName); command.SetParameterValue("@PageId", entity.PageId); command.SetParameterValue("@PageType", entity.PageType); command.SetParameterValue("@Position", entity.Position); command.SetParameterValue("@Priority", entity.Priority); command.SetParameterValue("@Status", entity.Status); command.SetParameterValue("@SysNo", entity.SysNo); command.SetParameterValueAsCurrentUserAcct("@LogUser"); command.SetParameterValue("@CompanyCode", entity.CompanyCode); }
public void UpdateSameGroupAll(HotSaleCategory msg) { var sameGroupRecords = _hotProcessor.GetSameGroupOtherRecords(msg.SysNo.Value); using (TransactionScope ts = new TransactionScope()) { _hotProcessor.Update(msg); foreach (var item in sameGroupRecords) { //同时更新group name和position item.GroupName = msg.GroupName; item.Position = msg.Position; _hotProcessor.Update(item); } ts.Complete(); } }
private void Validate(HotSaleCategory msg) { msg.SysNo = msg.SysNo ?? 0; //同一位置有效记录的组名必须相同 string existsGroupName = _hotDA.GetExistsGroupNameByPosition(msg); if (!string.IsNullOrEmpty(existsGroupName)) { throw new BizException(string.Format(ResouceManager.GetMessageString("MKT.HotSaleCategory", "HotSaleCategory_ExistsGroupName"), existsGroupName)); } ///验证同位置同组下是否存在重复的分类设置 if (_hotDA.CheckDuplicateCategory(msg)) { //throw new BizException("当前组下已存在此分类,请修改!"); throw new BizException(ResouceManager.GetMessageString("MKT.HotSaleCategory", "HotSaleCategory_ExistsCategory")); } if (msg.Status == ADStatus.Active) { var existsActiveList = _hotDA.GetByPosition(msg); int totalActiveCount = existsActiveList.Count; //位置为泰隆优选热卖最多12个有效分类 if (msg.Position == 109) { if (totalActiveCount >= 12) { //throw new BizException(string.Format("当前组最多允许有{0}个有效分类!", 12)); throw new BizException(string.Format(ResouceManager.GetMessageString("MKT.HotSaleCategory", "HotSaleCategory_ExceedLimitSpecial1"), 12)); } } else { if (totalActiveCount >= 3) { //throw new BizException(string.Format("当前组最多允许有{0}个有效分类!",3)); throw new BizException(string.Format(ResouceManager.GetMessageString("MKT.HotSaleCategory", "HotSaleCategory_ExceedLimitSpecial1"), 3)); } } } }
public void UpdateSameGroupAllHotSaleCategory(HotSaleCategory msg) { _hotAppService.UpdateSameGroupAll(msg); }
public void UpdateHotSaleCategory(HotSaleCategory msg) { _hotAppService.Update(msg); }
public void InsertHotSaleCategory(HotSaleCategory msg) { _hotAppService.Insert(msg); }
public void Update(HotSaleCategory msg) { _hotProcessor.Update(msg); }
public void Insert(HotSaleCategory msg) { _hotProcessor.Insert(msg); }
public void Update(HotSaleCategory msg) { Validate(msg); _hotDA.Update(msg); }
public void Insert(HotSaleCategory msg) { Validate(msg); _hotDA.Insert(msg); }