private int Save(int rRunId, int rStepId) { //1.获取模型 WX.Flow.Model.Run.MODEL runmodel = WX.Flow.Model.Run.NewDataModel(rRunId); WX.Flow.Model.Process.MODEL process = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + (runmodel.StepNo.ToInt32() + 1)); if (process == null) { runmodel.Deal_Flag.value = WX.Flow.DealFlag.HasOperated; } else { runmodel.Deal_Flag.value = WX.Flow.DealFlag.NotReceived; if (process.Next_Nodes.ToString() != "") { runmodel.Next_Nodes.value = process.Next_Nodes.value; } else { WX.Flow.Model.Process.MODEL proc = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + runmodel.StepNo.ToInt32()); runmodel.Next_Nodes.value = proc.Next_Nodes.value; } runmodel.StepNo.value = process.StepNo.value; } //2.取表单值 runmodel.LoadMyForm(false); WX.Flow.FormFieldCollection ffc = runmodel.MyForm.GetPostedDatas(); //3.上传附件并取得附件列表 string attach_nameList = String.Empty; string attache_idlist = String.Empty; //4.取得手写与签章信息 int iR = runmodel.Save(rStepId, ffc, attache_idlist, attach_nameList, "", "", 0);//最后两个参数为会签意见和手写签章信息 runmodel.Update(); return(0);// iR; }
}/// <summary> /// 保存表单及其它功能按钮 /// </summary> private int Save(int rRunId, int rStepId) { //1.获取模型 WX.Flow.Model.Run.MODEL runmodel = WX.Flow.Model.Run.NewDataModel(rRunId); WX.Flow.Model.Process.MODEL process = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + (runmodel.StepNo.ToInt32() + 1)); if (process == null) { runmodel.Deal_Flag.value = DealFlag.HasOperated; } else { runmodel.Deal_Flag.value = DealFlag.NotReceived; if (process.Next_Nodes.ToString() != "") { runmodel.Next_Nodes.value = process.Next_Nodes.value; } else { WX.Flow.Model.Process.MODEL proc = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + runmodel.StepNo.ToInt32()); runmodel.Next_Nodes.value = proc.Next_Nodes.value; } runmodel.StepNo.value = process.StepNo.value; } //2.取表单值 runmodel.LoadMyForm(false); WX.Flow.FormFieldCollection ffc = runmodel.MyForm.GetPostedDatas(); //3.上传附件并取得附件列表 string attach_nameList = String.Empty; string attache_idlist = String.Empty; string uploadUserId = WX.Main.CurUser.UserID; string uploadIp = WX.Main.getIp(this); HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; // 取文件后缀名 string oldFileName = System.IO.Path.GetFileName(hpf.FileName); string ext = System.IO.Path.GetExtension(hpf.FileName); string newFileName = DateTime.Now.ToString("yyyyMMddhhmmss fff") + ext; string newPath = String.Format("/UploadFiles/Run/{0}", newFileName); if (hpf.ContentLength > 0) { try { hpf.SaveAs(Server.MapPath(newPath)); //上传成功了 DateTime uploadTime = DateTime.Now; string cmdText = String.Format("INSERT INTO FL_RunAttachs (RunId,StepNo,NewFileName,OldFileName,UploadUserID,UploadTime,UploadIP)" + " VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}');SELECT @@IDENTITY as IdentityID;" , rRunId, rStepId, newPath, oldFileName, uploadUserId, DateTime.Now, uploadIp); int id = ULCode.QDA.XSql.GetData(cmdText).ToInt32(); if (attach_nameList.Length > 0) { attach_nameList = attach_nameList + ","; } attach_nameList = attach_nameList + oldFileName; if (attache_idlist.Length > 0) { attache_idlist = attache_idlist + ","; } attache_idlist = attache_idlist + id; } catch { ; } } } //WX.Flow.FormFieldCollection ffc = new WX.Flow.FormFieldCollection(); //foreach (WX.Flow.FormField ff in runmodel.MyForm.Items_FormFieldCollection) //{ // ff.Value = this.Request.Form[ff.Id] == null ? "" : this.Request.Form[ff.Id]; // ffc.Add(ff); //} // //4.取得手写与签章信息 int iR = runmodel.Save(rStepId, ffc, attache_idlist, attach_nameList, "", "", 0);//最后两个参数为会签意见和手写签章信息 runmodel.Update(); return(0);// iR; }
/// <summary> /// 保存表单及其它功能按钮 /// </summary> private int Save(int state) { WX.XZ.NotifyFiles.MODEL model = WX.Request.rNotifyFile; //1.获取模型 WX.Flow.Model.Run.MODEL runmodel = WX.Flow.Model.Run.GetModel("select * from FL_Run where Id=" + model.RunID.ToString()); int stepno = model.StepNo.ToInt32(); //2.取表单值 runmodel.LoadMyForm(false); WX.Flow.FormFieldCollection ffc = runmodel.MyForm.GetPostedDatas(); //3.上传附件并取得附件列表 string attach_nameList = String.Empty; string attache_idlist = String.Empty; string uploadUserId = WX.Main.CurUser.UserID; string uploadIp = WX.Main.getIp(this); HttpFileCollection hfc = Request.Files; //WX.Flow.FormFieldCollection ffc = new WX.Flow.FormFieldCollection(); //foreach (WX.Flow.FormField ff in runmodel.MyForm.Items_FormFieldCollection) //{ // ff.Value = this.Request.Form[ff.Id] == null ? "" : this.Request.Form[ff.Id]; // ffc.Add(ff); //} // //4.取得手写与签章信息 string sealData = this.txtSealData.Value; WX.Flow.Model.Process.MODEL proc; WX.Flow.Model.Process.MODEL process = null; int iR = 0; if (state == 2) { model.state.value = 2; model.StepNo.value = 1; model.StepName.value = "文件拟写"; proc = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + model.StepNo.ToInt32()); process = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + proc.Next_Nodes.ToInt32()); runmodel.StepNo.value = model.StepNo.value; runmodel.Next_Nodes.value = proc.Next_Nodes.value; WX.Main.AddLog(WX.LogType.Default, "文件通知审批未通过!", String.Format("{0}-{1}", model.ID.ToString(), model.Title.ToString())); //向拟写人发消息 WX.Main.MessageSend("<a href=/Manage/XZ/NotifyFiles.aspx?mes=1&NotifyFileId=" + model.ID.ToString() + ">你似写的文件《" + model.Title.ToString() + "》——审批未通过被退回</a>", "/Manage/Main/messagelist.aspx", model.UserID.ToString(), WX.Main.CurUser.UserID, 5, 0); } else { proc = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + model.StepNo.ToInt32()); if (proc != null && proc.Next_Nodes.ToString() != "" && proc.Next_Nodes.ToInt32() > 0) { process = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + proc.Next_Nodes.ToInt32()); } if (process == null) { runmodel.Deal_Flag.value = WX.Flow.DealFlag.HasOperated; model.state.value = 4; model.StepNo.value = 0; model.StepName.value = "行政发布"; //审批完成,向行政发消息发布文件 WX.Main.MessageSend("<a href=/Manage/XZ/NotifyFileDetail.aspx?NotifyFileId=" + model.ID.ToString() + ">文件《" + model.Title.ToString() + "》通过审批!请行政尽快发布</a>", "/Manage/Main/messagelist.aspx", WX.CommonUtils.GetCAUserID, WX.Main.CurUser.UserID, 5, 0); WX.Main.MessageSend("<a href=/Manage/XZ/NotifyFileDetail.aspx?NotifyFileId=" + model.ID.ToString() + ">文件《" + model.Title.ToString() + "》通过审批!请行政尽快发布</a>", "/Manage/Main/messagelist.aspx", WX.CommonUtils.GetAdminUserID, WX.Main.CurUser.UserID, 5, 0); } else { runmodel.Deal_Flag.value = 1; runmodel.StepNo.value = model.StepNo.value = process.StepNo.value; if (process.Next_Nodes.ToInt32() > 0) { runmodel.Next_Nodes.value = process.Next_Nodes.value; } else { runmodel.Next_Nodes.value = 0; } iR = 1; model.state.value = 3; model.StepName.value = process.Name.value; //向下一个人发消息,提醒审批 // WX.Main.MessageSend("<a href=/Manage/XZ/NotifyFileDetail.aspx?NotifyFileId=" + model.ID.ToString() + ">文件《" + model.Title.ToString() + "》通过审批!请行政尽快发布</a>", "/Manage/Main/messagelist.aspx", WX.CommonUtils.GetCAUserID, WX.Main.CurUser.UserID, 5, 0); WX.Model.User.MODEL squser = WX.Model.User.NewDataModel(model.UserID.ToString()); if (process.Auto_Type.ToString() == "1")//经办人为流程发起人的 { WX.Main.MessageSend("<a href=/Manage/XZ/NotifyFileDetail.aspx?NotifyFileId=" + model.ID.ToString() + ">" + squser.RealName.ToString() + "拟写的文件《" + model.Title.ToString() + "》!申请审批</a>", "/Manage/Main/messagelist.aspx", model.UserID.ToString(), WX.Main.CurUser.UserID, 5, 0); } else if (process.Auto_Type.ToString() == "2")//经办人为部门主管的 { WX.Main.MessageSend("<a href=/Manage/XZ/NotifyFileDetail.aspx?NotifyFileId=" + model.ID.ToString() + ">" + squser.RealName.ToString() + "拟写的文件《" + model.Title.ToString() + "》申请主管审批!</a>", "/Manage/Main/messagelist.aspx", WX.CommonUtils.GetDeptUserID(1, "[Host]", squser.DepartmentID.ToInt32()), WX.Main.CurUser.UserID, 5, 0); } else if (process.Auto_Type.ToString() == "4") { WX.Main.MessageSend("<a href=/Manage/XZ/NotifyFileDetail.aspx?NotifyFileId=" + model.ID.ToString() + ">" + squser.RealName.ToString() + "拟写的文件《" + model.Title.ToString() + "》申请上级审批!</a>", "/Manage/Main/messagelist.aspx", WX.CommonUtils.GetParentDeptHost(squser.DepartmentID.ToInt32(), "Host"), WX.Main.CurUser.UserID, 5, 0); } else if (process.Auto_Type.ToString() == "5") { WX.Main.MessageSend("<a href=/Manage/XZ/NotifyFileDetail.aspx?NotifyFileId=" + model.ID.ToString() + ">" + squser.RealName.ToString() + "拟写的文件《" + model.Title.ToString() + "》申请分管领导审批!</a>", "/Manage/Main/messagelist.aspx", WX.CommonUtils.GetParentDeptHost(squser.DepartmentID.ToInt32(), "SubHosts"), WX.Main.CurUser.UserID, 5, 0); } else { System.Data.DataTable dt = ULCode.QDA.XSql.GetDataTable("select UserID from Tu_Users where 1=1" + (process.Priv_UserList.ToString() != "" ? " and UserID in('" + process.Priv_UserList.ToString().Replace(",", "','") + "')" : "") + (process.Priv_DutyList.ToString() != "" ? " and DutyId in(select ID from TE_DutyDetail where DutyID in(" + process.Priv_DutyList.ToString() + "))" : "") + (process.Priv_DeptList.ToString() != "" ? " and Priv_DeptList in(" + process.Priv_DeptList.ToString() + ")" : "")); for (int i = 0; i < dt.Rows.Count; i++) { WX.Main.MessageSend("<a href=/Manage/XZ/NotifyFileDetail.aspx?NotifyFileId=" + model.ID.ToString() + ">" + squser.RealName.ToString() + "拟写的文件《" + model.Title.ToString() + "》!申请审批</a>", "/Manage/Main/messagelist.aspx", dt.Rows[i][0].ToString(), WX.Main.CurUser.UserID, 5, 0); } } } WX.Main.AddLog(WX.LogType.Default, "文件通知审批通过!", String.Format("{0}-{1}", model.ID.ToString(), model.Title.ToString())); } model.PublishTime.value = DateTime.Now; model.Update(); runmodel.Save(stepno, ffc, attache_idlist, attach_nameList, this.txt_sign.Text, sealData, 1); pageinit(); return(iR); }
/// <summary> /// 保存表单及其它功能按钮 /// </summary> private int Save() { //1.获取模型 WX.Flow.Model.Run.MODEL runmodel = WX.Flow.Model.Run.GetModel("select * from FL_Run where Id=" + this.rRunId); //2.取表单值 runmodel.LoadMyForm(false); WX.Flow.FormFieldCollection ffc = runmodel.MyForm.GetPostedDatas(); //3.上传附件并取得附件列表 string attach_nameList = String.Empty; string attache_idlist = String.Empty; string uploadUserId = WX.Main.CurUser.UserID; string uploadIp = WX.Main.getIp(this); HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; // 取文件后缀名 string oldFileName = System.IO.Path.GetFileName(hpf.FileName); string ext = System.IO.Path.GetExtension(hpf.FileName); string newFileName = DateTime.Now.ToString("yyyyMMddhhmmss fff") + ext; string newPath = String.Format("/UploadFiles/Run/{0}", newFileName); if (hpf.ContentLength > 0) { try { hpf.SaveAs(Server.MapPath(newPath)); //上传成功了 DateTime uploadTime = DateTime.Now; string cmdText = String.Format("INSERT INTO FL_RunAttachs (RunId,StepNo,NewFileName,OldFileName,UploadUserID,UploadTime,UploadIP)" + " VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}');SELECT @@IDENTITY as IdentityID;" , rRunId, runmodel.StepNo.ToString(), newPath, oldFileName, uploadUserId, DateTime.Now, uploadIp); int id = ULCode.QDA.XSql.GetData(cmdText).ToInt32(); if (attach_nameList.Length > 0) { attach_nameList = attach_nameList + ","; } attach_nameList = attach_nameList + oldFileName; if (attache_idlist.Length > 0) { attache_idlist = attache_idlist + ","; } attache_idlist = attache_idlist + id; } catch { ; } } } //WX.Flow.FormFieldCollection ffc = new WX.Flow.FormFieldCollection(); //foreach (WX.Flow.FormField ff in runmodel.MyForm.Items_FormFieldCollection) //{ // ff.Value = this.Request.Form[ff.Id] == null ? "" : this.Request.Form[ff.Id]; // ffc.Add(ff); //} // //4.取得手写与签章信息 string sealData = this.txtSealData.Value; WX.Flow.Model.Process.MODEL proc = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + runmodel.StepNo.ToInt32()); WX.Flow.Model.Process.MODEL process = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + (runmodel.StepNo.ToInt32() + 1)); if (process == null) { runmodel.Deal_Flag.value = WX.Flow.DealFlag.HasOperated; } else { runmodel.Deal_Flag.value = 1; runmodel.StepNo.value = runmodel.StepNo.ToInt32() + 1; if (process.Next_Nodes.ToString() != "") { runmodel.Next_Nodes.value = process.Next_Nodes.value; } if (proc.Next_Nodes.ToString() == "") { WX.Flow.Model.Process.MODEL proc2 = WX.Flow.Model.Process.GetModel("select * from FL_Process where FlowID=" + runmodel.FlowId.ToString() + " and StepNo=" + (runmodel.Next_Nodes.ToInt32() + 1)); if (proc2 == null) { runmodel.Deal_Flag.value = WX.Flow.DealFlag.HasOperated; } } } int iR = runmodel.Save(proc.Next_Nodes.ToString() == "" ? runmodel.Next_Nodes.ToInt32() : proc.StepNo.ToInt32(), ffc, attache_idlist, attach_nameList, this.FORM_CONTENT.Text, sealData, 1); if (process != null) { WX.Model.User.MODEL squser = WX.Model.User.NewDataModel(runmodel.BeginUser.ToString()); if (process.Auto_Type.ToString() == "1")//经办人为流程发起人的 { WX.Main.MessageSend("<a href=/Manage/Work/Work_MyCheck.aspx?flag=0&mes=1>" + runmodel.Name.ToString() + "(" + WX.CommonUtils.GetRealNameListByUserIdList(runmodel.BeginUser.ToString()) + ")——请尽快审批!</a>", "/Manage/Main/messagelist.aspx", runmodel.BeginUser.ToString(), WX.Main.CurUser.UserID, 12, 0); } else if (process.Auto_Type.ToString() == "2")//经办人为部门主管的 { WX.Main.MessageSend("<a href=/Manage/Work/Work_MyCheck.aspx?flag=0&mes=1>" + runmodel.Name.ToString() + "(" + WX.CommonUtils.GetRealNameListByUserIdList(runmodel.BeginUser.ToString()) + ")——请尽快审批!</a>", "/Manage/Main/messagelist.aspx", WX.CommonUtils.GetDeptUserID(1, "[Host]", squser.DepartmentID.ToInt32()), WX.Main.CurUser.UserID, 12, 0); } else if (process.Auto_Type.ToString() == "4") { WX.Main.MessageSend("<a href=/Manage/Work/Work_MyCheck.aspx?flag=0&mes=1>" + runmodel.Name.ToString() + "(" + WX.CommonUtils.GetRealNameListByUserIdList(runmodel.BeginUser.ToString()) + ")——请尽快审批!</a>", "/Manage/Main/messagelist.aspx", WX.CommonUtils.GetParentDeptHost(squser.DepartmentID.ToInt32(), "Host"), WX.Main.CurUser.UserID, 12, 0); } else if (process.Auto_Type.ToString() == "5") { WX.Main.MessageSend("<a href=/Manage/Work/Work_MyCheck.aspx?flag=0&mes=1>" + runmodel.Name.ToString() + "(" + WX.CommonUtils.GetRealNameListByUserIdList(runmodel.BeginUser.ToString()) + ")——请尽快审批!</a>", "/Manage/Main/messagelist.aspx", WX.CommonUtils.GetParentDeptHost(squser.DepartmentID.ToInt32(), "SubHosts"), WX.Main.CurUser.UserID, 12, 0); } else { System.Data.DataTable dt = ULCode.QDA.XSql.GetDataTable("select UserID from Tu_Users where 1=1" + (process.Priv_UserList.ToString() != "" ? " and UserID in('" + process.Priv_UserList.ToString().Replace(",", "','") + "')" : "") + (process.Priv_DutyList.ToString() != "" ? " and DutyId in(select ID from TE_DutyDetail where DutyID in(" + process.Priv_DutyList.ToString() + "))" : "") + (process.Priv_DeptList.ToString() != "" ? " and Priv_DeptList in(" + process.Priv_DeptList.ToString() + ")" : "")); for (int i = 0; i < dt.Rows.Count; i++) { WX.Main.MessageSend("<a href=/Manage/Work/Work_MyCheck.aspx?flag=0&mes=1>" + runmodel.Name.ToString() + "(" + WX.CommonUtils.GetRealNameListByUserIdList(runmodel.BeginUser.ToString()) + ")——请尽快审批!</a>", "/Manage/Main/messagelist.aspx", dt.Rows[i][0].ToString(), WX.Main.CurUser.UserID, 12, 0); } } } return(iR); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["TrainID"] != null && Request["TrainID"] != "") { WX.XZ.Train.MODEL trainmodel = WX.XZ.Train.NewDataModel(Request["TrainID"]); li_title.Text = trainmodel.Title.ToString(); drop_type.SelectedValue = trainmodel.Type.ToString(); li_addr.Text = trainmodel.Addr.ToString(); li_runtime.Text = trainmodel.RunTime.ToString(); li_usersname.Text = trainmodel.UsersName.ToString(); li_content.Text = trainmodel.Content.ToString(); string userid = WX.Main.CurUser.UserID; if (Request["UserID"] != null && Request["UserID"] != "") { userid = Request["UserID"]; } WX.XZ.TrainUsers.MODEL tusermodel = WX.XZ.TrainUsers.GetModelToTrainID(trainmodel.ID.ToInt32(), userid); if (tusermodel != null) { if (tusermodel.RunID.ToString() != "") { WX.Flow.Model.Run.MODEL runmodel = WX.Flow.Model.Run.GetModel("select * from FL_Run where Id=" + tusermodel.RunID.ToString()); //2.装载Form表单 runmodel.LoadMyForm(false); li_formcontent.Text = runmodel.GenerateHtmls(runmodel.Id.ToInt32()); } else if (trainmodel.FlowID.ToString() != "") { WX.Flow.Model.Flow.MODEL flow = WX.Flow.Model.Flow.GetCache(trainmodel.FlowID.ToInt32()); WX.Flow.Model.Form.MODEL formmodel = WX.Flow.Model.Form.NewDataModel(flow.FormId); WX.Flow.FormFieldCollection ffedit = new WX.Flow.FormFieldCollection(); WX.Flow.FormFieldCollection ffhidden = new WX.Flow.FormFieldCollection(); li_formcontent.Text = formmodel.GenerateHtmls(formmodel.Items_FormFieldCollection, ffedit, ffhidden, WX.Main.CurUser.UserID).Replace("-SYS_IP-", getIp()); if (Request["UserID"] == null || Request["UserID"].ToString() == "") { Button1.Visible = true; if (tusermodel.State.ToInt32() == 0) { tusermodel.State.value = 1; tusermodel.Update(); } } } if (Request["UserID"] == null || Request["UserID"].ToString() == "") { try { WX.Main.MessageToHistory_where(String.Format("SendToUserId='{0}' and RedirectToUrl like'%?TrainID={1}%'", WX.Main.CurUser.UserID, Request["TrainID"])); } catch { } } if (li_formcontent.Text != "") { Literal1.Text = "学习心得"; } } } } }