|
|
@ -16,6 +16,7 @@ using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Net; |
|
|
|
using System.Net.Http; |
|
|
|
using System.Text; |
|
|
|
using System.Web; |
|
|
|
|
|
|
|
namespace EasyBL.WEBAPP.SYS |
|
|
@ -160,7 +161,6 @@ namespace EasyBL.WEBAPP.SYS |
|
|
|
|
|
|
|
|
|
|
|
#region Upload 上傳匯款單
|
|
|
|
|
|
|
|
public HttpResponseMessage UploadRemittance(string OrgID, string Account, string BookingID) |
|
|
|
{ |
|
|
|
SuccessResponseMessage srm = null; |
|
|
@ -183,16 +183,26 @@ namespace EasyBL.WEBAPP.SYS |
|
|
|
|
|
|
|
string requestUrl = Common.ConfigGetValue("", "ida:RedirectUri"); |
|
|
|
|
|
|
|
var sUser = db.Queryable<SETB_SAL_Payment>() |
|
|
|
.Where(x => x.BookingID == BookingID) |
|
|
|
var sName = db.Queryable<SETB_CMS_Member>() //取會員資料
|
|
|
|
.Where(x => x.Account == Account) |
|
|
|
.Single(); |
|
|
|
|
|
|
|
var sBookingStatus = db.Updateable<SETB_SAL_BookingOnline>() |
|
|
|
.UpdateColumns(x => new SETB_SAL_BookingOnline { BookingStatus = "02" }) |
|
|
|
var sUploadTime = db.Updateable<SETB_SAL_Payment>() //更新付款時間 + 付款狀態
|
|
|
|
.UpdateColumns(x => new SETB_SAL_Payment { PaymentDate = DateTime.Now }) |
|
|
|
.UpdateColumns(x => new SETB_SAL_Payment { PaymentStatus = "02" }) |
|
|
|
.Where(x => x.BookingID == BookingID) |
|
|
|
.ExecuteCommand(); |
|
|
|
|
|
|
|
var sFilePath = db.Queryable<OTB_SYS_Files>() |
|
|
|
//var sBookingStatus = db.Updateable<SETB_SAL_BookingOnline>() //更新訂單狀態
|
|
|
|
// .UpdateColumns(x => new SETB_SAL_BookingOnline { BookingStatus = "02" })
|
|
|
|
// .Where(x => x.BookingID == BookingID)
|
|
|
|
// .ExecuteCommand();
|
|
|
|
|
|
|
|
var sUser = db.Queryable<SETB_SAL_Payment>() //取付款資料
|
|
|
|
.Where(x => x.BookingID == BookingID) |
|
|
|
.Single(); |
|
|
|
|
|
|
|
var sFilePath = db.Queryable<OTB_SYS_Files>() //從file表中取圖
|
|
|
|
.Where(x => x.ParentID == sUser.Remittance) |
|
|
|
.Single(); |
|
|
|
|
|
|
@ -215,7 +225,7 @@ namespace EasyBL.WEBAPP.SYS |
|
|
|
toEmail.Add(oEmailTo); |
|
|
|
oEmail.FromUserName = "訂單匯款通知"; //取fonfig
|
|
|
|
oEmail.Title = "訂單匯款通知"; //取fonfig
|
|
|
|
oEmail.EmailBody = "請您在系統中確認訂單付款狀態,訂單編號為:" + sbookingID.BookingNo; |
|
|
|
oEmail.EmailBody = CheckPaymentStatus(sName.FirstName, sName.LastName, sbookingID.BookingNo, sbookingID.TotalPrice, sUser.PaymentDate); |
|
|
|
oEmail.IsCCSelf = false; |
|
|
|
oEmail.Attachments = null; |
|
|
|
oEmail.EmailTo = toEmail; |
|
|
@ -237,9 +247,142 @@ namespace EasyBL.WEBAPP.SYS |
|
|
|
} |
|
|
|
return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm)); |
|
|
|
} |
|
|
|
#endregion Upload 上傳匯款單
|
|
|
|
|
|
|
|
|
|
|
|
#endregion Upload 上傳匯款單
|
|
|
|
#region Redirect to Backend
|
|
|
|
public HttpResponseMessage RedirectToBackend(string BookingNo) |
|
|
|
{ |
|
|
|
//string sMsg = null;
|
|
|
|
SuccessResponseMessage srm = SugarBase.ExecTran(db => |
|
|
|
{ |
|
|
|
do |
|
|
|
{ |
|
|
|
|
|
|
|
var sUser = db.Queryable<SETB_SAL_BookingOnline>() //取付款資料
|
|
|
|
.Where(x => x.BookingNo == BookingNo) |
|
|
|
.Single(); |
|
|
|
|
|
|
|
|
|
|
|
srm = new SuccessResponseMessage(null, null); |
|
|
|
srm.DATA.Add("authtoken", sUser); |
|
|
|
|
|
|
|
} while (false); |
|
|
|
|
|
|
|
return srm; |
|
|
|
}); |
|
|
|
|
|
|
|
return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm)); |
|
|
|
} |
|
|
|
#endregion Redirect to Backend
|
|
|
|
|
|
|
|
//Booking Processing Mail Template
|
|
|
|
private string CheckPaymentStatus(string FirstName, string LastName, string BookingNo, string Amount, DateTime? date) |
|
|
|
{ |
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
|
|
|
|
EmailTemplate_CH mailTemplate = new EmailTemplate_CH(); |
|
|
|
var Server = Common.ConfigGetValue("", "ida:RedirectUri"); |
|
|
|
|
|
|
|
sb.Append(mailTemplate.MailHeader()); |
|
|
|
sb.Append(mailTemplate.MailCSS()); |
|
|
|
sb.Append(mailTemplate.MailShowEasyLogo()); |
|
|
|
//Email Body
|
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td style = \"padding: 0 50px 0 50px; background-color: #f8f8f8\" class=\"sm-p bar\">"); |
|
|
|
sb.Append("<table border=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 100%\">"); |
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td>"); |
|
|
|
sb.Append("<table border = \"0\" cellpadding = \"0\" cellspacing = \"0\" role = \"presentation\" align = \"left\"> "); |
|
|
|
//Text:您好,Janie,
|
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td bgcolor = \"#FEFEFE\" width = \"340\" style = \"display: block;padding-top: 30px;padding-left: 30px;padding-right: 30px;adding-bottom: 10px;font-family: arial, sans-serif;color: #000000;text-align: left\";>"); |
|
|
|
sb.Append("<h1 style = \"font-family: 'arial', 'sans-serif'; font-weight: 700; font-size: 16px; line-height: 18px; color: #000000; margin: 0 0 0 0;\">"); |
|
|
|
sb.Append("你好,Showeasy內部人員,"); |
|
|
|
sb.Append("</h1>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
sb.Append("</tr>"); |
|
|
|
//Text:我們已經成功收到你的付款!
|
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td bgcolor = \"#FEFEFE\" width = \"340\" style = \"display: block;padding-top: 10px;padding-left: 30px;padding-right: 30px;padding-bottom: 30px;font-family: arial, sans-serif;color: #000000;text-align: left;\">"); |
|
|
|
sb.Append("<p style = \"font-weight: 400;font-size: 12px;line-height: 14px;letter-spacing: 0.02em;font-family: 'arial', 'sans-serif';margin: 0 0 0px;\" class=\"has-markdown\">"); |
|
|
|
sb.Append("您的客戶已上傳匯款證明單,請至後台確認。"); |
|
|
|
sb.Append("</p>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
sb.Append("</tr>"); |
|
|
|
//訂單編號
|
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td bgcolor = \"#FEFEFE\" width = \"340\" width = \"340px\" style = \"display: block;padding-top: 20px;padding-left: 30px;padding-right: 30px;color: #504f4f;text-align: left;\">"); |
|
|
|
sb.Append("<p style = \"font-weight: 400;font-size: 12px;line-height: 14px;letter-spacing: 0.02em;font-family: 'arial', 'sans-serif';margin: 0 0 0px;\" class=\"has-markdown\">"); |
|
|
|
sb.Append("訂單編號: " + BookingNo); |
|
|
|
sb.Append("</p>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
//客戶名稱
|
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td bgcolor = \"#FEFEFE\" width = \"340\" width = \"340px\" style = \"display: block;padding-top: 10px;padding-left: 30px;padding-right: 30px;color: #504f4f;text-align: left;\">"); |
|
|
|
sb.Append("<p style = \"font-weight: 400;font-size: 12px;line-height: 14px;letter-spacing: 0.02em;font-family: 'arial', 'sans-serif';margin: 0 0 0px;\" class=\"has-markdown\">"); |
|
|
|
sb.Append("客戶名稱: " + FirstName + " " + LastName); |
|
|
|
sb.Append("</p>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
//訂單金額
|
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td bgcolor = \"#FEFEFE\" width = \"340\" width = \"340px\" style = \"display: block;padding-top: 10px;padding-left: 30px;padding-right: 30px;color: #504f4f;text-align: left;\">"); |
|
|
|
sb.Append("<p style = \"font-weight: 400;font-size: 12px;line-height: 14px;letter-spacing: 0.02em;font-family: 'arial', 'sans-serif';margin: 0 0 0px;\" class=\"has-markdown\">"); |
|
|
|
sb.Append("訂單金額: " + Amount); |
|
|
|
sb.Append("</p>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
//上傳日期
|
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td bgcolor = \"#FEFEFE\" width = \"340\" width = \"340px\" style = \"display: block;padding-top: 10px;padding-left: 30px;padding-right: 30px;padding-bottom: 30px;color: #504f4f;text-align: left;\">"); |
|
|
|
sb.Append("<p style = \"font-weight: 400;font-size: 12px;line-height: 14px;letter-spacing: 0.02em;font-family: 'arial', 'sans-serif';margin: 0 0 0px;\" class=\"has-markdown\">"); |
|
|
|
sb.Append("上傳日期: " + date); |
|
|
|
sb.Append("</p>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
sb.Append("</tr>"); |
|
|
|
sb.Append("</tr>"); |
|
|
|
//查看訂單按鈕
|
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td bgcolor =\"#FEFEFE\" style =\"display: block;padding-top: 30px;font-family: arial, sans-serif;color: #232323;text-align: left;\">"); |
|
|
|
sb.Append("<table align =\"center\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" role = \"presentation\">"); |
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td class=\"s-btn s-btn__primary\" style=\"border-radius: 16px; background: #ee9546\">"); |
|
|
|
sb.Append("<a class=\"s-btn s-btn__primary\" href=\""); |
|
|
|
sb.Append(Server + "/api/BookingOnline/RedirectToBackend?BookingNo=" + BookingNo); |
|
|
|
sb.Append(" \" target=\"_parent\" style=\"background: #ee9546;border: 1px solid #ee9546;font-family: arial, sans-serif; font-size: 14px;line-height: 16px; color: #ffffff;text-align: center;text-decoration: none;padding: 12px 20px; display: block; border-radius: 16px; white-space: nowrap;\">"); |
|
|
|
//sb.Append("<a class=\"s-btn s-btn__primary\" href=\"https://www.showeasy.com\" target=\"_parent\" style=\"background: #f48800;border: 1px solid #ee9546;font-family: arial, sans-serif;font-size: 14px;line-height: 16px;color: #ffffff;text-align: center;text-decoration: none;padding: 12px 20px;display: block;border-radius: 16px;white-space: nowrap;\">");
|
|
|
|
sb.Append("查看訂單"); |
|
|
|
sb.Append("</a>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
sb.Append("</tr>"); |
|
|
|
sb.Append("</table>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
sb.Append("</tr>"); |
|
|
|
//如果按鈕無法點擊 (連結記得改成要打的API)
|
|
|
|
sb.Append("<tr>"); |
|
|
|
sb.Append("<td bgcolor = \"#FEFEFE\" width = \"340\" width = \"340px\" style = \"display: block;padding-bottom: 30px;padding-top: 30px;padding-left: 30px;padding-right: 30px;color: #9c9c9c;text-align: center;\">"); |
|
|
|
sb.Append("<p style = \"font-weight: 400;font-size: 12px;line-height: 14px;letter-spacing: 0.02em;font-family: 'arial', 'sans-serif';margin: 0 0 0px;\" class=\"has-markdown\">"); |
|
|
|
sb.Append("如果按鈕無法點擊,你可以直接點擊"); |
|
|
|
sb.Append("<a href =\""); |
|
|
|
sb.Append(Server + "/api/BookingOnline/RedirectToBackend?BookingNo=" + BookingNo); |
|
|
|
sb.Append("\" style = \"color: #7997ff;font-size: 12px;font-weight: 400;font-family: 'Arial', '微軟正黑體','Microsoft JhengHei', 'Helvetica Neue',Helvetica, Arial, sans-serif;padding: 0;margin: 0;text-align: center;padding-left: 0px;padding-right: 30px;padding-top: 4px;text-decoration: underline;\">"); |
|
|
|
sb.Append("<span align=\"center\" width=\"340\">這裡</span>"); |
|
|
|
sb.Append("</a>"); |
|
|
|
sb.Append("</p>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
sb.Append("</tr>"); |
|
|
|
sb.Append("</table>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
sb.Append("</tr>"); |
|
|
|
sb.Append("</table>"); |
|
|
|
sb.Append("</td>"); |
|
|
|
sb.Append("</tr>"); |
|
|
|
//sb.Append(mailTemplate.MailButtom());
|
|
|
|
sb.Append(mailTemplate.MailFooter()); |
|
|
|
|
|
|
|
return sb.ToString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#region 取消訂單
|
|
|
|
|
|
|
@ -330,7 +473,7 @@ namespace EasyBL.WEBAPP.SYS |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion Upload 上傳匯款單
|
|
|
|
#endregion My Booking Card
|
|
|
|
|
|
|
|
public HttpResponseMessage SaveBookingStatus(string sBookingID, string sBookingStatus) { |
|
|
|
|
|
|
|