EditFlow.aspx.cs
上传用户:xuming1973
上传日期:2014-02-27
资源大小:17511k
文件大小:5k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

C#

  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Web;
  7. using System.Web.SessionState;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.HtmlControls;
  11. using UDS.Components;
  12. using System.Data.SqlClient;
  13. namespace UDS.SubModule.UnitiveDocument.DocumentFlow
  14. {
  15. /// <summary>
  16. /// Flow 的摘要说明。
  17. /// </summary>
  18. public class Flow : System.Web.UI.Page
  19. {
  20. protected System.Web.UI.WebControls.TextBox txtFlowName;
  21. protected System.Web.UI.WebControls.TextBox txtFlowRemark;
  22. protected System.Web.UI.WebControls.Label Label1;
  23. protected System.Web.UI.WebControls.Label Label2;
  24. protected System.Web.UI.WebControls.Label Label3;
  25. protected System.Web.UI.WebControls.DropDownList dpStyle;
  26. protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
  27. protected System.Web.UI.WebControls.Button cmdNext;
  28. protected System.Web.UI.WebControls.Button cmdFinish;
  29. protected System.Web.UI.WebControls.Button cmdCancel;
  30. protected System.Web.UI.WebControls.Button cmdPrevious;
  31. private long FlowID;
  32. private void Page_Load(object sender, System.EventArgs e)
  33. {
  34. // 在此处放置用户代码以初始化页面
  35. FlowID = Request.QueryString["FlowID"]!=null?Int32.Parse(Request.QueryString["FlowID"].ToString()):0;
  36. if(!Page.IsPostBack)
  37. {
  38. Bangding();
  39. }
  40. }
  41. #region Web Form Designer generated code
  42. override protected void OnInit(EventArgs e)
  43. {
  44. //
  45. // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
  46. //
  47. InitializeComponent();
  48. base.OnInit(e);
  49. }
  50. /// <summary>
  51. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  52. /// 此方法的内容。
  53. /// </summary>
  54. private void InitializeComponent()
  55. {    
  56. this.cmdNext.Click += new System.EventHandler(this.cmdNext_Click);
  57. this.cmdFinish.Click += new System.EventHandler(this.cmdFinish_Click);
  58. this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
  59. this.Load += new System.EventHandler(this.Page_Load);
  60. }
  61. #endregion
  62. private void Bangding()
  63. {
  64. int StyleID=0;
  65. if(FlowID>0)
  66. {
  67. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  68. DataTable dt;
  69. df.GetFlow(FlowID,out dt);
  70. if(dt.Rows.Count >0)
  71. {
  72. txtFlowName.Text = dt.Rows[0]["Flow_Name"].ToString();
  73. txtFlowRemark.Text = dt.Rows[0]["Remark"].ToString();
  74. StyleID = Int32.Parse(dt.Rows[0]["Style_ID"].ToString());
  75. }
  76. }
  77. FillStyle(StyleID);
  78. }
  79. private void FillStyle(int StyleID)
  80. {
  81. Database mySQL = new Database();
  82. SqlDataReader dr;
  83. mySQL.RunProc("sp_Flow_GetStyle",out dr);
  84. dpStyle.Items.Clear();
  85. while(dr.Read())
  86. {
  87. dpStyle.Items.Add(new ListItem(dr["style_name"].ToString(),dr["style_id"].ToString()));
  88. if(dr["style_id"].ToString() == StyleID.ToString())
  89. dpStyle.SelectedIndex = dpStyle.Items.Count -1;
  90. }
  91. dr.Close();
  92. mySQL.Close();
  93. }
  94. private void cmdNext_Click(object sender, System.EventArgs e)
  95. {
  96. String UserName = Request.Cookies["UserName"].Value.ToString();
  97. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  98. if(FlowID<=0)
  99. {
  100. FlowID=df.AddFlow(txtFlowName.Text,txtFlowRemark.Text,UserName,Int32.Parse(dpStyle.Items[dpStyle.SelectedIndex].Value));
  101. if(FlowID>0)
  102. {
  103. Server.Transfer("EditTache.aspx?FlowID=" + FlowID.ToString() + "&StepID=1");
  104. }
  105. df = null;
  106. }
  107. else
  108. {
  109. if(df.UpdateFlow(FlowID,txtFlowName.Text,txtFlowRemark.Text,UserName,Int32.Parse(dpStyle.Items[dpStyle.SelectedIndex].Value))==0)
  110. {
  111. Server.Transfer("EditTache.aspx?FlowID=" + FlowID.ToString() + "&StepID=1");
  112. }
  113. df = null;
  114. }
  115. Server.Transfer("Listview.aspx");
  116. }
  117. private void cmdFinish_Click(object sender, System.EventArgs e)
  118. {
  119. String UserName = Request.Cookies["UserName"].Value.ToString();
  120. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  121. if(FlowID<=0)
  122. {
  123. FlowID=df.AddFlow(txtFlowName.Text,txtFlowRemark.Text,UserName,Int32.Parse(dpStyle.Items[dpStyle.SelectedIndex].Value));
  124. if(FlowID>0)
  125. {
  126. Server.Transfer("ManageFlow.aspx?FlowID=" + FlowID.ToString());
  127. }
  128. df = null;
  129. }
  130. else
  131. {
  132. if(df.UpdateFlow(FlowID,txtFlowName.Text,txtFlowRemark.Text,UserName,Int32.Parse(dpStyle.Items[dpStyle.SelectedIndex].Value))==0)
  133. {
  134. Server.Transfer("EditTache.aspx?FlowID=" + FlowID.ToString() + "&StepID=1");
  135. }
  136. df = null;
  137. Server.Transfer("ManageFlow.aspx?FlowID=" + FlowID.ToString());
  138. }
  139. }
  140. private void cmdCancel_Click(object sender, System.EventArgs e)
  141. {
  142. Server.Transfer("Listview.aspx");
  143. }
  144. }
  145. }