Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SCZM.Model.Proj.proj_Payment model, int submitFlag, out string message)
        {
            message = "保存成功!";
            string errMessage = "";

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

            Model.Proj.proj_Payment model_old = dal.GetModel(model.ID);
            //----------------------审核不同意(billState==2)重新保存时,重置审批流为草稿状态,再进行保存------------------
            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
            {
                if (submitFlag == 1)
                {
                    errMessage = procBLL.SetBillProcess_Submit(tableName, model.ID.ToString(), 1, model.OperaId);
                    if (errMessage != "")
                    {
                        message = "保存成功,但提交失败,请联系系统管理员!";
                    }
                }
                return(true);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SCZM.Model.Proj.proj_Payment model, int submitFlag, out string message)
        {
            message = "保存成功!";
            string errMessage = "";

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

            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
            {
                if (submitFlag == 1)
                {
                    errMessage = procBLL.SetBillProcess_Submit(tableName, rowId.ToString(), 1, model.OperaId);
                    if (errMessage != "")
                    {
                        message = "保存成功,但提交失败,请联系系统管理员!";
                    }
                }
            }
            return(rowId);
        }