Browse Source

添加下訂單時給聯絡人發Mail

Dev
alina 2 years ago
parent
commit
ca80e29862
  1. 64
      EuroTran/EasyBL.WEBAPP/ShowEasy/OnsiteService.cs

64
EuroTran/EasyBL.WEBAPP/ShowEasy/OnsiteService.cs

@ -1117,19 +1117,57 @@ namespace EasyBL.WEBAPP.ShowEasy
{ {
//取得聯絡人的Email //取得聯絡人的Email
//var objONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteBaseInfo>()
// //搜尋條件
// .Where(x => x.OrgID == sORIGID && x.ServiceID == Booking.ServiceID && x.LangID == rsBooking.LangType)
// .Single();
//if (objONSiteBaseInfo.Undertaker != "[]" && objONSiteBaseInfo.Undertaker != "")
//{
// var saContactor = db.Queryable<SETB_SCM_SupplierContactor>
// ()
// .Where((t1) => t1.LangType == rsBooking.LangType && objONSiteBaseInfo.Undertaker.Contains(t1.Guid))
// .ToList();
//}
var objONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteBaseInfo>()
//搜尋條件
.Where(x => x.OrgID == sORIGID && x.ServiceID == Booking.ServiceID && x.LangID == rsBooking.LangType)
.Single();
if (objONSiteBaseInfo.Undertaker != "[]" && objONSiteBaseInfo.Undertaker != "")
{
var saContactor = db.Queryable<SETB_SCM_SupplierContactor>
()
.Where((t1) => t1.LangType == rsBooking.LangType && objONSiteBaseInfo.Undertaker.Contains(t1.Guid))
.ToList();
if (saContactor.Count > 0) {
try
{
//開始寄信
var oEmail = new Emails(); //寄件人
var toEmail = new List<EmailTo>(); //收件人
foreach (var Contactor in saContactor)
{
var oEmailTo = new EmailTo //收件人資訊
{
ToUserName = Contactor.ContacterName,
ToEmail = Contactor.Email,
Type = "to"
};
toEmail.Add(oEmailTo);
}
oEmail.Title = "訂單確認"; //取fonfig
oEmail.EmailBody = "請與系統中確認訂單,訂單編號:" + rsBooking.BookingNo;
oEmail.IsCCSelf = false;
oEmail.Attachments = null;
oEmail.EmailTo = toEmail;
var bSend = new MailService(sORIGID, true).MailFactory(oEmail, out sError);
}
catch (Exception)
{
throw;
}
}
}
} }

Loading…
Cancel
Save