WorkEdit.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:14k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections.Generic;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- public partial class Work_WorkEdit : System.Web.UI.Page
- {
- /// <summary>
- /// 流程模板
- /// </summary>
- Model.FlowBase MF = new Model.FlowBase();
- /// <summary>
- /// 流程业务
- /// </summary>
- BLL.FlowBase BF = new BLL.FlowBase();
- /// <summary>
- /// 基本步骤模型
- /// </summary>
- Model.FlowBaseStep MR = new Model.FlowBaseStep();
- /// <summary>
- /// 基本步骤业务
- /// </summary>
- BLL.FlowBaseStep BR = new BLL.FlowBaseStep();
- /// <summary>
- /// 基本表单模板
- /// </summary>
- Model.FlowBaseFormContent MFBFC = new Model.FlowBaseFormContent();
- /// <summary>
- /// 基本表单业务
- /// </summary>
- BLL.FlowBaseFormContent BFBFC = new BLL.FlowBaseFormContent();
- /// <summary>
- /// 运行中的工作流模板
- /// </summary>
- Model.FlowRun MoFR = new Model.FlowRun();
- /// <summary>
- /// 运行中的工作流业务
- /// </summary>
- BLL.FlowRun BlFR = new BLL.FlowRun();
- /// <summary>
- /// 会签模板
- /// </summary>
- Model.FlowRunMark MFRMK = new Model.FlowRunMark();
- /// <summary>
- /// 会签业务
- /// </summary>
- BLL.FlowRunMark BFRMK = new BLL.FlowRunMark();
- /// <summary>
- /// 表单被选项
- /// </summary>
- public string BiaoDanSelect
- {
- get { return ViewState["LiuChengBiaoDanSelect"].ToString(); }
- set { ViewState["LiuChengBiaoDanSelect"] = value; }
-
- }
- /// <summary>
- /// 被选步骤项
- /// </summary>
- public string StepID
- {
- get { return ViewState["LiuChengStepID"].ToString(); }
- set { ViewState["LiuChengStepID"] = value; }
- }
- /// <summary>
- /// 流程ID
- /// </summary>
- public string LiuChengID
- {
- get { return ViewState["LiuChengID"].ToString(); }
- set { ViewState["LiuChengID"] = value; }
- }
- /// <summary>
- /// 运行ID
- /// </summary>
- public string RunID
- {
- get { return ViewState["RunID"].ToString(); }
- set { ViewState["RunID"] = value; }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "Work_WorkEdit");
- if (!IsPostBack)
- {
- DropLoadSet();
- MyDataBind();
- //传过来的ID为流程
- if (Request.QueryString["id"] != null)
- {
- RunID = Request.QueryString["id"].ToString();
- //获取本运行工作流
- MoFR = BlFR.GetModel(int.Parse(RunID));
-
- //流程ID
- int BfInt = MoFR.LCID;
- LiuChengID = BfInt.ToString();
- MF = BF.GetModel(BfInt);//工作流
- BiaoDanSelect = MF.BDID.ToString();//表单ID
- #region 获取其步骤
- MR = BR.GetPageList(1, 1, "BZSXH", true, "LCID=" + BfInt.ToString() + " and BZSXH=" + MoFR.BZID)[0];//BZSXH步骤顺序号,新建,所以第一步为1
- #endregion
- KeyValue_LCMC.Text = MF.LCMC;//流程名称
- StepID=MR.ID.ToString();//步骤ID号
- KeyValue_BZMC.Text = MR.BZMC;//步骤名称
- KeyValue_BDID.SelectedValue =BiaoDanSelect= MR.BDID.ToString();//表单被选项
- KeyValue_BZSXH.Text = MR.BZSXH.ToString();//步骤顺序号
- KeyValue_XYBID.Items.Clear();
- string XYBXHStr = MR.XYBXH;//下一步顺序列表
- string[] LIS = XYBXHStr.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
- if (LIS[0] != "0")//如果不为结束步骤则提取监督人
- {
- foreach (string LI in LIS)
- {
- ListItem MyItem = new ListItem();
- MyItem.Text = GetBZMC(LI, BfInt.ToString());
- MyItem.Value = LI;
- KeyValue_XYBID.Items.Add(MyItem);
- }
- GetYQLSCCBZRY(KeyValue_XYBID.Items[0].Value, BfInt.ToString());//下一步可以监督的人
- }
- else
- {
- KeyValue_XYBID.Items.Add("流程结束");
- KeyValue_YQLSCCBZRY.Items.Add("无");
- KeyValue_XYBID.Text = "流程结束";
- KeyValue_YQLSCCBZRY.Text = "无";
- Button1.Text = "工作结束";
- }
-
- }
- }
- }
- /// <summary>
- /// 获取下一步步骤名称
- /// </summary>
- /// <param name="XYBXH">下一步序号</param>
- /// <param name="LCID">流程ID</param>
- public string GetBZMC(string XYBXH, string LCID)
- {
- string YQLSCCBZRYStr = "";
- KeyValue_YQLSCCBZRY.Items.Clear();
- Model.FlowBaseStep MyMR = new Model.FlowBaseStep();
- BLL.FlowBaseStep MyBR = new BLL.FlowBaseStep();
- MyMR = MyBR.GetPageList(1, 1, "BZSXH", true, "LCID=" + LCID.ToString() + " and BZSXH=" + XYBXH)[0];//BZSXH步骤顺序号,新建,所以第一步为1
- YQLSCCBZRYStr=MyMR.BZMC;//下一步顺序列表
- return YQLSCCBZRYStr;
-
- }
- /// <summary>
- /// 获取下一步监督执行人
- /// </summary>
- /// <param name="XYBXH">下一步序号</param>
- /// <param name="LCID">流程ID</param>
- public void GetYQLSCCBZRY(string XYBXH,string LCID)
- {
- KeyValue_YQLSCCBZRY.Items.Clear();
- Model.FlowBaseStep MyMR = new Model.FlowBaseStep();
- BLL.FlowBaseStep MyBR = new BLL.FlowBaseStep();
- MyMR = MyBR.GetPageList(1, 1, "BZSXH", true, "LCID=" + LCID.ToString() + " and BZSXH=" + XYBXH)[0];//BZSXH步骤顺序号,新建,所以第一步为1
- string YQLSCCBZRYStr = MyMR.YQLSCCBZRY;//下一步顺序列表
- string[] LIS = YQLSCCBZRYStr.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
- foreach (string LI in LIS)
- {
- KeyValue_YQLSCCBZRY.Items.Add(LI);
- }
- }
- public void DropLoadSet()
- {
- //流程分类
- KeyValue_LCFL.DataTextField = "FLMC";
- KeyValue_LCFL.DataValueField = "ID";
- KeyValue_LCFL.DataSource = EnumGet.FlowBaseTypeGetEnum();
- KeyValue_LCFL.DataBind();
- KeyValue_LCFL.SelectedIndex = KeyValue_LCFL.Items.Count - 1;
- //表单分类
- KeyValue_BDID.DataTextField = "BDMC";
- KeyValue_BDID.DataValueField = "ID";
- KeyValue_BDID.DataSource = EnumGet.FlowBaseFormGetEnum();
- KeyValue_BDID.DataBind();
- KeyValue_BDID.SelectedIndex = KeyValue_BDID.Items.Count - 1;
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
-
- try
- {
- //表单
- string FormStr= CONTENT.Value;
- //笔迹
- string PenStr=PenCONTENT.Value;
- //意见
- if (MyIdea.Text == "")
- {
- throw new Exception("我的意见不能为空!");
- }
- #region 流程运行表
- Model.FlowRun FLR = new Model.FlowRun();
- BLL.FlowRun BLR = new BLL.FlowRun();
- FLR = BLR.GetModel(int.Parse(RunID));
- //FLR.FQR = SessionInclude.SessionId;//(发起人)
- FLR.XBR = KeyValue_YQLSCCBZRY.Text;//(现办人)
- //FLR.JSR = "";//(结束人)
- // FLR.LCID =int.Parse(LiuChengID);//(现在已经办道的步骤ID)
- if (Button1.Text == "工作结束")
- {
- FLR.BZID = 0;
- }
- else
- {
- FLR.BZID = int.Parse(KeyValue_XYBID.SelectedValue);//就是顺序号
- }
- FLR.BDNR = FormStr;//表单内容
- //FLR.FQSJ = DateTime.Now;//发起时间
- FLR.ZHCZSJ = DateTime.Now;//最后操作时间
-
- if (Button1.Text == "工作结束")
- {
- FLR.YXZT = "结束";
- FLR.JSSJ = DateTime.Now;
- FLR.JSR = SessionInclude.SessionId;
- }
- //FLR.ID = int.Parse(RunID);
- BLR.Update(FLR);
- #endregion
- int YXID = int.Parse(RunID);//运行表的ID
-
- #region 意见会签表
- Model.FlowRunMark MFRM = new Model.FlowRunMark();
- BLL.FlowRunMark BFRM = new BLL.FlowRunMark();
- MFRM.YXID = YXID;//运行表的ID
- MFRM.BZID = int.Parse(StepID);//就是顺序号-步骤ID
- MFRM.LCID = FLR.LCID;//流程ID
- MFRM.QSYJR = SessionInclude.SessionId;//签署意见人
- MFRM.QSYJ = MyIdea.Text;//签署意见
- MFRM.BJ = PenStr;//笔迹)
- //上传附件
- MFRM.FJDZ = UPdateFile();
- BFRM.Add(MFRM);
- #endregion
- if (Button1.Text == "工作结束")
- {
- MessageBox.Show("工作结束!", "WorkList.aspx");
- #region 消息发送
- SMSSend.Send(SessionInclude.SessionId, FLR.FQR, "您有工作已经结束,请查看!", "Work/WorkView.aspx?id=" + YXID.ToString(), SMSType.普通发送);
- if (CheckBox_Tel.Checked)
- {
- SMSSend.Send(SessionInclude.SessionId, KeyValue_YQLSCCBZRY.Text, "您有工作已经结束,请查看!", "Work/WorkEdit.aspx?id=" + YXID.ToString(), SMSType.短信发送);
- }
- #endregion
- }
- else
- {
- MessageBox.Show("转交成功!", "WorkList.aspx");
- #region 消息发送
- SMSSend.Send(SessionInclude.SessionId, KeyValue_YQLSCCBZRY.Text, "有工作需要您办理!", "Work/WorkEdit.aspx?id=" + YXID.ToString(), SMSType.普通发送);
- if (CheckBox_Tel.Checked)
- {
- SMSSend.Send(SessionInclude.SessionId, KeyValue_YQLSCCBZRY.Text, "有工作需要您办理!", "Work/WorkEdit.aspx?id=" + YXID.ToString(), SMSType.短信发送);
- }
- #endregion
- }
- }
- catch(Exception exp)
- {
- MessageBox.Show(exp.Message);
- }
- }
- /// <summary>
- /// 上传一个文件
- /// </summary>
- /// <returns></returns>
- public string UPdateFile()
- {
- if (!string.IsNullOrEmpty(this.KeyValue_FJPath.PostedFile.FileName))
- {
- string fulname = this.KeyValue_FJPath.PostedFile.FileName;
- string filename = fulname.Substring(fulname.LastIndexOf("\") + 1);
- string type = fulname.Substring(fulname.LastIndexOf(".") + 1);
- if (type == "aspx" || type == "asp" || type == "exe")
- {
- throw new Exception("不允许上传执行性文件");
- }
- string GuidStr = Guid.NewGuid().ToString() + "-" + filename;
- string FileUpdatePathFull = AppDomain.CurrentDomain.BaseDirectory + "Work\UpLoadFiles\" + GuidStr;
- this.KeyValue_FJPath.PostedFile.SaveAs(FileUpdatePathFull);
- return GuidStr;
- }
- else
- {
- return "";
- }
- }
- protected void KeyValue_XYBID_SelectedIndexChanged(object sender, EventArgs e)
- {
- GetYQLSCCBZRY(KeyValue_XYBID.SelectedValue, LiuChengID);//下一步可以监督的人
- }
- /// <summary>
- /// 获取信息
- /// </summary>
- /// <param name="pidx">页号</param>
- public void MyDataBind()
- {
- string TiaoJian = "";
- if (Request.QueryString["id"] != null)
- {
- TiaoJian = "YXID=" + Request.QueryString["id"].ToString();
- }
- int RecordCount = BFRMK.GetCount(TiaoJian);
- List<Model.FlowRunMark> LRData = BFRMK.GetPageList(RecordCount, 1, "ID", true, TiaoJian);
- if (LRData.Count == 0)
- {
- Model.FlowRunMark MR = new Model.FlowRunMark();
-
- LRData.Add(MR);
- }
- GridView1.DataSource = LRData;
- GridView1.DataBind();
- }
- /// <summary>
- /// 获取顺序号
- /// </summary>
- /// <returns></returns>
- public string ShunXuHao()
- {
- string RtStr = "";
- int Bzid = int.Parse(Eval("BZID").ToString());
- Model.FlowBaseStep MFBS = new BLL.FlowBaseStep().GetModel(Bzid);
- RtStr = MFBS.BZSXH.ToString();
- return RtStr ;
- }
- /// <summary>
- /// 获取顺序号
- /// </summary>
- /// <returns></returns>
- public string MingCheng()
- {
- string RtStr = "";
- int Bzid = int.Parse(Eval("BZID").ToString());
- Model.FlowBaseStep MFBS = new BLL.FlowBaseStep().GetModel(Bzid);
- RtStr = MFBS.BZMC.ToString();
- return RtStr;
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- for (int i = 0; i < GridView1.Rows.Count; i++)
- {
- //首先判断是否是数据行
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- //当鼠标停留时更改背景色
- e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
- //当鼠标移开时还原背景色
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
- }
- }
- }
- }