Esempio n. 1
0
        /// <summary>
        /// 保存审批类型
        /// </summary>
        /// <param name="sysSetModel"></param>
        /// <returns></returns>
        public SavedResult <Int64> PostAddProcType(QTSysSetModel sysSetModel)
        {
            if (sysSetModel == null)
            {
                return(null);
            }

            string code = "";

            //DicType为"splx"表示是审批类型的数据
            IList <QTSysSetModel> setModels = QTSysSetFacade.Find(t => t.DicType == "splx").Data;

            if (setModels == null || setModels.Count == 0)
            {
                code = "1";
            }
            else
            {
                string maxCode = setModels.OrderByDescending(t => t.TypeCode).ToList()[0].TypeCode;
                code = (Convert.ToInt32(maxCode) + 1) + "";
            }

            sysSetModel.TypeCode = code;
            sysSetModel.TypeCode = int.Parse(sysSetModel.Value).ToString();//与001,002等相对应,与添加顺序无关
            sysSetModel.DicType  = "splx";
            //先进行判断,审批流数据不能重复
            var oldset = this.QTSysSetFacade.Find(t => t.DicType == "splx" && t.Value == sysSetModel.Value).Data;

            if (oldset != null && oldset.Count > 0)
            {
                throw new Exception("审批流类型配置不能重复!");
            }
            SavedResult <Int64> savedResult = QTSysSetFacade.Save <Int64>(sysSetModel);

            return(savedResult);
        }