/// <summary> /// 增加一条数据 /// </summary> public int Add(SCZM.Model.Proj.proj_PartnerContract model, int submitFlag, out string message) { message = "保存成功!"; //if (dal.Exists(model.ProjId, model.PartnerId, 0)) //{ // message = "对不起,该合作单位的合同已存在!"; // return 0; //} string errMessage = ""; BLL.System.sys_Process_Exec procBLL = new BLL.System.sys_Process_Exec(); string tableName = "proj_PartnerContract"; 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 + ",") ; 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); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SCZM.Model.Proj.proj_PartnerContract model, int submitFlag, out string message) { message = "保存成功!"; //if (dal.Exists(model.ProjId, model.PartnerId, model.ID)) //{ // message = "对不起,该合作单位的合同已存在!"; // return false; //} string errMessage = ""; BLL.System.sys_Process_Exec procBLL = new BLL.System.sys_Process_Exec(); string tableName = "proj_PartnerContract"; Model.Proj.proj_PartnerContract 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 { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_Contract == "" || model.AttachmentId_Contract == null ? "" : model.AttachmentId_Contract + ",") ; 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); } }