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

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. /// EditJump 的摘要说明。
  17. /// </summary>
  18. public class EditJump : System.Web.UI.Page
  19. {
  20. protected System.Web.UI.WebControls.Button cmdInsert;
  21. protected System.Web.UI.WebControls.TextBox txtContant;
  22. protected System.Web.UI.WebControls.DropDownList ddCompare;
  23. protected System.Web.UI.WebControls.DropDownList ddFieldName;
  24. protected System.Web.UI.WebControls.DropDownList ddStep;
  25. public int FlowID;
  26. protected System.Web.UI.WebControls.DataGrid dgJumpList;
  27. protected System.Web.UI.WebControls.Button cmdReturn;
  28. protected System.Web.UI.WebControls.Label labTitle;
  29. protected System.Web.UI.WebControls.DropDownList ddlFlowRule;
  30. public int StepID;
  31. private void Page_Load(object sender, System.EventArgs e)
  32. {
  33. // 在此处放置用户代码以初始化页面
  34. FlowID = Request.QueryString["FlowID"]==""?0:Int32.Parse(Request.QueryString["FlowID"].ToString());
  35. StepID = Request.QueryString["StepID"]==""?0:Int32.Parse(Request.QueryString["StepID"].ToString());
  36. if(!Page.IsPostBack)
  37. {
  38. Bind();
  39. }
  40. }
  41. #region Web 窗体设计器生成的代码
  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.cmdInsert.Click += new System.EventHandler(this.cmdInsert_Click);
  57. this.cmdReturn.Click += new System.EventHandler(this.cmdReturn_Click);
  58. this.Load += new System.EventHandler(this.Page_Load);
  59. }
  60. #endregion
  61. private void Bind()
  62. {
  63. InitHeadLine();
  64. InitDataGrid();
  65. FillStep(ddStep,FlowID);
  66. FillFieldName(ddFieldName,FlowID);
  67. if(ddFieldName.Items.Count <1||ddStep.Items.Count <1)
  68. cmdInsert.Enabled = false;
  69. else
  70. cmdInsert.Enabled = true;
  71. }
  72. private void FillFieldName(DropDownList ddField,long iFlowID)
  73. {
  74. ddField.Items.Clear();
  75. SqlDataReader dr; //存放人物的数据
  76. Database mySQL = new Database();
  77. SqlParameter[] parameters = {
  78. mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,iFlowID)
  79. };
  80. mySQL.RunProc("sp_flow_getstyle_description",parameters,out dr);
  81. ddField.Items.Clear();
  82. while(dr.Read())
  83. {
  84. ddField.Items.Add(new ListItem(dr["Field_Description"].ToString(),dr["Field_Name"].ToString()));
  85. }
  86. dr.Close();
  87. dr = null;
  88. ddField.Items.Add(new ListItem("《职级》","caste"));
  89. }
  90. private void FillStep(DropDownList ddStep,long iFlowID)
  91. {
  92. SqlDataReader dr; //存放人物的数据
  93. Database mySQL = new Database();
  94. SqlParameter[] parameters = {
  95. mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,iFlowID),
  96. mySQL.MakeInParam("@StepID",SqlDbType.Int ,4,0)
  97. };
  98. mySQL.RunProc("sp_Flow_GetStep",parameters,out dr);
  99. ddStep.Items.Clear();
  100. while(dr.Read())
  101. {
  102. ddStep.Items.Add(new ListItem(dr["Step_name"].ToString(),dr["Step_id"].ToString()));
  103. }
  104. dr.Close();
  105. dr = null;
  106. ddStep.Items.Add(new ListItem("《结束文档》","0"));
  107. }
  108. public string GetTranslateFlowRule(string FlowRule)
  109. {
  110. switch(FlowRule)
  111. {
  112. case "0":
  113. return "按人员";
  114. case "1":
  115. return "按职位";
  116. case "2":
  117. return "按项目";
  118. default:
  119. return "无";
  120. }
  121. }
  122. private void InitHeadLine()
  123. {
  124. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  125. labTitle.Text = df.GetFlowTitle(FlowID) + "->" +  df.GetStepTitle(FlowID,StepID);
  126. df = null;
  127. }
  128. private void InitDataGrid()
  129. {
  130. SqlDataReader dr; //存放人物的数据
  131. Database mySQL = new Database();
  132. SqlParameter[] parameters = {
  133. mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,FlowID),
  134. mySQL.MakeInParam("@StepID",SqlDbType.Int ,4,StepID),
  135. mySQL.MakeInParam("@Priority",SqlDbType.Int ,4,0)
  136. };
  137. mySQL.RunProc("sp_Flow_GetJump",parameters,out dr);
  138. DataTable dt =Tools.ConvertDataReaderToDataTable(dr);
  139. dr.Close();
  140. dr = null;
  141. dgJumpList.DataSource = dt.DefaultView;
  142. dgJumpList.DataBind();
  143. }
  144. public string TranslateCompare(string strCompare)
  145. {
  146. string CompareChar="";
  147. switch(Int32.Parse(strCompare))
  148. {
  149. case 6:
  150. CompareChar = "<>";
  151. break;
  152. case 1:
  153. CompareChar = ">";
  154. break;
  155. case 2:
  156. CompareChar = "<";
  157. break;
  158. case 3:
  159. CompareChar = "=";
  160. break;
  161. case 4:
  162. CompareChar =">=";
  163. break;
  164. case 5:
  165. CompareChar = "<=";
  166. break;
  167. default:
  168. break;
  169. }
  170. return CompareChar;
  171. }
  172. #region 获取节点图标
  173. /// <summary>
  174. /// 获取节点图标
  175. /// </summary>
  176. private string GetIcon(int IcnoNO)
  177. {
  178. string rtnValue = "../../../DataImages/";
  179. switch (IcnoNO)
  180. {
  181. default: 
  182. rtnValue+= "red_ball.gif";
  183. break;
  184. }
  185. return rtnValue;
  186. }
  187. #endregion
  188. #region 翻页事件
  189. public void DataGrid_PageChanged(object sender,DataGridPageChangedEventArgs e)
  190. {
  191. dgJumpList.CurrentPageIndex = e.NewPageIndex;
  192. }
  193. #endregion
  194. private void cmdInsert_Click(object sender, System.EventArgs e)
  195. {
  196. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  197. df.AddJump(FlowID,StepID,ddFieldName.Items[ddFieldName.SelectedIndex].Value.ToString(),ddCompare.Items[ddCompare.SelectedIndex].Text ,Double.Parse(txtContant.Text),Int32.Parse(ddStep.Items[ddStep.SelectedIndex].Value),Int32.Parse(ddlFlowRule.SelectedItem.Value));
  198. df = null;
  199. Bind();
  200. }
  201. public void MyGrid_Delete(object sender,DataGridCommandEventArgs e)
  202. {
  203. string Priority = dgJumpList.DataKeys[e.Item.ItemIndex].ToString();
  204. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  205. df.DeleteJump(FlowID,StepID,Int32.Parse(Priority));
  206. df = null;
  207. Bind();
  208. }
  209. public void MyGrid_Move(object sender,DataGridCommandEventArgs e)
  210. {
  211. string Priority = dgJumpList.DataKeys[e.Item.ItemIndex].ToString();
  212. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  213. df.MoveUpJump(FlowID,StepID,Int32.Parse(Priority));
  214. df = null;
  215. Bind();
  216. }
  217. private void cmdReturn_Click(object sender, System.EventArgs e)
  218. {
  219. Server.Transfer("ManageFlow.aspx?FlowID=" + FlowID.ToString());
  220. }
  221. }
  222. }