📄 page2.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using IFS.ReportFax;
public partial class Page2 : System.Web.UI.Page
{
private static log4net.ILog logger = FaxUtil.getLogger();
private static string docFullName;
private static string docName;
private static int result;
private static string fullName;
protected void Page_Load(object sender, EventArgs e)
{
//if (WebValidate.isValidate() == false)
// Response.Redirect("Error.aspx");
}
protected void Button3_Click(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
string strBaseLocation = System.IO.Directory.GetCurrentDirectory() + "\\QRP\\";
strBaseLocation = "C:\\Inetpub\\wwwroot\\ReportFax\\QRP\\";
fullName = File1.PostedFile.FileName;
if (!fullName.ToLower().EndsWith(".xls"))
this.Response.Redirect("Error4.aspx");
//
string name = fullName.Substring(fullName.LastIndexOf("\\") + 1, fullName.Length - fullName.LastIndexOf("\\") - 1);
docFullName = strBaseLocation + name;
if (File1.PostedFile.ContentLength != 0)
{
File1.PostedFile.SaveAs(docFullName);
Label2.Text = name + " has been uploaded to the server.";
Button3.Enabled = true;
}
}
protected void Button3_Click1(object sender, EventArgs e)
{
FaxService faxService = new FaxService();
//faxService.start();
//faxService.killAdobe();
//Format converting from file to bytes
//System.IO.FileStream fStream = new System.IO.FileStream(docFullName, System.IO.FileMode.Open);
//byte[] bStream = new byte[fStream.Length];
//fStream.Read(bStream, 0, (int)fStream.Length);
//fStream.Close();
//localhost.Service s = new localhost.Service();
//int status = faxService.docReciever(bStream, docName);
try
{
Int64.Parse(TextBox1.Text);
}
catch (System.FormatException)
{
this.Response.Redirect("Error3.aspx");
}
if(TextBox1.Text.Length < 6)
this.Response.Redirect("Error3.aspx");
string faxNum = TextBox1.Text;
try
{
faxService.faxDocument(docFullName, faxNum);
faxService.killAdobe();
}
catch (System.TimeoutException excp)
{
logger.Error("Time out. ", excp);
TextBox1.Text = "TiME oUT, please check the number or contact the administrator.";
}
catch (System.Net.WebException excp2)
{
logger.Error("Time out. ", excp2);
TextBox1.Text = "TiME oUT, please check the number or contact the administrator.";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -