public string CancelPPECRecurringOrder(int OriginalOrderNumber, bool TriggeredByPayPal) { String result = AppLogic.ro_OK; Order originalOrder = new Order(OriginalOrderNumber); Customer customerToNotify = new Customer(originalOrder.CustomerID, true); //Cancel the recurring profile on PayPal's end if (TriggeredByPayPal == false) { result = PayPalController.CancelECRecurringProfile(OriginalOrderNumber); } if (result == AppLogic.ro_OK) { //Cancel the recurring profile in the cart DB.ExecuteSQL(String.Format("delete from kitcart where OriginalRecurringOrderNumber={0}", OriginalOrderNumber.ToString())); DB.ExecuteSQL(String.Format("delete from ShoppingCart where OriginalRecurringOrderNumber={0}", OriginalOrderNumber.ToString())); // now notify people of cancellation: try { // send email notification to customer string emailSubject = String.Format("{0} - Recurring Order Canceled", AppLogic.AppConfig("StoreName")); string emailBody = String.Format("Your recurring order has been canceled. The original order number was: {0}", OriginalOrderNumber.ToString()); AppLogic.SendMail(subject: emailSubject, body: emailBody + AppLogic.AppConfig("MailFooter"), useHtml: true, fromAddress: AppLogic.AppConfig("ReceiptEMailFrom"), fromName: AppLogic.AppConfig("ReceiptEMailFromName"), toAddress: customerToNotify.EMail, toName: customerToNotify.EMail, bccAddresses: String.Empty, server: AppLogic.MailServer()); // send email notification to admin if (AppLogic.AppConfig("GotOrderEMailTo").Length != 0 && !AppLogic.AppConfigBool("TurnOffStoreAdminEMailNotifications")) { String SendToList = AppLogic.AppConfig("GotOrderEMailTo").Replace(",", ";"); if (SendToList.IndexOf(';') != -1) { foreach (String s in SendToList.Split(';')) { AppLogic.SendMail(subject: emailSubject, body: emailBody + AppLogic.AppConfig("MailFooter"), useHtml: true, fromAddress: AppLogic.AppConfig("GotOrderEMailFrom"), fromName: AppLogic.AppConfig("GotOrderEMailFromName"), toAddress: s.Trim(), toName: s.Trim(), bccAddresses: String.Empty, server: AppLogic.MailServer()); } } else { AppLogic.SendMail(subject: emailSubject, body: emailBody + AppLogic.AppConfig("MailFooter"), useHtml: true, fromAddress: AppLogic.AppConfig("GotOrderEMailFrom"), fromName: AppLogic.AppConfig("GotOrderEMailFromName"), toAddress: SendToList, toName: SendToList, bccAddresses: String.Empty, server: AppLogic.MailServer()); } } } catch { SysLog.LogMessage(String.Format("Your recurring order has been canceled. The original order number was: {0}", OriginalOrderNumber.ToString()), result, MessageTypeEnum.Informational, MessageSeverityEnum.Message); } } return(result); }
public string CancelPPECRecurringOrder(int OriginalOrderNumber, bool TriggeredByPayPal) { String result = AppLogic.ro_OK; Order originalOrder = new Order(OriginalOrderNumber); Customer customerToNotify = new Customer(originalOrder.CustomerID, true); //Cancel the recurring profile on PayPal's end if (TriggeredByPayPal == false) { result = PayPalController.CancelECRecurringProfile(OriginalOrderNumber); } if (result == AppLogic.ro_OK) { //Cancel the recurring profile in the cart DB.ExecuteSQL(String.Format("delete from kitcart where OriginalRecurringOrderNumber={0}", OriginalOrderNumber.ToString())); DB.ExecuteSQL(String.Format("delete from ShoppingCart where OriginalRecurringOrderNumber={0}", OriginalOrderNumber.ToString())); // now notify people of cancellation: try { // send email notification to customer string emailSubject = String.Format(AppLogic.GetString("recurringorder.canceled.subject", customerToNotify.SkinID, customerToNotify.LocaleSetting), AppLogic.AppConfig("StoreName")); string emailBody = String.Format(AppLogic.GetString("recurringorder.canceled.body", customerToNotify.SkinID, customerToNotify.LocaleSetting), OriginalOrderNumber.ToString()); AppLogic.SendMail(emailSubject, emailBody + AppLogic.AppConfig("MailFooter"), true, AppLogic.AppConfig("ReceiptEMailFrom"), AppLogic.AppConfig("ReceiptEMailFromName"), customerToNotify.EMail, customerToNotify.EMail, String.Empty, AppLogic.MailServer()); // send email notification to admin if (AppLogic.AppConfig("GotOrderEMailTo").Length != 0 && !AppLogic.AppConfigBool("TurnOffStoreAdminEMailNotifications")) { String SendToList = AppLogic.AppConfig("GotOrderEMailTo").Replace(",", ";"); if (SendToList.IndexOf(';') != -1) { foreach (String s in SendToList.Split(';')) { AppLogic.SendMail(emailSubject, emailBody + AppLogic.AppConfig("MailFooter"), true, AppLogic.AppConfig("GotOrderEMailFrom"), AppLogic.AppConfig("GotOrderEMailFromName"), s.Trim(), s.Trim(), String.Empty, AppLogic.MailServer()); } } else { AppLogic.SendMail(emailSubject, emailBody + AppLogic.AppConfig("MailFooter"), true, AppLogic.AppConfig("GotOrderEMailFrom"), AppLogic.AppConfig("GotOrderEMailFromName"), SendToList, SendToList, String.Empty, AppLogic.MailServer()); } } } catch { SysLog.LogMessage(String.Format(AppLogic.GetStringForDefaultLocale("recurringorder.canceled.body"), OriginalOrderNumber.ToString()), result, MessageTypeEnum.Informational, MessageSeverityEnum.Message); } } return(result); }