Ejemplo n.º 1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="paramModel">UIModel</param>
        /// <returns></returns>
        public bool SaveDetailDS(OrganizationManagerUIModel paramModel)
        {
            //服务端检查
            if (!ServerCheck(paramModel))
            {
                return(false);
            }

            //将UIModel转为TBModel
            var argsOrganization = CopyModel <MDLSM_Organization>(paramModel);

            //判断主键是否被赋值
            if (string.IsNullOrEmpty(argsOrganization.Org_ID))
            {
                //生成新ID
                argsOrganization.Org_ID          = Guid.NewGuid().ToString();
                argsOrganization.Org_CreatedBy   = LoginInfoDAX.UserName;
                argsOrganization.Org_CreatedTime = BLLCom.GetCurStdDatetime();
                argsOrganization.Org_UpdatedBy   = LoginInfoDAX.UserName;
                argsOrganization.Org_UpdatedTime = BLLCom.GetCurStdDatetime();
                //主键未被赋值,则执行新增
                if (!_bll.Insert(argsOrganization))
                {
                    ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.NEW + MsgParam.ORGNIZATION });
                    return(false);
                }
            }
            else
            {
                //主键被赋值,则需要更新,更新需要设定更新条件
                argsOrganization.WHERE_Org_ID        = argsOrganization.Org_ID;
                argsOrganization.WHERE_Org_VersionNo = argsOrganization.Org_VersionNo;
                argsOrganization.Org_VersionNo++;
                argsOrganization.Org_UpdatedBy   = LoginInfoDAX.UserName;
                argsOrganization.Org_UpdatedTime = BLLCom.GetCurStdDatetime();
                if (!_bll.Update(argsOrganization))
                {
                    ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { MsgParam.UPDATE + MsgParam.ORGNIZATION });
                    return(false);
                }
            }

            //将最新数据回写给DetailDS
            CopyModel(argsOrganization, paramModel);

            return(true);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 服务端检查
 /// </summary>
 /// <param name="paramModel">UIModel</param>
 /// <returns></returns>
 private bool ServerCheck(OrganizationManagerUIModel paramModel)
 {
     return(true);
 }