| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- using System;
- using System.Collections;
- using System.Configuration;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.HtmlControls;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Xml.Linq;
- using System.IO;
- namespace LYZHGDWeb.Communications
- {
- public partial class CZGL_FaxRecv : BaseClass.BasePage
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- Response.Expires = -1;
- if (!Page.IsPostBack)
- {
- if (!string.IsNullOrEmpty(Request.QueryString["fptype"]))
- {
- if (Request.QueryString["fptype"].Trim() == "true")
- {
- btnFPFax.Visible = true;
- }
- }
- this.BtnisEnable();
- if (!string.IsNullOrEmpty(Request.QueryString["id"]))
- {
- Initialize(Request.QueryString["id"]);
- }
- }
- }
- private void BtnisEnable()
- {
- if (!base.BtnIsEnable("DXCZ_CZGL_CZFP", "FPFax"))
- {
- btnFPFax.Visible = false;
- }
- }
- #region 信息初始化
- void Initialize(string id)
- {
- try
- {
- Obj = new BLL.T_FAX_RECVFAX().GetModel(Convert.ToInt32(id));
- }
- catch (Exception ex)
- {
- Common.SysLog.WriteLog(ex);
- }
- }
- #endregion
- #region 公共属性
- private JAnCallCenter.Model.T_FAX_RECVFAX Obj
- {
- get
- {
- return null;
- }
- set
- {
- if (value != null)
- {
- #region 更新查看状态
- if (!string.IsNullOrEmpty(Request.QueryString["update"]))
- {
- txtgh.Value = "gh";
- this.Title = "查看传真";
- }
- else
- {
- if (value.STATE == 0)
- {
- int i = new JAnCallCenter.BLL.T_FAX_RECVFAX().UpdateState(Convert.ToInt32(value.FAXID), 1);
- if (i > 0)
- {
- txtupdateres.Value = "success";
- }
- }
- }
- #endregion
- this.txtFaxID.Value = value.FAXID.ToString().Trim();
- this.txtPhone.Value = value.TELNUM;
- this.txtContents.Value = value.TIFFILEPATH;
- this.txtSendTime.Value = value.RECVTIME.ToString();
- this.txtName.Value = value.F_NAME;
- //this.divDetail.InnerHtml = "<span style='cursor:hand; color:Blue;' onclick='ShowFax(\"" + Server.UrlEncode(value.TifFilePath.Trim()) + "\",\"" + Server.UrlEncode(value.FilePath.Trim()) + "\")'>查看传真</span>";
- string requestpath = "";
- requestpath = value.TIFFILEPATH.Trim();
- if (value.FILEPATH!=null && value.FILEPATH.Trim() != "")
- {
- //已存入到Web服务器
- this.divDetail.InnerHtml = "<span style='cursor:hand; color:Blue;' onclick='ShowFax(\"" + Server.UrlEncode(value.FILEPATH.Trim()) + "\",\"\")'>查看传真</span>";
- if (txtgh.Value == "")
- {
- ShowFax.Attributes.Add("src", "CZGL_FaxShow.aspx?tifpath=" + Server.UrlEncode(value.FILEPATH.Trim()) + "&webpath=&fid=" + txtFaxID.Value);
- }
- else
- {
- ShowFax.Attributes.Add("src", "CZGL_FaxShow.aspx?type=gh&tifpath=" + Server.UrlEncode(value.FILEPATH.Trim()) + "&webpath=&fid=" + txtFaxID.Value);
- }
- }
- else
- {
- try
- {
- //下载文件、存入到Web服务器返回路径、更新数据库WebFilePath
- byte[] file;
- FaxService.FaxService ws = new JAnCallCenter.FaxService.FaxService();
- file = ws.DownloadFile(requestpath);
- if (file != null)
- {
- string _FaxFileName = "";
- string _Path = "\\FaxFile\\" + DateTime.Now.ToString("yyyyMM");
- string _SavePath = AppDomain.CurrentDomain.BaseDirectory + _Path;
- if (!Directory.Exists(_SavePath))
- {
- Directory.CreateDirectory(_SavePath);
- }
- string _xdPath = _Path + "\\" + Guid.NewGuid().ToString().Replace("-", "") + "." + requestpath.Substring(requestpath.LastIndexOf(".") + 1);
- _FaxFileName = AppDomain.CurrentDomain.BaseDirectory + _xdPath;
- using (FileStream fs = new FileStream(_FaxFileName, FileMode.Create, FileAccess.Write))
- {
- fs.Write(file, 0, file.Length);
- fs.Flush();
- fs.Close();
- }
- Model.T_FAX_RECVFAX model = new Model.T_FAX_RECVFAX();
- model.FAXID = value.FAXID;
- model.FILEPATH = _xdPath;
- model.FILEPATH = _xdPath;
- int r = new BLL.T_FAX_RECVFAX().UpdateWebFilePath(model);
- if (r > 0)
- {
- this.divDetail.InnerHtml = "<span style='cursor:hand; color:Blue;' onclick='ShowFax(\"" + Server.UrlEncode(_xdPath.Trim()) + "\",\"\")'>查看传真</span>";
- if (txtgh.Value == "")
- {
- ShowFax.Attributes.Add("src", "CZGL_FaxShow.aspx?tifpath=" + Server.UrlEncode(_xdPath.Trim()) + "&webpath=");
- }
- else
- {
- ShowFax.Attributes.Add("src", "CZGL_FaxShow.aspx?type=gh&tifpath=" + Server.UrlEncode(_xdPath.Trim()) + "&webpath=");
- }
- }
- }
- }
- catch
- { }
- }
- }
- }
- }
- #endregion
- }
- }
|