C#Sendfax
来源:互联网 发布:矩阵按键引脚 编辑:程序博客网 时间:2024/06/04 21:55
using FAXCOMLib;
private void SendFax(string FaxNumber,string FaxFile, string RecMan ,string RecCompany,string RecAddress,string SendMan,string SendCompany,string FaxTitle,string SendCompAddress)
{
string sql = "select * from Fax where FaxNumber=" + FaxNumber;
SqlConnection conn = new SqlConnection(connstr);
cmd = new SqlCommand(sql,conn);
conn.Open();
dr = cmd.ExecuteReader();
if(dr.Read())
{
Session["send"] = dr["SendFlagID"].ToString();
if(!Convert.ToBoolean(Session["send"]))
{
if(Convert.ToBoolean(dr["FaxNumber"]))
{
if(FaxFile!="")
{
try
{
FileInfo file = new FileInfo(FaxFile);
FAXCOMLib.FaxDoc fd = null;
FaxServer fs = null;
if(file.Exists)
{
try
{
fs =new FaxServerClass();
fd = (FaxDoc)fs.CreateDocument(file.FullName);
}
catch(Exception ex)
{
string Showex = ex.ToString();
}
}
try
{
fs.Connect(Environment.MachineName);
}
catch(Exception error)
{
throw new Exception(error.Message,error);
}
try
{
fd.FaxNumber=FaxNumber;
}
catch(Exception error)
{
throw new Exception(error.Message,error);
}
fd.FileName=FaxFile;
fd.RecipientName=RecMan;
fd.RecipientCompany=RecCompany;
fd.RecipientAddress=RecAddress;
fd.SenderName=SendMan;
fd.SenderCompany=SendCompany;
fd.DisplayName=FaxTitle;
fd.SenderAddress=SendCompAddress;
fd.ConnectionObject=fs;
try
{
int send = fd.Send();
}
catch(Exception error)
{
throw new Exception(error.Message,error);
}
FaxSendFlag=1;
Message.Visible=true;
Message.Text="发送成功!";
}
catch(Exception error)
{
throw new Exception("Create fax error"+error.Message,error);
}
}
else
{
Message.Visible=true;
Message.Text="发送失败!";
FaxSendFlag=0;
}
if(FaxSendFlag==1)
{
UpdateSql();
}
else
if(FaxSendFlag==0)
{
txtRemark.Text="";
txtFaxTitle.Text="";
UpdateSqlEvent();
}
}
else
{
Response.Write("<script>alert('服务器忙,请稍后再试!');window.window.location.href='SendFax.aspx';</script>");
txtRemark.Text="";
txtFaxTitle.Text="";
}
}
else
{
if(FaxFile!="")
{
try
{
FileInfo file = new FileInfo(FaxFile);
FAXCOMLib.FaxDoc fd = null;
FaxServer fs = null;
if(file.Exists)
{
try
{
fs =new FaxServerClass();
fd = (FaxDoc)fs.CreateDocument(file.FullName);
}
catch(Exception ex)
{
string Showex = ex.ToString();
}
}
try
{
fs.Connect(Environment.MachineName);
}
catch(Exception ex)
{
string Showex = ex.ToString();
}
try
{
fd.FaxNumber=FaxNumber;
}
catch(Exception ex)
{
string Showex = ex.ToString();
}
fd.FileName=FaxFile;
fd.RecipientName=RecMan;
fd.RecipientCompany=RecCompany;
fd.RecipientAddress=RecAddress;
fd.SenderName=SendMan;
fd.SenderCompany=SendCompany;
fd.DisplayName=FaxTitle;
fd.SenderAddress=SendCompAddress;
fd.ConnectionObject=fs;
try
{
int send = fd.Send();
}
catch(Exception ex)
{
string Showex = ex.ToString();
}
FaxSendFlag=1;
Message.Visible=true;
Message.Text="发送成功!";
}
catch(Exception error)
{
throw new Exception("Create fax error"+error.Message,error);
}
}
else
{
Message.Visible=true;
Message.Text="发送失败!";
FaxSendFlag=0;
}
if(FaxSendFlag==1)
{
UpdateSql();
}
else
if(FaxSendFlag==0)
{
txtRemark.Text="";
txtFaxTitle.Text="";
UpdateSqlEvent();
}
}
}
dr.Close();
conn.Close();
}
- C#Sendfax
- sendFAX
- SendFax过程分析
- c
- c
- c
- c
- C
- c
- c
- c
- C+
- c
- C
- c
- c
- c
- C
- 如何杀掉死锁
- vim快捷键收集
- WINCE窗口全屏并隐藏任务栏
- 使用并理解 IBM Lotus Notes/Domino 中的 Reader Names 字段
- S3C2410快速启动的实现
- C#Sendfax
- String与StringBuffer的区别(1)
- String与StringBuffer的区别(2)
- String与StringBuffer的区别(3)
- 中国足球弱智现象(关于失败)
- 明白了这十个故事,你也就参悟了人生 --转载
- XML签名大全
- Creating custom headers and footers in Application level events using global.asax
- [JavaScript] 动态删除下拉列表select的选项