DisplayDocument.aspx.cs
上传用户:jdb8708888
上传日期:2013-05-29
资源大小:19971k
文件大小:23k
源码类别:

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. /// SignDocument 的摘要说明。
  17. /// </summary>
  18. public class SignDocument : System.Web.UI.Page
  19. {
  20. protected System.Web.UI.WebControls.Button cmdSignIn;
  21. protected System.Web.UI.WebControls.Table tabDispDocument;
  22. protected System.Web.UI.HtmlControls.HtmlForm PostilDocument;
  23. protected System.Web.UI.WebControls.Button cmdCancelSignIn;
  24. protected System.Web.UI.WebControls.Button cmdPostilFinish;
  25. protected System.Web.UI.WebControls.Button cmdPostilFaile;
  26. protected System.Web.UI.WebControls.Button cmdPostilNext;
  27. private int DisplayStatus;
  28. private string UserName;
  29. protected System.Web.UI.HtmlControls.HtmlTable tabReturn;
  30. private int ReturnPage;
  31. protected System.Web.UI.WebControls.Button cmdBack;
  32. protected System.Web.UI.WebControls.Button cmdReturn;
  33. private long DocID;
  34. private long ProjectID=-1;
  35. protected System.Web.UI.HtmlControls.HtmlInputHidden PID;
  36. protected System.Web.UI.HtmlControls.HtmlSelect ddlProject;
  37. private bool FlowState;
  38. private void Page_Load(object sender, System.EventArgs e)
  39. {
  40. // 在此处放置用户代码以初始化页面
  41. DocID = Int32.Parse(Request.QueryString["DocID"].ToString());
  42. UserName = Request.Cookies["UserName"].Value.ToString();
  43. ReturnPage = Request.QueryString["ReturnPage"]!=null?Int32.Parse(Request.QueryString["ReturnPage"].ToString()):1;
  44. InitControl();
  45. Bind();
  46. }
  47. private void InitControl()
  48. {
  49. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  50.  
  51. DisplayStatus = df.GetDocumentStatus(DocID,UserName);
  52. //移动表单的位置
  53. tabDispDocument.Style["Left"] = "0px";
  54. tabDispDocument.Style["Top"] = "0px";
  55. if(DisplayStatus==0) //签收状态
  56. {
  57. cmdSignIn.Visible = true;
  58. cmdCancelSignIn.Visible = false;
  59. cmdPostilNext.Visible = false;
  60. cmdPostilFaile.Visible = false;
  61. cmdPostilFinish.Visible = false;
  62. cmdBack.Visible = false;
  63. FlowState = false;
  64. }
  65. else if(DisplayStatus==1) //一般批阅状态
  66. {
  67. cmdSignIn.Visible = false;
  68. cmdCancelSignIn.Visible = true;
  69. cmdPostilNext.Visible = true;
  70. cmdPostilFaile.Visible = true;
  71. cmdPostilFinish.Visible = true;
  72. cmdBack.Visible = true;
  73. FlowState = true;
  74. }
  75. else if(DisplayStatus==2) //撤消状态,现在已经没有撤消状态了,只有文档是草稿才能删除
  76. {
  77. cmdSignIn.Visible = true;
  78. cmdCancelSignIn.Visible = false;
  79. cmdPostilNext.Visible = false;
  80. cmdPostilFaile.Visible = false;
  81. cmdPostilFinish.Visible = false;
  82. cmdBack.Visible = false;
  83. FlowState = false;
  84. }
  85. else if(DisplayStatus==4) //会签状态批阅
  86. {
  87. cmdSignIn.Visible = false;
  88. cmdCancelSignIn.Visible = true;
  89. cmdPostilNext.Visible = true;
  90. cmdPostilFaile.Visible = true;
  91. cmdPostilFinish.Visible = false;
  92. cmdBack.Visible = true;
  93. FlowState = true;
  94. }
  95. else //查看状态
  96. {
  97. cmdSignIn.Visible = false;
  98. cmdCancelSignIn.Visible = false;
  99. cmdPostilNext.Visible = false;
  100. cmdPostilFaile.Visible = false;
  101. cmdPostilFinish.Visible = false;
  102. cmdBack.Visible = false;
  103. FlowState = false;
  104. }
  105. df = null;
  106. tabDispDocument.Style.Add("BORDER-COLLAPSE","collapse");
  107. }
  108. private void Bind()
  109. {
  110. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  111. Database mySQL = new Database();
  112. long FlowID;
  113. long StepID;
  114. DataTable dt;
  115. FlowID = df.GetDocumentFlowID(DocID);
  116. StepID = df.GetDocumentStepID(DocID);
  117. cmdPostilFinish.Visible  =cmdPostilFinish.Visible&&df.GetStepRightToFinish(FlowID,StepID) == 1?true:false;
  118. ProjectID = Int32.Parse(PID.Value);
  119. //流程批阅状态并且按照项目流转
  120. if(FlowState==true&&df.IsProject(UserName,DocID))
  121. {
  122. if(!Page.IsPostBack)
  123. {
  124. ddlProject.Visible = true;
  125. ddlProject.Items.Clear();
  126. df.GetProject(UserName,out dt);
  127. ddlProject.DataSource = dt.DefaultView;
  128. ddlProject.DataTextField = "ClassName";
  129. ddlProject.DataValueField = "ClassID";
  130. ddlProject.DataBind();
  131. if(ddlProject.Items.Count>0)
  132. {
  133. PID.Value = ddlProject.Items[0].Value; 
  134. }
  135. else
  136. PID.Value = "-1";
  137. }
  138. }
  139. else
  140. {
  141. ddlProject.Visible = false;
  142. }
  143. df.GetDocumentInfo(DocID,out dt);
  144. AddRow(tabDispDocument,"基本信息");
  145. AddRow(tabDispDocument,"流程:",dt.Rows[0]["flow_name"].ToString());
  146. AddRow(tabDispDocument,"发送者:",dt.Rows[0]["realname"].ToString());
  147. AddRow(tabDispDocument,"发送日期:",dt.Rows[0]["doc_added_date"].ToString());
  148. AddRow(tabDispDocument,"当前步骤:","<a href='DisplayTacheMember.aspx?DocID=" + DocID.ToString() + "&ReturnPage=" + ReturnPage.ToString() + "'>" + dt.Rows[0]["Step_name"].ToString() + "</a>");
  149. AddRow(tabDispDocument,"详细表单");
  150. if(dt.Rows.Count >0)
  151. {
  152. FlowID = Int32.Parse(dt.Rows[0]["flow_id"].ToString());
  153. HtmlForm PostilDocument   = (HtmlForm)this.Page.FindControl("PostilDocument");
  154. //=============================//
  155. // 添加正文
  156. //=============================//
  157. DataTable dtSheet;
  158. df.GetStyleDescription(FlowID,0,out dtSheet);
  159. for(int i =0;i<dtSheet.Rows.Count;i++)
  160. {
  161. AddRow(tabDispDocument,dtSheet.Rows[i]["Field_Description"].ToString() + ":",dt.Rows[0][dtSheet.Rows[i]["Field_Name"].ToString()].ToString());
  162. }
  163. dtSheet = null;
  164. //=============================//
  165. // 添加附件
  166. //=============================//
  167. AddAttach(DocID);
  168. //=============================//
  169. // 添加批注
  170. //=============================//
  171. DataTable dtPostil;
  172. df.GetDocumentPostil(DocID,out dtPostil); 
  173. if(dtPostil.Rows.Count>0)
  174. {
  175. AddRow(tabDispDocument,"审批意见");
  176. AddPostitleHead(tabDispDocument);
  177. for(int i=0;i<dtPostil.Rows.Count;i++)
  178. {
  179. AddRow(tabDispDocument,dtPostil.Rows[i]["RealName"].ToString(),dtPostil.Rows[i]["Postil_Date"].ToString(),dtPostil.Rows[i]["Postil_Content"].ToString(),Int32.Parse(dtPostil.Rows[i]["Postil_Type"].ToString() ),dtPostil.Rows[i]["FileName"].ToString(),dtPostil.Rows[i]["FileVisualPath"].ToString(),dtPostil.Rows[i]["usedtime"].ToString());
  180. }
  181. }
  182. dtPostil = null;
  183. AddProjectControl();
  184. AddControl(tabDispDocument);
  185. }
  186. }
  187. private void AddAttachControl()
  188. {
  189. string Template;
  190. long FlowID;
  191. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  192. FlowID = df.GetDocumentFlowID(DocID);
  193. Template = df.GetStyleTemplate(FlowID);
  194. if(Template!="")
  195. {
  196. TableRow  tr = new TableRow();
  197. TableCell td = new TableCell();
  198. TableCell tc = new TableCell();
  199. Literal   lt = new Literal();
  200. lt.Text  = "<a href='" + Template + "' style='text-decoration: underline' titile='模板下载' target='_blank'>模板</a>:";
  201. tc.HorizontalAlign = HorizontalAlign.Right;
  202. tc.Width = Unit.Percentage(20);
  203. tc.Controls.Add(lt);
  204. td.HorizontalAlign = HorizontalAlign.Left;
  205. td.ColumnSpan = 5;
  206. System.Web.UI.HtmlControls.HtmlInputFile hif = new System.Web.UI.HtmlControls.HtmlInputFile();
  207. hif.ID = "fileTemplate";
  208. hif.Name = "fileTemplate";
  209. hif.Style["width"] = Unit.Percentage(70).ToString();
  210. hif.Style["Class"] = "Input3";
  211. td.Controls.Add(hif);
  212. tr.Cells.Add(tc);
  213. tr.Cells.Add(td);
  214. tabDispDocument.Rows.Add(tr);
  215. td = null;
  216. tr = null;
  217. }
  218. df = null;
  219. }
  220. private void AddAttach(long DocID)
  221. {
  222. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  223. DataTable dt = new DataTable();
  224. df.GetDocumentAttach(DocID,out dt);
  225. for(int i=0;i<dt.Rows.Count;i++)
  226. {
  227. TableRow  tr = new TableRow();
  228. TableCell td = new TableCell();
  229. TableCell tc = new TableCell();
  230. td.Text ="附件:";
  231. td.HorizontalAlign = HorizontalAlign.Right;
  232. string FilePath = dt.Rows[i]["FileVisualPath"].ToString() + dt.Rows[i]["FileName"].ToString();
  233. tc.Text = "<a href='" +"." + FilePath.Replace("\","/") +"' target='_blank'>" + dt.Rows[i]["FileName"].ToString() + "</a>";
  234. tc.HorizontalAlign = HorizontalAlign.Left;
  235. tc.ColumnSpan = 5;
  236. tr.Cells.Add(td);
  237. tr.Cells.Add(tc);
  238. tr.Height = 22;
  239. tr.HorizontalAlign = HorizontalAlign.Center;
  240. tabDispDocument.Rows.Add(tr);
  241. }
  242. dt = null;
  243. df = null;
  244. }
  245. private void AddProjectControl()
  246. {
  247. if(ddlProject.Visible == true)
  248. {
  249. TableRow  tr = new TableRow();
  250. TableCell td = new TableCell();
  251. TableCell tl = new TableCell();
  252. td.Text = "请选择所属项目:";
  253. td.HorizontalAlign = HorizontalAlign.Right;
  254. td.ColumnSpan = 5;
  255. td.Width = Unit.Percentage(20);
  256. td.BackColor = Color.FromArgb(0xe8,0xf4,0xff);
  257. tr.Cells.Add(td);
  258. ddlProject.Style["Width"] = "100%";
  259. ddlProject.Style["Class"] = "Input3";
  260. tr.EnableViewState = true;
  261. tl.Width = Unit.Percentage(80);
  262. tl.Controls.Add(ddlProject);
  263. tr.Cells.Add(tl);
  264. tabDispDocument.Rows.Add(tr);
  265. td = null;
  266. tr = null;
  267. }
  268. }
  269. private void AddRow(Table tab,string Caption,string Content)
  270. {
  271. TableRow tr = new TableRow();
  272. TableCell tl = new TableCell();
  273. TableCell tc = new TableCell();
  274. //标题栏目
  275. tl.Text = Caption; 
  276. tl.Width = Unit.Percentage(20);
  277. tl.HorizontalAlign = HorizontalAlign.Right;
  278. tl.BackColor = Color.FromArgb(0xe8,0xf4,0xff);
  279. //内容正文
  280. tc.Text = Content;
  281. tc.Width = Unit.Percentage(80);
  282. tc.ColumnSpan = 5;
  283. tr.Height = 22;
  284. tr.Cells.Add(tl);
  285. tr.Cells.Add(tc);
  286. tab.Rows.Add(tr);
  287. tc = null;
  288. tl = null;
  289. tr = null;
  290. }
  291. private void AddRow(Table tab,string Caption)
  292. {
  293. TableRow tr = new TableRow();
  294. TableCell tl = new TableCell();
  295. tl.Text = Caption;
  296. tl.ColumnSpan = 6 ;
  297. tl.Width = Unit.Percentage(100);
  298. tl.HorizontalAlign  = HorizontalAlign.Center;
  299. tl.Attributes["background"]="../../../Images/treetopbg.jpg";
  300. //tl.BackColor = Color.FromArgb(0xff,0xff,0xef);
  301. tr.Height = 28;
  302. tr.Cells.Add(tl);
  303. tab.Rows.Add(tr);
  304. tl = null;
  305. tr = null;
  306. }
  307. private void AddRow(Table tab,string Postiler,string PostilTime,string PostilContent,int PostilType,string FileName,string FileVisualPath,string UsedTime)
  308. {
  309. TableRow tr = new TableRow();
  310. TableCell tdPotiler = new TableCell();
  311. TableCell tdPostilTime = new TableCell();
  312. TableCell tdPotilType = new TableCell();
  313. TableCell tdPotilContent = new TableCell();
  314. TableCell tdAttachFiles = new TableCell();
  315. TableCell tdTime = new TableCell();
  316. tdPotiler.Text = Postiler;
  317. tdPotiler.HorizontalAlign = HorizontalAlign.Center;
  318. tdPotiler.Width = Unit.Percentage(20);
  319. tdPostilTime.Text = PostilTime;
  320. tdPostilTime.HorizontalAlign = HorizontalAlign.Center;
  321. tdPostilTime.Width = Unit.Percentage(20);
  322. switch(PostilType)
  323. {
  324. case 1:
  325. tdPotilType.Text = "同意";
  326. break;
  327. case 2:
  328. tdPotilType.Text = "拒绝";
  329. break;
  330. case 3:
  331. tdPotilType.Text = "完成";
  332. break;
  333. case 4:
  334. tdPotilType.Text = "回退";
  335. break;
  336. default:
  337. break;
  338. }
  339. tdPotilType.HorizontalAlign = HorizontalAlign.Center;
  340. tdPotilType.Width = Unit.Percentage(10);
  341. tdPotilContent.Text = PostilContent;
  342. tdPotilContent.HorizontalAlign = HorizontalAlign.Left;
  343. tdPotilContent.Width = Unit.Percentage(30);
  344. tr.Height  =22;
  345. //tr.BackColor = Color.FromArgb(0xe8,0xf4,0xff);
  346. string FilePath = FileVisualPath + FileName;
  347. tdAttachFiles.Text = "<a href='" +"." + FilePath.Replace("\","/") +"' target='_blank'>" + FileName + "</a>";
  348. tdAttachFiles.HorizontalAlign = HorizontalAlign.Center  ;
  349. tdAttachFiles.Width = Unit.Percentage(10);
  350. tdTime.Text = UsedTime;
  351. tdTime.HorizontalAlign = HorizontalAlign.Center  ;
  352. tdTime.Width = Unit.Percentage(10);
  353. tr.Cells.Add(tdPotiler);
  354. tr.Cells.Add(tdPostilTime);
  355. tr.Cells.Add(tdPotilType);
  356. tr.Cells.Add(tdPotilContent);
  357. tr.Cells.Add(tdAttachFiles);
  358. tr.Cells.Add(tdTime);
  359. tab.Rows.Add(tr);
  360. tdPotiler = null;
  361. tdPostilTime = null;
  362. tdPotilType = null;
  363. tdPotilContent = null;
  364. tdAttachFiles = null;
  365. tdTime = null;
  366. tr = null;
  367. }
  368. private void AddPostitleHead(Table tab)
  369. {
  370. TableRow tr = new TableRow();
  371. TableCell tdPotiler = new TableCell();
  372. TableCell tdPostilTime = new TableCell();
  373. TableCell tdPotilType = new TableCell();
  374. TableCell tdPotilContent = new TableCell();
  375. TableCell tdAttachFiles = new TableCell();
  376. TableCell tdTime = new TableCell();
  377. tdPotiler.Text ="批阅人";
  378. tdPotiler.HorizontalAlign = HorizontalAlign.Center;
  379. tdPotiler.Width = Unit.Percentage(20);
  380. tdPostilTime.Text ="批阅时间";
  381. tdPostilTime.HorizontalAlign = HorizontalAlign.Center;
  382. tdPostilTime.Width = Unit.Percentage(20);
  383. tdPotilType.Text ="批阅类型";
  384. tdPotilType.HorizontalAlign = HorizontalAlign.Center;
  385. tdPotilType.Width = Unit.Percentage(10);
  386. tdPotilContent.Text ="批阅内容";
  387. tdPotilContent.HorizontalAlign = HorizontalAlign.Left ;
  388. tdPotilContent.Width = Unit.Percentage(30);
  389. tdAttachFiles.Text ="附件";
  390. tdAttachFiles.HorizontalAlign = HorizontalAlign.Center  ;
  391. tdAttachFiles.Width = Unit.Percentage(10);
  392. tdTime.Text ="用时(分)";
  393. tdTime.HorizontalAlign = HorizontalAlign.Center  ;
  394. tdTime.Width = Unit.Percentage(10);
  395. tr.Height  =22;
  396. tr.BackColor = Color.FromArgb(0xe8,0xf4,0xff);
  397. tr.Cells.Add(tdPotiler);
  398. tr.Cells.Add(tdPostilTime);
  399. tr.Cells.Add(tdPotilType);
  400. tr.Cells.Add(tdPotilContent);
  401. tr.Cells.Add(tdAttachFiles);
  402. tr.Cells.Add(tdTime);
  403. tab.Rows.Add(tr);
  404. tdPotiler = null;
  405. tdPostilTime = null;
  406. tdPotilType = null;
  407. tdPotilContent = null;
  408. tr = null;
  409. }
  410. private void UploadFile(long PostilID)
  411. {
  412. string FileName = "";
  413. HtmlForm FrmCompose   = (HtmlForm)this.Page.FindControl("PostilDocument");
  414. //生成附件目录
  415. if(!System.IO.Directory.Exists(Server.MapPath(".")+"\AttachFiles"))
  416. {
  417. System.IO.Directory.CreateDirectory(Server.MapPath(".")+"\AttachFiles");
  418. }
  419. try
  420. {
  421. HtmlInputFile hif = ((HtmlInputFile)(FrmCompose.FindControl("fileTemplate")));
  422. if(hif.PostedFile!=null)
  423. {
  424. if(hif.PostedFile.FileName.Trim()!="")
  425. {
  426. FileName = System.IO.Path.GetFileName(hif.PostedFile.FileName);
  427. //生成用户目录
  428. if(!System.IO.Directory.Exists(Server.MapPath(".")+"\AttachFiles\" + UserName))
  429. {
  430. System.IO.Directory.CreateDirectory(Server.MapPath(".")+"\AttachFiles\"+ UserName);
  431. }
  432. Random TempNameInt    = new Random(); 
  433. string NewDocDirName  = TempNameInt.Next(100000000).ToString();
  434. //生成随机目录
  435. if(!System.IO.Directory.Exists(Server.MapPath(".")+"\AttachFiles\" + UserName + "\" + NewDocDirName))
  436. {
  437. System.IO.Directory.CreateDirectory(Server.MapPath(".")+"\AttachFiles\" + UserName  + "\" + NewDocDirName);
  438. }
  439. TempNameInt = null;
  440. //保存文件
  441. hif.PostedFile.SaveAs(Server.MapPath(".")+"\AttachFiles\" + UserName  + "\" + NewDocDirName + "\" + FileName);
  442. UDS.Components.DocAttachFile att = new UDS.Components.DocAttachFile();
  443. UDS.Components.DocumentFlow  df  = new UDS.Components.DocumentFlow();
  444. // 初始化
  445. att.FileAttribute = 0;
  446. att.FileSize = hif.PostedFile.ContentLength;
  447. att.FileName = FileName;
  448. att.FileAuthor = UserName;
  449. att.FileCatlog = "公文";
  450. att.FileVisualPath = "\AttachFiles\" + UserName  + "\" + NewDocDirName + "\";
  451. att.FileAddedDate = DateTime.Now.ToString();;
  452. df.AddPostilAttach(att,PostilID);
  453. df = null;
  454. att = null;
  455. }
  456. hif=null;
  457. }
  458. }
  459. catch(Exception ex)
  460. {
  461. UDS.Components.Error.Log(ex.ToString());
  462. }
  463. finally
  464. {
  465. }
  466. }
  467. private void AddControl(Table tab)
  468. {
  469. TableRow tr = new TableRow();
  470. TableCell td = new TableCell();
  471. td.Controls.Add(cmdSignIn);
  472. td.Controls.Add(cmdPostilNext);
  473. td.Controls.Add(cmdBack);
  474. td.Controls.Add(cmdPostilFaile);
  475. td.Controls.Add(cmdPostilFinish);
  476. td.Controls.Add(cmdCancelSignIn);
  477. td.Controls.Add(cmdReturn);
  478. //cmdReturn.Text ="<INPUT class='redButtonCss' style='WIDTH: 74px; HEIGHT: 20px' type='button' value='返回' onclick="location.href='listDocument.aspx?DisplayType=" + ReturnPage.ToString() + "'">";
  479. if(cmdPostilNext.Visible||cmdPostilFaile.Visible||cmdPostilFinish.Visible)
  480. {
  481. AddRow(tab,"审批意见");
  482. TableRow trc = new TableRow();
  483. TableCell tdc = new TableCell();
  484. TableCell tc = new TableCell();
  485. TextBox txtPostil = new TextBox();
  486. txtPostil.ID = "txtPostil";
  487. txtPostil.TextMode = TextBoxMode.MultiLine;
  488. txtPostil.Width = Unit.Percentage(70);
  489. txtPostil.Height = 100;
  490. tc.Text = "审批内容:";
  491. tc.HorizontalAlign = HorizontalAlign.Right;
  492. tc.VerticalAlign = VerticalAlign.Top;
  493. tc.Width = Unit.Percentage(20);
  494. tdc.ColumnSpan = 5;
  495. tdc.HorizontalAlign = HorizontalAlign.Left ;
  496. tdc.Controls.Add(txtPostil);
  497. trc.Cells.Add(tc);
  498. trc.Cells.Add(tdc);
  499. tab.Rows.Add(trc);
  500. trc = null;
  501. tdc = null;
  502. txtPostil = null;
  503. AddAttachControl();
  504. }
  505. td.ColumnSpan =6;
  506. tr.Height =22;
  507. tr.Cells.Add(td);
  508. tr.HorizontalAlign = HorizontalAlign.Center;
  509. tab.Rows.Add(tr);
  510. td = null;
  511. tr = null;
  512. }
  513. #region Web Form Designer generated code
  514. override protected void OnInit(EventArgs e)
  515. {
  516. //
  517. // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
  518. //
  519. InitializeComponent();
  520. base.OnInit(e);
  521. }
  522. /// <summary>
  523. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  524. /// 此方法的内容。
  525. /// </summary>
  526. private void InitializeComponent()
  527. {    
  528. this.cmdSignIn.Click += new System.EventHandler(this.cmdSignIn_Click);
  529. this.cmdBack.Click += new System.EventHandler(this.cmdBack_Click);
  530. this.cmdPostilNext.Click += new System.EventHandler(this.cmdPostilNext_Click);
  531. this.cmdPostilFaile.Click += new System.EventHandler(this.cmdPostilFaile_Click);
  532. this.cmdPostilFinish.Click += new System.EventHandler(this.cmdPostilFinish_Click);
  533. this.cmdCancelSignIn.Click += new System.EventHandler(this.cmdCancelSignIn_Click);
  534. this.cmdReturn.Click += new System.EventHandler(this.cmdReturn_Click);
  535. this.Load += new System.EventHandler(this.Page_Load);
  536. }
  537. #endregion
  538. private void cmdSignIn_Click(object sender, System.EventArgs e)
  539. {
  540. string UserName = Request.Cookies["UserName"].Value.ToString();
  541. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  542. df.SignInDocument(UserName,DocID);
  543. df = null;
  544. cmdSignIn.Visible = false;
  545. Response.AddHeader("Refresh","1");
  546. }
  547. private void cmdCancelSignIn_Click(object sender, System.EventArgs e)
  548. {
  549. string UserName = Request.Cookies["UserName"].Value.ToString();
  550. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  551. df.CancelSignInDocument(UserName,DocID); 
  552. df = null;
  553. Response.AddHeader("Refresh","1");
  554. }
  555. private void cmdPostilNext_Click(object sender, System.EventArgs e)
  556. {
  557. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  558. HtmlForm FrmNewDocument = (HtmlForm)this.Page.FindControl("PostilDocument");
  559. TextBox tmpText;
  560. tmpText = (TextBox)FrmNewDocument.FindControl("txtPostil");
  561. long PostilID;
  562. try
  563. {
  564. if(ProjectID>=0)
  565. {
  566. PostilID = df.AddPostil(UserName,DocID,tmpText.Text,1,ProjectID,2);
  567. int iResult;
  568. iResult = df.PostDocument(UserName,DocID,ProjectID);
  569. if(iResult==0)
  570. {
  571. UploadFile(PostilID);
  572. }
  573. else
  574. {
  575. Response.Write("<script lanuage='javascript'>alert('" + df.DoMessage(iResult,DocID,false) + "');</script>");
  576. }
  577. }
  578. else
  579. {
  580. Response.Write("<script lanuage='javascript'>alert('没有上级项目!');</script>");
  581. }
  582. }
  583. catch(Exception ex)
  584. {
  585. UDS.Components.Error.Log(ex.ToString());
  586. }
  587. finally
  588. {
  589. df = null;
  590. }
  591. Response.AddHeader("Refresh","1");
  592. }
  593. private void cmdPostilFaile_Click(object sender, System.EventArgs e)
  594. {
  595. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  596. HtmlForm FrmNewDocument = (HtmlForm)this.Page.FindControl("PostilDocument");
  597. TextBox tmpText;
  598. tmpText = (TextBox)(FrmNewDocument.FindControl("txtPostil"));
  599. long PostilID;
  600. try
  601. {
  602. PostilID= df.AddPostil(UserName,DocID,tmpText.Text,2,ProjectID,2);
  603. df.FaileDocument(DocID);
  604. UploadFile(PostilID);
  605. }
  606. catch(Exception ex)
  607. {
  608. UDS.Components.Error.Log(ex.ToString());
  609. }
  610. finally
  611. {
  612. df = null;
  613. }
  614. Response.AddHeader("Refresh","1");
  615. }
  616. private void cmdPostilFinish_Click(object sender, System.EventArgs e)
  617. {
  618. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  619. HtmlForm FrmNewDocument = (HtmlForm)this.Page.FindControl("PostilDocument");
  620. TextBox tmpText;
  621. tmpText = (TextBox)(FrmNewDocument.FindControl("txtPostil"));
  622. long PostilID;
  623. try
  624. {
  625. PostilID = df.AddPostil(UserName,DocID,tmpText.Text,3,ProjectID,0);
  626. df.FinishDocument(DocID);
  627. UploadFile(PostilID);
  628. }
  629. catch(Exception ex)
  630. {
  631. UDS.Components.Error.Log(ex.ToString());
  632. }
  633. finally
  634. {
  635. df = null;
  636. }
  637. Response.AddHeader("Refresh","1");
  638. }
  639. private void cmdReturn_Click(object sender, System.EventArgs e)
  640. {
  641. Server.Transfer("listDocument.aspx?DisplayType=" + ReturnPage.ToString());
  642. }
  643. private void cmdBack_Click(object sender, System.EventArgs e)
  644. {
  645. UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
  646. HtmlForm FrmNewDocument = (HtmlForm)this.Page.FindControl("PostilDocument");
  647. TextBox tmpText;
  648. tmpText = (TextBox)FrmNewDocument.FindControl("txtPostil");
  649. long PostilID;
  650. try
  651. {
  652. PostilID = df.AddPostil(UserName,DocID,tmpText.Text,4,ProjectID,2);
  653. df.BackDocument(DocID);
  654. UploadFile(PostilID);
  655. }
  656. catch(Exception ex)
  657. {
  658. UDS.Components.Error.Log(ex.ToString());
  659. }
  660. finally
  661. {
  662. df = null;
  663. }
  664. Response.AddHeader("Refresh","1");
  665. }
  666. }
  667. }