/// <summary> /// 保存 /// </summary> /// <param name="paramModel">UIModel</param> /// <returns></returns> public bool SaveDetailDS(AutoPartsTypeManagerUIModel paramModel) { //服务端检查 if (!ServerCheck(paramModel)) { return(false); } #region 保存数据 //将UIModel转为TBModel var argsAutoPartsType = CopyModel <MDLBS_AutoPartsType>(paramModel); //判断主键是否被赋值 if (string.IsNullOrEmpty(argsAutoPartsType.APT_ID)) { #region 新增 //生成新ID argsAutoPartsType.APT_ID = Guid.NewGuid().ToString(); argsAutoPartsType.APT_CreatedBy = LoginInfoDAX.UserName; argsAutoPartsType.APT_CreatedTime = BLLCom.GetCurStdDatetime(); argsAutoPartsType.APT_UpdatedBy = LoginInfoDAX.UserName; argsAutoPartsType.APT_UpdatedTime = BLLCom.GetCurStdDatetime(); //主键未被赋值,则执行新增 if (!_bll.Insert(argsAutoPartsType)) { //新增[配件类别]信息失败 ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { MsgParam.ADD + SystemTableEnums.Name.BS_AutoPartsType }); return(false); } #endregion } else { #region 更新 //主键被赋值,则需要更新,更新需要设定更新条件 argsAutoPartsType.WHERE_APT_ID = argsAutoPartsType.APT_ID; argsAutoPartsType.WHERE_APT_VersionNo = argsAutoPartsType.APT_VersionNo; argsAutoPartsType.APT_VersionNo++; argsAutoPartsType.APT_UpdatedBy = LoginInfoDAX.UserName; argsAutoPartsType.APT_UpdatedTime = BLLCom.GetCurStdDatetime(); if (!_bll.Update(argsAutoPartsType)) { //更新[配件类别]信息失败! ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { MsgParam.UPDATE + SystemTableEnums.Name.BS_AutoPartsType }); return(false); } #endregion } //将最新数据回写给DetailDS CopyModel(argsAutoPartsType, paramModel); #endregion //刷新配件类别缓存 var resultAutoPartsTypeList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsType) as List <MDLBS_AutoPartsType>; List <MDLBS_AutoPartsType> newAutoPartsTypeList = new List <MDLBS_AutoPartsType>(); if (resultAutoPartsTypeList != null) { newAutoPartsTypeList = resultAutoPartsTypeList; if (resultAutoPartsTypeList.All(x => x.APT_ID != argsAutoPartsType.APT_ID && x.APT_Name != argsAutoPartsType.APT_Name)) { newAutoPartsTypeList.Add(argsAutoPartsType); CacheDAX.Add(CacheDAX.ConfigDataKey.AutoPartsType, newAutoPartsTypeList, true); } } else { newAutoPartsTypeList.Add(argsAutoPartsType); CacheDAX.Add(CacheDAX.ConfigDataKey.AutoPartsType, newAutoPartsTypeList, true); } return(true); }
/// <summary> /// 服务端检查 /// </summary> /// <param name="paramModel">UIModel</param> /// <returns></returns> private bool ServerCheck(AutoPartsTypeManagerUIModel paramModel) { return(true); }