protected void BindData() { try { order = controller.LoadOrder(order_id); lblMessage1.Text = "Hello " + order.first_name + " " + order.last_name + " (" + order.email + ") , Thank you for shopping with myss.com - [" + order.date_created.ToShortDateString() + "]" ; lblMessage2.Text = "If you have any questions please e-mail at: "; gvShoppingCart.DataSource = order.OrderItems; gvShoppingCart.DataBind(); bool MediaExists = controller.IsReflectionWithMedia(order_id); if (MediaExists) { lblWebinarMessage.Visible = true; lblWebinarMessage2.Visible = true; } } catch (Exception ex) { throw ex; } }
public CMEDShopOrder LoadOrder(long order_id) { DB db = new DB(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "GetCMEDShopOrder"; cmd.Parameters.AddWithValue("@order_id", order_id); DataTable dt = db.Execute(cmd); DataRow dr = dt.Rows[0]; CMEDShopOrder order = new CMEDShopOrder { order_id = long.Parse(dr["order_id"].ToString()), customer_id = long.Parse(dr["customer_id"].ToString()), order_status = dr["order_status"].ToString(), email = dr["email"].ToString(), first_name = dr["first_name"].ToString(), last_name = dr["last_name"].ToString(), ip_address = dr["ip_address"].ToString(), ip_address_country_code = dr["ip_address_country_code"].ToString(), date_created = DateTime.Parse(dr["date_created"].ToString()), created_by = dr["created_by"].ToString(), date_updated = DateTime.Parse(dr["date_updated"].ToString()), updated_by = dr["updated_by"].ToString(), }; DB dbItems = new DB(); SqlCommand cmdItems = new SqlCommand(); cmdItems.CommandType = CommandType.StoredProcedure; cmdItems.CommandText = "GetCMEDShopOrderItems"; cmdItems.Parameters.AddWithValue("@order_id", order_id); DataTable dtItems = dbItems.Execute(cmdItems); foreach (DataRow drItems in dtItems.Rows) { CMEDShopOrderItem orderitem = new CMEDShopOrderItem { order_item_id = long.Parse(drItems["order_item_id"].ToString()), order_id = long.Parse(drItems["order_id"].ToString()), product_id = long.Parse(drItems["product_id"].ToString()), product_title = drItems["product_title"].ToString(), quantity = Int32.Parse(drItems["quantity"].ToString()), price = double.Parse(drItems["price"].ToString()), final_price = double.Parse(drItems["final_price"].ToString()), discount_code = drItems["discount_code"].ToString(), order_item_status = drItems["order_item_status"].ToString(), date_created = DateTime.Parse(drItems["date_created"].ToString()), created_by = drItems["created_by"].ToString(), date_updated = DateTime.Parse(drItems["date_updated"].ToString()), updated_by = drItems["updated_by"].ToString(), }; order.OrderItems.Add(orderitem); order.order_amount = order.order_amount + (decimal)orderitem.final_price; } return order; }
public static void SendOrderConfirmation(CMEDShopOrder order) { var InfoEmail = System.Configuration.ConfigurationManager.AppSettings["InfoEmail"]; var CustServiceEmail = System.Configuration.ConfigurationManager.AppSettings["CustServiceEmail"]; var TestInfoEmail = ConfigurationManager.AppSettings["TestInfoEmail"]; var TestCustServiceEmail = ConfigurationManager.AppSettings["TestCustServiceEmail"]; var ProductionURL = ConfigurationManager.AppSettings["ProductionURL"]; string body = getPageHtml(ProductionURL + "confirmation_email.aspx?oid=" + order.order_id); var isTest = Convert.ToBoolean(ConfigurationManager.AppSettings["IsTestMode"]); var IsTestEmailDelivery = Convert.ToBoolean(ConfigurationManager.AppSettings["IsTestEmailDelivery"]); var TestString = String.Empty; if (isTest) { TestString = " - Testing Please Ignore"; } if (IsTestEmailDelivery) { SendMail(order.email, TestCustServiceEmail, "Myss.com order confirmation: " + order.order_id + TestString + " [" + order.date_created.ToShortDateString() + "]", body, true); SendMail(TestCustServiceEmail, TestInfoEmail, "Myss.com order confirmation: " + order.order_id + TestString + " [" + order.date_created.ToShortDateString() + "]", body, true); } else { SendMail(order.email, CustServiceEmail, "Myss.com order confirmation: " + order.order_id.ToString() + " [" + order.date_created.ToShortDateString() + "]", body, true); SendMail(CustServiceEmail, InfoEmail, "New Myss.com Order: " + order.order_id.ToString() + " [" + order.date_created.ToShortDateString() + "]", body, true); } foreach (CMEDShopOrderItem i in order.OrderItems) { if (i.product_id == 228) { //send pnp emails var sb = new StringBuilder(); sb.Append("Hello ").Append(order.first_name).Append(" ").AppendLine(order.last_name); sb.AppendLine(); sb.Append("Thank you for your interest in our online \"PNP Course\""); sb.AppendLine(); sb.Append("Please use the link below to access the survey."); sb.AppendLine(); sb.Append("For your security, you will be asked to provide the email address you used at the time of your purchase"); sb.AppendLine(); sb.Append("If you leave your survey before completion, you will have to start from the beginning when you return."); sb.AppendLine(); sb.Append("Thank you for visiting myss.com!"); sb.AppendLine(); sb.AppendLine(); sb.Append("Live long and prosper!"); sb.AppendLine(); sb.AppendLine(); sb.Append("http://www.myss.com/pnp/login.asp"); sb.AppendLine(); sb.AppendLine(); sb.Append("If the above link is broken between two lines, please copy both into your browser."); SendMail(order.email, CustServiceEmail, "PNP Course", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "PNP Course", sb.ToString(), false); } if (i.product_id == 227) { //send Chii emails var sb = new StringBuilder(); sb.Append("Hello ").Append(order.first_name).Append(" ").AppendLine(order.last_name); sb.AppendLine(); sb.Append("Thank you for your interest in our online \"CHII Course\""); sb.AppendLine(); sb.Append("Please use the link below to access the survey."); sb.AppendLine(); sb.Append("For your security, you will be asked to provide the email address you used at the time of your purchase"); sb.AppendLine(); sb.Append("If you leave your survey before completion, you will have to start from the beginning when you return."); sb.AppendLine(); sb.Append("Thank you for visiting myss.com!"); sb.AppendLine(); sb.AppendLine(); sb.Append("Live long and prosper!"); sb.AppendLine(); sb.AppendLine(); sb.Append("http://www.myss.com/chii/login.asp"); sb.AppendLine(); sb.AppendLine(); sb.Append("If the above link is broken between two lines, please copy both into your browser."); SendMail(order.email, CustServiceEmail, "Checklist of Health Issues and Illness", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "Checklist of Health Issues and Illness", sb.ToString(), false); } if (i.product_id == 1725) { //send The Relationship Handbook emails var sb = new StringBuilder(); sb.Append("Hello ").Append(order.first_name).Append(" ").AppendLine(order.last_name); sb.AppendLine(); sb.Append("Thank you for your interest in our online \"The Relationship Handbook\""); sb.AppendLine(); sb.Append("Please use the link below to access the survey."); sb.AppendLine(); sb.Append("For your security, you will be asked to provide the email address you used at the time of your purchase"); sb.AppendLine(); sb.Append("If you leave your survey before completion, you will have to start from the beginning when you return."); sb.AppendLine(); sb.Append("Thank you for visiting myss.com!"); sb.AppendLine(); sb.AppendLine(); sb.Append("Live long and prosper!"); sb.AppendLine(); sb.AppendLine(); sb.Append("http://www.myss.com/Relationship/login.asp"); sb.AppendLine(); sb.AppendLine(); sb.Append("If the above link is broken between two lines, please copy both into your browser."); SendMail(order.email, CustServiceEmail, "The Relationship Handbook", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "The Relationship Handbook", sb.ToString(), false); sb = new StringBuilder(); sb.Append("Hello Philip"); sb.AppendLine(); sb.Append("Please note that " + order.email + " has purchased the:"); sb.AppendLine(); sb.Append("The Relationship Handbook"); sb.AppendLine(); sb.Append("They should be contacting you shortly with their information!"); sb.AppendLine(); sb.Append("CMED Store"); sb.AppendLine(); sb.AppendLine(); sb.Append("Order Num: " + order.order_id); var CalendarVendorEmail = Convert.ToString(ConfigurationManager.AppSettings["CalendarVendorEmail"]); SendMail(CalendarVendorEmail, CustServiceEmail, "The Relationship Handbook", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "The Relationship Handbook", sb.ToString(), false); } if (i.product_id == 1666) { //send The Lunar Life Cycle emails var sb = new StringBuilder(); sb.Append("Hello ").Append(order.first_name).Append(" ").AppendLine(order.last_name); sb.AppendLine(); sb.Append("Thank you for your interest in our online \"Lunar Life Cycle\""); sb.AppendLine(); sb.Append("Please use the link below to access the survey."); sb.AppendLine(); sb.Append("For your security, you will be asked to provide the email address you used at the time of your purchase"); sb.AppendLine(); sb.Append("If you leave your survey before completion, you will have to start from the beginning when you return."); sb.AppendLine(); sb.Append("Thank you for visiting myss.com!"); sb.AppendLine(); sb.AppendLine(); sb.Append("Live long and prosper!"); sb.AppendLine(); sb.AppendLine(); sb.Append("http://www.myss.com/lunar/login.asp"); sb.AppendLine(); sb.AppendLine(); sb.Append("If the above link is broken between two lines, please copy both into your browser."); SendMail(order.email, CustServiceEmail, "Lunar Life Cycle", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "Lunar Life Cycle", sb.ToString(), false); sb = new StringBuilder(); sb.Append("Hello Philip"); sb.AppendLine(); sb.Append("Please note that " + order.email + " has purchased the:"); sb.AppendLine(); sb.Append("Lunar Life Cycle"); sb.AppendLine(); sb.Append("They should be contacting you shortly with their information!"); sb.AppendLine(); sb.Append("CMED Store"); sb.AppendLine(); sb.AppendLine(); sb.Append("Order Num: " + order.order_id); var CalendarVendorEmail = Convert.ToString(ConfigurationManager.AppSettings["CalendarVendorEmail"]); SendMail(CalendarVendorEmail, CustServiceEmail, "Lunar Life Cycle", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "Lunar Life Cycle", sb.ToString(), false); } if (i.product_id == 1597) { //send Calendar of Archetypal Influences emails var sb = new StringBuilder(); sb.Append("Hello ").Append(order.first_name).Append(" ").AppendLine(order.last_name); sb.AppendLine(); sb.Append("Thank you for your interest in our online \"Calendar of Archetypal Influences\""); sb.AppendLine(); sb.Append("Please use the link below to access the survey."); sb.AppendLine(); sb.Append("For your security, you will be asked to provide the email address you used at the time of your purchase"); sb.AppendLine(); sb.Append("If you leave your survey before completion, you will have to start from the beginning when you return."); sb.AppendLine(); sb.Append("Thank you for visiting myss.com!"); sb.AppendLine(); sb.AppendLine(); sb.Append("Live long and prosper!"); sb.AppendLine(); sb.AppendLine(); sb.Append("http://www.myss.com/CalWin/login.asp"); sb.AppendLine(); sb.AppendLine(); sb.Append("If the above link is broken between two lines, please copy both into your browser."); SendMail(order.email, CustServiceEmail, "Calendar of Archetypal Influences", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "Calendar of Archetypal Influences", sb.ToString(), false); sb = new StringBuilder(); sb.Append("Hello Philip"); sb.AppendLine(); sb.Append("Please note that " + order.email + " has purchased the:"); sb.AppendLine(); sb.Append("Calendar of Archetypal Influences"); sb.AppendLine(); sb.Append("They should be contacting you shortly with their information!"); sb.AppendLine(); sb.Append("CMED Store"); sb.AppendLine(); sb.AppendLine(); sb.Append("Order Num: " + order.order_id); var CalendarVendorEmail = Convert.ToString(ConfigurationManager.AppSettings["CalendarVendorEmail"]); SendMail(CalendarVendorEmail, CustServiceEmail, "Calendar of Archetypal Influences", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "Calendar of Archetypal Influences", sb.ToString(), false); } if (i.product_id == 1598) { //send Cosmic Window Personal Astrological Appointment Calendar emails var sb = new StringBuilder(); sb.Append("Hello ").Append(order.first_name).Append(" ").AppendLine(order.last_name); sb.AppendLine(); sb.Append("Thank you for your interest in our online \"Cosmic Window Personal Astrological Appointment Calendar\""); sb.AppendLine(); sb.Append("Please use the link below to access the survey."); sb.AppendLine(); sb.Append("For your security, you will be asked to provide the email address you used at the time of your purchase"); sb.AppendLine(); sb.Append("If you leave your survey before completion, you will have to start from the beginning when you return."); sb.AppendLine(); sb.Append("Thank you for visiting myss.com!"); sb.AppendLine(); sb.AppendLine(); sb.Append("Live long and prosper!"); sb.AppendLine(); sb.AppendLine(); sb.Append("http://www.myss.com/CalWin/login.asp"); sb.AppendLine(); sb.AppendLine(); sb.Append("If the above link is broken between two lines, please copy both into your browser."); SendMail(order.email, CustServiceEmail, "Cosmic Window Personal Astrological Appointment Calendar", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "Cosmic Window Personal Astrological Appointment Calendar", sb.ToString(), false); sb = new StringBuilder(); sb.Append("Hello Philip"); sb.AppendLine(); sb.Append("Please note that " + order.email + " has purchased the:"); sb.AppendLine(); sb.Append("Cosmic Window Personal Astrological Appointment Calendar"); sb.AppendLine(); sb.Append("They should be contacting you shortly with their information!"); sb.AppendLine(); sb.Append("CMED Store"); sb.AppendLine(); sb.AppendLine(); sb.Append("Order Num: " + order.order_id); var CalendarVendorEmail = Convert.ToString(ConfigurationManager.AppSettings["CalendarVendorEmail"]); SendMail(CalendarVendorEmail, CustServiceEmail, "Cosmic Window Personal Astrological Appointment Calendar", sb.ToString(), false); SendMail(InfoEmail, CustServiceEmail, "Cosmic Window Personal Astrological Appointment Calendar", sb.ToString(), false); } } }