洛阳中航光电项目,为12年项目,此处使用反编译工具恢复源码,恢复为.netframe4.0版本,但仍需使用ie8访问; 数据库使用oracle,现再192.168.8.3服务器,访问账户scott,密码800100

CZGL_FaxRecv.aspx.cs 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.HtmlControls;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Xml.Linq;
  13. using System.IO;
  14. namespace LYZHGDWeb.Communications
  15. {
  16. public partial class CZGL_FaxRecv : BaseClass.BasePage
  17. {
  18. protected void Page_Load(object sender, EventArgs e)
  19. {
  20. Response.Expires = -1;
  21. if (!Page.IsPostBack)
  22. {
  23. if (!string.IsNullOrEmpty(Request.QueryString["fptype"]))
  24. {
  25. if (Request.QueryString["fptype"].Trim() == "true")
  26. {
  27. btnFPFax.Visible = true;
  28. }
  29. }
  30. this.BtnisEnable();
  31. if (!string.IsNullOrEmpty(Request.QueryString["id"]))
  32. {
  33. Initialize(Request.QueryString["id"]);
  34. }
  35. }
  36. }
  37. private void BtnisEnable()
  38. {
  39. if (!base.BtnIsEnable("DXCZ_CZGL_CZFP", "FPFax"))
  40. {
  41. btnFPFax.Visible = false;
  42. }
  43. }
  44. #region 信息初始化
  45. void Initialize(string id)
  46. {
  47. try
  48. {
  49. Obj = new BLL.T_FAX_RECVFAX().GetModel(Convert.ToInt32(id));
  50. }
  51. catch (Exception ex)
  52. {
  53. Common.SysLog.WriteLog(ex);
  54. }
  55. }
  56. #endregion
  57. #region 公共属性
  58. private JAnCallCenter.Model.T_FAX_RECVFAX Obj
  59. {
  60. get
  61. {
  62. return null;
  63. }
  64. set
  65. {
  66. if (value != null)
  67. {
  68. #region 更新查看状态
  69. if (!string.IsNullOrEmpty(Request.QueryString["update"]))
  70. {
  71. txtgh.Value = "gh";
  72. this.Title = "查看传真";
  73. }
  74. else
  75. {
  76. if (value.STATE == 0)
  77. {
  78. int i = new JAnCallCenter.BLL.T_FAX_RECVFAX().UpdateState(Convert.ToInt32(value.FAXID), 1);
  79. if (i > 0)
  80. {
  81. txtupdateres.Value = "success";
  82. }
  83. }
  84. }
  85. #endregion
  86. this.txtFaxID.Value = value.FAXID.ToString().Trim();
  87. this.txtPhone.Value = value.TELNUM;
  88. this.txtContents.Value = value.TIFFILEPATH;
  89. this.txtSendTime.Value = value.RECVTIME.ToString();
  90. this.txtName.Value = value.F_NAME;
  91. //this.divDetail.InnerHtml = "<span style='cursor:hand; color:Blue;' onclick='ShowFax(\"" + Server.UrlEncode(value.TifFilePath.Trim()) + "\",\"" + Server.UrlEncode(value.FilePath.Trim()) + "\")'>查看传真</span>";
  92. string requestpath = "";
  93. requestpath = value.TIFFILEPATH.Trim();
  94. if (value.FILEPATH!=null && value.FILEPATH.Trim() != "")
  95. {
  96. //已存入到Web服务器
  97. this.divDetail.InnerHtml = "<span style='cursor:hand; color:Blue;' onclick='ShowFax(\"" + Server.UrlEncode(value.FILEPATH.Trim()) + "\",\"\")'>查看传真</span>";
  98. if (txtgh.Value == "")
  99. {
  100. ShowFax.Attributes.Add("src", "CZGL_FaxShow.aspx?tifpath=" + Server.UrlEncode(value.FILEPATH.Trim()) + "&webpath=&fid=" + txtFaxID.Value);
  101. }
  102. else
  103. {
  104. ShowFax.Attributes.Add("src", "CZGL_FaxShow.aspx?type=gh&tifpath=" + Server.UrlEncode(value.FILEPATH.Trim()) + "&webpath=&fid=" + txtFaxID.Value);
  105. }
  106. }
  107. else
  108. {
  109. try
  110. {
  111. //下载文件、存入到Web服务器返回路径、更新数据库WebFilePath
  112. byte[] file;
  113. FaxService.FaxService ws = new JAnCallCenter.FaxService.FaxService();
  114. file = ws.DownloadFile(requestpath);
  115. if (file != null)
  116. {
  117. string _FaxFileName = "";
  118. string _Path = "\\FaxFile\\" + DateTime.Now.ToString("yyyyMM");
  119. string _SavePath = AppDomain.CurrentDomain.BaseDirectory + _Path;
  120. if (!Directory.Exists(_SavePath))
  121. {
  122. Directory.CreateDirectory(_SavePath);
  123. }
  124. string _xdPath = _Path + "\\" + Guid.NewGuid().ToString().Replace("-", "") + "." + requestpath.Substring(requestpath.LastIndexOf(".") + 1);
  125. _FaxFileName = AppDomain.CurrentDomain.BaseDirectory + _xdPath;
  126. using (FileStream fs = new FileStream(_FaxFileName, FileMode.Create, FileAccess.Write))
  127. {
  128. fs.Write(file, 0, file.Length);
  129. fs.Flush();
  130. fs.Close();
  131. }
  132. Model.T_FAX_RECVFAX model = new Model.T_FAX_RECVFAX();
  133. model.FAXID = value.FAXID;
  134. model.FILEPATH = _xdPath;
  135. model.FILEPATH = _xdPath;
  136. int r = new BLL.T_FAX_RECVFAX().UpdateWebFilePath(model);
  137. if (r > 0)
  138. {
  139. this.divDetail.InnerHtml = "<span style='cursor:hand; color:Blue;' onclick='ShowFax(\"" + Server.UrlEncode(_xdPath.Trim()) + "\",\"\")'>查看传真</span>";
  140. if (txtgh.Value == "")
  141. {
  142. ShowFax.Attributes.Add("src", "CZGL_FaxShow.aspx?tifpath=" + Server.UrlEncode(_xdPath.Trim()) + "&webpath=");
  143. }
  144. else
  145. {
  146. ShowFax.Attributes.Add("src", "CZGL_FaxShow.aspx?type=gh&tifpath=" + Server.UrlEncode(_xdPath.Trim()) + "&webpath=");
  147. }
  148. }
  149. }
  150. }
  151. catch
  152. { }
  153. }
  154. }
  155. }
  156. }
  157. #endregion
  158. }
  159. }