@ -31,6 +31,7 @@ using UFSoft.UBF.PRN.Control;
using UFSoft.UBF.Report.Tools ;
using CusSupplierContactBP ;
using System.Collections.Generic ;
using System.Linq ;
@ -56,22 +57,31 @@ namespace UFIDA.U9.Cust.WC.CustPOSendMailUI
Action . OnSend ( sender , new UIActionEventArgs ( ) ) ;
//string SelSQL = @"SELECT PrintTemplateText FROM Cust_PrintTemplateText WHERE PrintTemplateTypeName='" + this.DropDownList_Notices.Text + "'";
//DataSet SelSQLDs = new DataSet();
//UFSoft.UBF.Util.DataAccess.DataAccessor.RunSQL(UFSoft.UBF.Util.DataAccess.DataAccessor.GetConn(), SelSQL.ToString(), null, out SelSQLDs);
//DataTable dt = new DataTable();
//dt = SelSQLDs.Tables[0];
//if (dt.Rows.Count < 1)
//{
// throw new Exception("配置表Cust_PrintTemplateText中不存在对应信息,请先维护");
//}
this . MailText53 . Text = "Dear Supplier:" + "\r\n" + "Please refer to the New PO, Confirm it within today and feedback the delivery date within 2 Days,Thanks."
if ( this . DropDownList_Notices . Text = = "英文模板" )
{
this . MailText53 . Text = "Dear Supplier:" + "\r\n" + "Please refer to the New PO, Confirm it within today and feedback the delivery date within 2 Days,Thanks."
+ "\r\n" + "Best Regards" + "\r\n" + "The information contained in this message is confidential and may be " +
"legally privileged. The message is intended solely for the addressee(s). " +
"If you are not the intended recipient, you are hereby notified that any use,dissemination " +
"or reproduction is strictly prohibited and may be unlawful. If you are not the intended recipient, " +
"please contact the sender by return e-mail and destroy all copies of the original message." ;
}
else
{
string SelSQL = @"SELECT PrintTemplateText FROM Cust_PrintTemplateText WHERE PrintTemplateTypeName='" + this . DropDownList_Notices . Text + "'" ;
DataSet SelSQLDs = new DataSet ( ) ;
UFSoft . UBF . Util . DataAccess . DataAccessor . RunSQL ( UFSoft . UBF . Util . DataAccess . DataAccessor . GetConn ( ) , SelSQL . ToString ( ) , null , out SelSQLDs ) ;
DataTable dt = new DataTable ( ) ;
dt = SelSQLDs . Tables [ 0 ] ;
if ( dt . Rows . Count < 1 )
{
throw new Exception ( "配置表Cust_PrintTemplateText中不存在对应模板正文信息,请先维护" ) ;
}
this . MailText53 . Text = dt . Rows [ 0 ] [ "PrintTemplateText" ] . ToString ( ) ;
}
this . DataCollect ( ) ;
this . DataBind ( ) ;
@ -244,79 +254,112 @@ namespace UFIDA.U9.Cust.WC.CustPOSendMailUI
message . CC . Add ( CCAddress ) ; //抄送人邮箱
}
//string SelSQL = @"SELECT top 1 PrintTemplateText FROM Cust_PrintTemplateText ";
//DataSet SelSQLDs = new DataSet();
//UFSoft.UBF.Util.DataAccess.DataAccessor.RunSQL(UFSoft.UBF.Util.DataAccess.DataAccessor.GetConn(), SelSQL.ToString(), null, out SelSQLDs);
//DataTable dt = new DataTable();
//dt = SelSQLDs.Tables[0];
//if (dt.Rows.Count < 1)
//{
// throw new Exception("配置表Cust_PrintTemplateText中不存在对应信息,请先维护");
//}
message . From = new MailAddress ( SendAddress ) ; //发件人邮箱
message . Subject = this . MailTitle86 . Text ; //邮件标题
message . SubjectEncoding = Encoding . UTF8 ; //标题格式为UTF8
//string _Body = dt.Rows[0][0].ToString();
//string[] strArray = _Body.Split(new char[1] { ' ' });
string mailMessage = "" ;
string _SelSQL = @ "select c.DefaultEmail from PM_PurchaseOrder a
left join CBO_Operators b on a . PurOper = b . ID
left join Base_Contact c on b . Contact = c . ID
where a . DocNo = ' " + CurrentState[" POCode "].ToString() + " ' and a . Org = ' " + CurrentState[" OrgID "].ToString() + " ' ";
DataSet _SelSQLDs = new DataSet ( ) ;
UFSoft . UBF . Util . DataAccess . DataAccessor . RunSQL ( UFSoft . UBF . Util . DataAccess . DataAccessor . GetConn ( ) , _SelSQL . ToString ( ) , null , out _SelSQLDs ) ;
DataTable dtPur = new DataTable ( ) ;
dtPur = _SelSQLDs . Tables [ 0 ] ;
if ( dtPur . Rows . Count = = 0 )
if ( this . DropDownList_Notices . Text = = "英文模板" )
{
throw new Exception ( "采购员未维护邮箱" ) ;
}
string PurMail = dtPur . Rows [ 0 ] [ "DefaultEmail" ] . ToString ( ) ; //采购员收件邮箱
string mailMessage = @ "<html>
mailMessage = @ "<html>
< body >
< table style = ' width : 1 0 0 % ; table - layout : fixed ; font - size : 1 6 px ; ' border : 0 px cellspacing = '4' >
< tbody > ";
int k = 0 ;
mailMessage + = string . Format ( @ "
int k = 0 ;
mailMessage + = string . Format ( @ "
< tr >
< td > { 0 } < / td >
< / tr >
", " Dear Supplier : ");
mailMessage + = string . Format ( @ "
mailMessage + = string . Format ( @ "
< tr >
< td > { 0 } < / td >
< / tr >
", " Please refer to the New PO , Confirm it within today and feedback the delivery date within 2 Days , Thanks . ");
mailMessage + = string . Format ( @ "
mailMessage + = string . Format ( @ "
< tr >
< td > { 0 } < / td >
< / tr >
", " Best Regards ");
mailMessage + = string . Format ( @ "
mailMessage + = string . Format ( @ "
< tr >
< td > { 0 } < / td >
< / tr >
", " The information contained in this message is confidential and may be legally privileged . " +
"The message is intended solely for the addressee(s). If you are not the intended recipient," +
" you are hereby notified that any use, dissemination or reproduction is strictly prohibited" +
" and may be unlawful. If you are not the intended recipient, please contact the sender " +
"by return e-mail and destroy all copies of the original message." ) ;
"The message is intended solely for the addressee(s). If you are not the intended recipient," +
" you are hereby notified that any use, dissemination or reproduction is strictly prohibited" +
" and may be unlawful. If you are not the intended recipient, please contact the sender " +
"by return e-mail and destroy all copies of the original message." ) ;
mailMessage + = @" </table></body></html>" ;
}
else
{
string SelSQL = @"SELECT PrintTemplateText FROM Cust_PrintTemplateText WHERE PrintTemplateTypeName='" + this . DropDownList_Notices . Text + "'" ;
DataSet SelSQLDs = new DataSet ( ) ;
UFSoft . UBF . Util . DataAccess . DataAccessor . RunSQL ( UFSoft . UBF . Util . DataAccess . DataAccessor . GetConn ( ) , SelSQL . ToString ( ) , null , out SelSQLDs ) ;
DataTable dt = SelSQLDs . Tables [ 0 ] ;
if ( dt . Rows . Count < 1 )
{
throw new Exception ( "配置表Cust_PrintTemplateText中不存在对应模板正文信息,请先维护" ) ;
}
string body = dt . Rows [ 0 ] [ "PrintTemplateText" ] . ToString ( ) ; //正文信息
List < string > bodylist = body . Split ( ' ' ) . ToList ( ) ;
mailMessage = @ "<html>
< body >
< table style = ' width : 1 0 0 % ; table - layout : fixed ; font - size : 1 6 px ; ' border : 0 px cellspacing = '4' >
< tbody > ";
foreach ( var item in bodylist )
{
mailMessage + = string . Format ( @ "
< tr >
< td > { 0 } < / td >
< / tr >
", item);
}
mailMessage + = @" </table></body></html>" ;
}
//string _Body = dt.Rows[0][0].ToString();
//string[] strArray = _Body.Split(new char[1] { ' ' });
string _SelSQL = @ "select c.DefaultEmail from PM_PurchaseOrder a
left join CBO_Operators b on a . PurOper = b . ID
left join Base_Contact c on b . Contact = c . ID
where a . DocNo = ' " + CurrentState[" POCode "].ToString() + " ' and a . Org = ' " + CurrentState[" OrgID "].ToString() + " ' ";
DataSet _SelSQLDs = new DataSet ( ) ;
UFSoft . UBF . Util . DataAccess . DataAccessor . RunSQL ( UFSoft . UBF . Util . DataAccess . DataAccessor . GetConn ( ) , _SelSQL . ToString ( ) , null , out _SelSQLDs ) ;
DataTable dtPur = new DataTable ( ) ;
dtPur = _SelSQLDs . Tables [ 0 ] ;
if ( dtPur . Rows . Count = = 0 )
{
throw new Exception ( "采购员未维护邮箱" ) ;
}
string PurMail = dtPur . Rows [ 0 ] [ "DefaultEmail" ] . ToString ( ) ; //采购员收件邮箱
mailMessage + = @" </table></body></html>" ;
if ( ! string . IsNullOrEmpty ( PurMail ) )
{
@ -414,21 +457,20 @@ namespace UFIDA.U9.Cust.WC.CustPOSendMailUI
{
DropDownList_Notices . Items . Clear ( ) ;
//string _SelSQL = @"SELECT PrintTemplateTypeName FROM Cust_PrintTemplateText";
//DataSet _SelSQLDs = new DataSet();
//UFSoft.UBF.Util.DataAccess.DataAccessor.RunSQL(UFSoft.UBF.Util.DataAccess.DataAccessor.GetConn(), _SelSQL.ToString(), null, out _SelSQLDs);
//DataTable _dt = new DataTable();
//_dt = _SelSQLDs.Tables[0];
//if (_dt.Rows.Count < 1)
//{
// throw new Exception("配置表Cust_PrintTemplateText中不存在对应信息,请先维护");
//}
//foreach (DataRow item in _dt.Rows)
//{
// this.DropDownList_Notices.Items.Add("" + item["PrintTemplateTypeName"].ToString() + "");
//}
this . DropDownList_Notices . Items . Add ( "发送模板" ) ;
string _SelSQL = @"SELECT PrintTemplateTypeName FROM Cust_PrintTemplateText" ;
DataSet _SelSQLDs = new DataSet ( ) ;
UFSoft . UBF . Util . DataAccess . DataAccessor . RunSQL ( UFSoft . UBF . Util . DataAccess . DataAccessor . GetConn ( ) , _SelSQL . ToString ( ) , null , out _SelSQLDs ) ;
DataTable _dt = new DataTable ( ) ;
_dt = _SelSQLDs . Tables [ 0 ] ;
if ( _dt . Rows . Count > 0 )
{
foreach ( DataRow item in _dt . Rows )
{
this . DropDownList_Notices . Items . Add ( "" + item [ "PrintTemplateTypeName" ] . ToString ( ) + "" ) ;
}
}
this . DropDownList_Notices . Items . Add ( "英文模板" ) ;
DropDownList_Notices . SelectedIndex = 0 ;
@ -465,23 +507,15 @@ namespace UFIDA.U9.Cust.WC.CustPOSendMailUI
OnLoadData_DefaultImpl ( sender ) ;
string MaileTile = string . Empty ;
MaileTile = "采购订单 " + POCode + "," + "供应商:" + SupplierName ;
//string SelSQL = @"SELECT top 1 PrintTemplateText FROM Cust_PrintTemplateText ";
//DataSet SelSQLDs = new DataSet();
//UFSoft.UBF.Util.DataAccess.DataAccessor.RunSQL(UFSoft.UBF.Util.DataAccess.DataAccessor.GetConn(), SelSQL.ToString(), null, out SelSQLDs);
//DataTable dt = new DataTable();
//dt = SelSQLDs.Tables[0];
//if (dt.Rows.Count < 1)
//{
// throw new Exception("配置表Cust_PrintTemplateText中不存在对应信息,请先维护");
//}
string _SelSQL = @ "select c.DefaultEmail from PM_PurchaseOrder a
MaileTile = "采购订单 " + POCode + "," + "供应商:" + SupplierName ;
_SelSQL = @ "select c.DefaultEmail from PM_PurchaseOrder a
left join CBO_Operators b on a . PurOper = b . ID
left join Base_Contact c on b . Contact = c . ID
where a . DocNo = ' " + CurrentState[" POCode "].ToString() + " ' and a . Org = ' " + CurrentState[" OrgID "].ToString() + " ' ";
DataSet _SelSQLDs = new DataSet ( ) ;
_SelSQLDs = new DataSet ( ) ;
UFSoft . UBF . Util . DataAccess . DataAccessor . RunSQL ( UFSoft . UBF . Util . DataAccess . DataAccessor . GetConn ( ) , _SelSQL . ToString ( ) , null , out _SelSQLDs ) ;
DataTable dtPur = new DataTable ( ) ;
dtPur = _SelSQLDs . Tables [ 0 ] ;
@ -494,12 +528,28 @@ namespace UFIDA.U9.Cust.WC.CustPOSendMailUI
this . MailTitle86 . Text = MaileTile ;
this . MailText53 . Text = "Dear Supplier:" + "\r\n" + "Please refer to the New PO, Confirm it within today and feedback the delivery date within 2 Days,Thanks."
if ( this . DropDownList_Notices . Text = = "英文模板" )
{
this . MailText53 . Text = "Dear Supplier:" + "\r\n" + "Please refer to the New PO, Confirm it within today and feedback the delivery date within 2 Days,Thanks."
+ "\r\n" + "Best Regards" + "\r\n" + "The information contained in this message is confidential and may be " +
"legally privileged. The message is intended solely for the addressee(s). " +
"If you are not the intended recipient, you are hereby notified that any use,dissemination " +
"or reproduction is strictly prohibited and may be unlawful. If you are not the intended recipient, " +
"please contact the sender by return e-mail and destroy all copies of the original message." ;
}
else
{
string SelSQL = @"SELECT PrintTemplateText FROM Cust_PrintTemplateText WHERE PrintTemplateTypeName='" + this . DropDownList_Notices . Text + "'" ;
DataSet SelSQLDs = new DataSet ( ) ;
UFSoft . UBF . Util . DataAccess . DataAccessor . RunSQL ( UFSoft . UBF . Util . DataAccess . DataAccessor . GetConn ( ) , SelSQL . ToString ( ) , null , out SelSQLDs ) ;
DataTable dt = new DataTable ( ) ;
dt = SelSQLDs . Tables [ 0 ] ;
if ( dt . Rows . Count < 1 )
{
throw new Exception ( "配置表Cust_PrintTemplateText中不存在对应模板正文信息,请先维护" ) ;
}
this . MailText53 . Text = dt . Rows [ 0 ] [ "PrintTemplateText" ] . ToString ( ) ;
}
this . DataCollect ( ) ;
this . DataBind ( ) ;