Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SCZM.Model.Proj.proj_Contract model, int submitFlag, out string message)
        {
            message = "保存成功!";
            if (dal.Exists(model.ProjId, 0))
            {
                message = "对不起,该项目合同已存在!";
                return(0);
            }
            string errMessage = "";

            BLL.System.sys_Process_Exec procBLL = new BLL.System.sys_Process_Exec();
            string tableName = "proj_Contract";

            if (submitFlag == 1)
            {
                message    = "保存并提交成功!";
                errMessage = procBLL.CheckSubmit(tableName, model.BillSign, model.DepId, "", model.OperaId);
                if (errMessage != "")
                {
                    message = errMessage;
                    return(0);
                }
            }
            int rowId = dal.Add(model);

            if (rowId < 1)
            {
                message = "保存失败!";
            }
            else
            {
                BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment();
                string IDList = (model.AttachmentId_Contract == "" || model.AttachmentId_Contract == null ? "" : model.AttachmentId_Contract + ",") +
                                (model.AttachmentId_ControlCard == "" || model.AttachmentId_ControlCard == null ? "" : model.AttachmentId_ControlCard + ",")
                ;
                string FileUse = "项目合同";
                if (IDList != "")
                {
                    attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, rowId);
                }
                if (submitFlag == 1)
                {
                    errMessage = procBLL.SetBillProcess_Submit(tableName, rowId.ToString(), 1, model.OperaId);
                    if (errMessage != "")
                    {
                        message = "保存成功,但提交失败,请联系系统管理员!";
                    }
                }
            }
            return(rowId);
        }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SCZM.Model.Proj.proj_Contract model, int submitFlag, out string message)
        {
            message = "保存成功!";
            if (dal.Exists(model.ProjId, model.ID))
            {
                message = "对不起,该项目合同已存在!";
                return(false);
            }

            string errMessage = "";

            BLL.System.sys_Process_Exec procBLL = new BLL.System.sys_Process_Exec();
            string tableName = "proj_Contract";

            Model.Proj.proj_Contract model_old = dal.GetModel(model.ID);
            if (model_old.BillState == 2)
            {
                int Num = procBLL.DelBillProcess(model.BillSign, model.ID, tableName, model.OperaId, model.OperaName);
                //if (Num == -1) {
                //    message = "对不起,系统出错,请联系系统管理员!";
                //    return false;
                //}
            }
            if (submitFlag == 1)
            {
                message    = "保存并提交成功!";
                errMessage = procBLL.CheckSubmit(tableName, model.BillSign, model.DepId, "", model.OperaId);
                if (errMessage != "")
                {
                    message = errMessage;
                    return(false);
                }
            }
            int rows = dal.Update(model);

            if (rows == 0)
            {
                message = "对不起,该条数据已被其他人删除!";
                return(false);
            }
            else
            {
                BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment();
                string IDList = (model.AttachmentId_Contract == "" || model.AttachmentId_Contract == null ? "" : model.AttachmentId_Contract + ",") +
                                (model.AttachmentId_ControlCard == "" || model.AttachmentId_ControlCard == null ? "" : model.AttachmentId_ControlCard + ",")
                ;
                string FileUse = "项目合同";
                if (IDList != "")
                {
                    attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, model.ID);
                }

                //
                if (submitFlag == 1)
                {
                    errMessage = procBLL.SetBillProcess_Submit(tableName, model.ID.ToString(), 1, model.OperaId);
                    if (errMessage != "")
                    {
                        message = "保存成功,但提交失败,请联系系统管理员!";
                    }
                }
                return(true);
            }
        }