SendEmail() public method

public SendEmail ( string body ) : void
body string
return void
 public ActionResult CartDetails()
 {
     var oComm = new CommonModels();
     OrderVariables oVariables = new OrderVariables();
     ViewBag.fireFaceBookPixel = (Session["fireFaceBookPixel"] != null && Session["fireFaceBookPixel"].ToString() == "true") ? true : false;
     try
     {
         if (Session["NewOrderDetails"] != null)
         {
             oVariables = Session["NewOrderDetails"] as OrderVariables;
             if (oVariables != null)
             {
                 BindCartDetails();
                 AssignValuestoViewBag(2);
                 ViewBag.BillZipCode = oVariables.bill_to_zipcode;
             }
         }
     }
     catch (Exception ex)
     {
         oComm.SendEmail("Upsell Page 2 deals <br />Exception Raised from Upsell Page 2 deals. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
             + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
     }
     return View();
 }
        public DataTable Dynamic_Pixel(OrderVariables oVariables, string SPname, string pixcd)
        {
            CommonModels oComm = new CommonModels();
            dbConn.dbConnector.dbConn oDBConn;
            DataTable pixeltb = new DataTable();
            DataSet VpixData = new DataSet();
            try
            {
                //DBConn and SP execution
                oDBConn = new dbConn.dbConnector.dbConn();
                oDBConn.regKey = ConfigurationManager.AppSettings["SQLConn"].ToString();
                VpixData = oDBConn.ExecSPReturnSingleDS(SPname, pixcd);
                pixeltb = VpixData.Tables[0];
                return pixeltb;
            }
            catch (Exception ex)
            {
                oComm.SendEmail("Dynamic_Pixel() <br />Exception Raised from Confirmaiton Page in EM Landers. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): " + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
                return null;
            }
            finally
            {
                oDBConn = null;
                pixeltb = null;
                VpixData = null;

            }
        }
 public override void OnActionExecuted(ActionExecutedContext filterContext)
 {
     var redirectResult = filterContext.Result as RedirectToRouteResult;
     if (redirectResult == null)
     {
         return;
     }
     try
     {
         var query = HttpUtility.ParseQueryString(filterContext.HttpContext.Request.UrlReferrer.Query);
         foreach (string key in query.Keys)
         {
             if (!string.IsNullOrEmpty(key) && !redirectResult.RouteValues.ContainsKey(key))
             {
                 redirectResult.RouteValues.Add(key, query[key]);
             }
         }
     }
     catch (Exception ex)
     {
         string page_log = "Exception raised. Exception: " + ex.Message.ToString() + "<br>";
         CommonModels oCom = new CommonModels();
         string s = "";// oCom.LogBrowserCapabilities(Request.Browser);
         oCom.SendEmail(filterContext.HttpContext.Request.Url.ToString() + "<br>ex.message = " + ex.Message.ToString() + "<br> Additional Information - " + page_log + ".<br> Browser Details....<br>" + s);
         // return View();
     }
 }
Esempio n. 4
0
        public ActionResult Payment_399()
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["MonthList"] = UtilitiesModels.GetMonthNameList();
            ViewData["YearList"] = UtilitiesModels.GetCardExpiryYearList();

            OrderVariables oVariables = new OrderVariables();
            OrderProcess oProcess = new OrderProcess();
            CommonModels oComm = new CommonModels();

            string cart_details, conf_pg_tac, total = "";
            string shipall = "false";
            string template = "";
            string pixel = "";
            try
            {
                if (Session["NewSBMDetails"] != null)
                {
                    oVariables = (OrderVariables)Session["NewSBMDetails"];
                    Dictionary<string, string> d = oComm.GetOfferCreatives(oVariables);
                    ViewBag.HeaderImageSrc = oComm.GetDictionaryValue("payment_header", d);
                    if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                    if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                    string cartId = oVariables.cart_id.ToString();
                    conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                    cart_details = oComm.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                    total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                    ViewBag.IsBonusSelected = false;
                    if (oVariables.bonus_option == true)
                    {
                        ViewBag.IsBonusSelected = true;
                    }
                    ViewBag.CartSummary = cart_details;
                    ViewBag.Cart = cartId;
                    ViewBag.Total = total;
                    ViewBag.ConfPgTAC = conf_pg_tac;
                    return View();
                }
                else
                {
                    return RedirectToAction("Three_99", "Elmo", routeValues: ViewContextExtensions.OptionalParamters(Request.QueryString));
                }
            }
            catch (Exception ex)
            {
                oComm.SendEmail("Exception Raised in EM Landers Payment Page - " + ex.Message.ToString());
                return View();
            }
            finally
            {
                oComm = null;
                oVariables = null;
            }
        }
Esempio n. 5
0
        public ActionResult Confirmation()
        {
            OrderVariables oVariables = new OrderVariables();
            OrderProcess oProcess = new OrderProcess();
            CommonModels oComm = new CommonModels();
            string template = "";
            string shipall = "";
            string orderSummary = "";
            string shipping_address = "";
            string billing_address = "";

            try
            {
                if (Session["NewOrderDetails"] != null)
                {
                    oVariables = new OrderVariables();
                    oVariables = Session["NewOrderDetails"] as OrderVariables;
                    if (oVariables != null)
                    {
                        ViewBag.fireFaceBookConfirmationPixel = (Session["fireFaceBookConfirmationPixel"] == null || (Session["fireFaceBookConfirmationPixel"] != null && Session["fireFaceBookConfirmationPixel"].ToString() == "true")) ? true : false;
                        ViewBag.fireFaceBookUpsell2Pixel = (Session["fireFaceBookUpsell2Pixel"] != null && Session["fireFaceBookUpsell2Pixel"].ToString() == "true") ? true : false;
                        ViewBag.fireFaceBookUpsell1Pixel = (Session["fireFaceBookUpsell1Pixel"] != null && Session["fireFaceBookUpsell1Pixel"].ToString() == "true") ? true : false;
                        shipall = (string)Request.QueryString["shipall"] ?? "false";
                        ViewBag.product = oVariables.proj_desc;
                        ViewBag.special_text = oVariables.special_text;
                        ViewBag.order_id = oVariables.order_id.ToString();

                        ViewBag.amt = oVariables.total_amt.ToString();
                        ViewBag.Project = oVariables.project;
                        string CCNumber = oVariables.CCVars[0] != null ? oVariables.CCVars[0].number : "";

                        ViewBag.CreditCardNumber = EncryptCreditCard(CCNumber);
                        string ccExpiryDate = oVariables.CCVars[0] != null ? oVariables.CCVars[0].expdate : "";
                        ViewBag.CardExpiry = FormatCCExpiryDate(ccExpiryDate);
                        shipping_address = oComm.Confirmation_ShippingAddress(oVariables);
                        ViewBag.ShippingAddress = shipping_address;
                        billing_address = oComm.Confirmation_BillingAddress(oVariables, template);
                        ViewBag.BillingAddress = billing_address;

                        orderSummary = oComm.ResponsiveConfirmation_GiftingProducts(oVariables);

                        ViewBag.Cart = orderSummary;
                        string email = oVariables.email.ToString();
                        ViewBag.email = email;
                        if (!string.IsNullOrEmpty(email))
                        {
                            //ProcessConfirmationEmail(oVariables, shipping_address, billing_address, shipall);
                            //NewConfirmationEmailtoExpertSender(oVariables, shipping_address, billing_address, shipall);

                            BuildDynamicPixel(oVariables);

                            //internalPixel = "<img src='https://ping.earlymoments.com/conversion.ashx?o=" + oVariables.order_id + "&e=" + oVariables.email + "' width='1' height='1' border='0' /><iframe src='https://services.earlymoments.com/ping/p.ashx?source=7630&brand=e&data=" + oVariables.order_id.ToString() + "&type=ifr' height='1' width='1' frameborder='0'></iframe><br /><img src='https://services.earlymoments.com/ping/p.ashx?source=7630&brand=e&data=" + oVariables.order_id.ToString() + "&type=img' width='1' height='1' border='0' />";
                            //internalPixel = "<iframe src='https://services.earlymoments.com/ping/p.ashx?source=7630&brand=e&data=" + oVariables.order_id.ToString() + "&type=ifr' height='1' width='1' frameborder='0'></iframe><br /><img src='https://services.earlymoments.com/ping/p.ashx?source=7630&brand=e&data=" + oVariables.order_id.ToString() + "&type=img' width='1' height='1' border='0' />";
                            //Session["IsPostBack"] = true;

                            //if (!oVariables.vendor_id.Contains("QIN") && !oVariables.vendor_id.Contains("FLT"))
                            if (oVariables.hasOfferVid == 0)
                            {
                                FirePostBackPixel(oVariables);
                            }
                        }
                        //string[] campaignId = ConfigurationManager.AppSettings["CampaignId"] != null ? ConfigurationManager.AppSettings["CampaignId"].ToString().Split(',') : null;
                        //if (campaignId != null && campaignId.Contains(oVariables.campaign_id))
                        //    ConfirmAddressDetails(oVariables.ShipVars, oVariables.order_id);
                    }
                }
                return View();
            }
            catch (Exception ex)
            {
                oComm.SendEmail("Page_Load() <br />Exception Raised from Confirmaiton Page in EM Landers. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
                  + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
                return View();
            }
            finally
            {
                Session["NewOrderDetails"] = null;
                Session["fireFaceBookUpsell2Pixel"] = null;
                Session["fireFaceBookConfirmationPixel"] = null;
                Session["fireFaceBookPixel"] = null;
               oVariables = null;
                oComm = null;
                oProcess = null;
            }
        }
Esempio n. 6
0
        private void ProcessConfirmationEmail(OrderVariables oVariables, string ship_address, string bill_address, string shipall)
        {
            var oComm = new CommonModels();
            try
            {
                if (oVariables.order_id <= 0) return;
                var oProcess = new OrderEngine.OrderProcess();

                var tempBillFname = oVariables.bill_to_fname.Length > 0
                    ? oVariables.bill_to_fname.ToUpper().Substring(0, 1) +
                      oVariables.bill_to_fname.ToLower().Substring(1)
                    : "";
                string tempBillLname = oVariables.bill_to_lname.Length > 0
                    ? oVariables.bill_to_lname.ToUpper().Substring(0, 1) +
                      oVariables.bill_to_lname.ToLower().Substring(1)
                    : "";

                const string optoutText = "If you no longer want to receive this order, please click on the following link within 24 hours: <a href='http://www.earlymoments.com/optout'"
                                           +
                                           "target='_blank'>Cancel Order</a><br /><br />If you are unable to click on the above link, please copy and paste the below link"
                                           + " in the browser: http://www.earlymoments.com/optout<br /><br />";

                string projectSpecificText = "";

                if (oVariables.project.In("DBU"))
                {
                    projectSpecificText =
                        "<br><div style='background-color: Yellow; padding: 15px;'><strong>Your companion ebooks are waiting for you!</strong><br />Your Disney ebooks are available now through the official Early Moments " +
                        "<a href='https://services.earlymoments.com/ping/redirect.ashx?newUrl=https://itunes.apple.com/us/app/early-moments/id661335739?mt=8&source=7635&brand=e&data=!_OrderNumber_!&type=red'" +
                        " target='_blank'>iPad app</a>. Download the FREE Early Moments app from <a href='https://services.earlymoments.com/ping/redirect.ashx?newUrl=https://itunes.apple.com/us/app/early-moments/id661335739?mt=8&source=7635&brand=e&data=!_OrderNumber_!&type=red' target='_blank'>iTunes</a>, and follow the instructions to login for the first time.<br />" +
                        "<a href='https://services.earlymoments.com/ping/redirect.ashx?newUrl=https://itunes.apple.com/us/app/early-moments/id661335739?mt=8&source=7635&brand=e&data=!_OrderNumber_!&type=red' target='_blank'><img src='https://enrollments.earlymoments.com/assets/images/available_on_the_app_store.png' alt='Earlymoments.com' width='130' height='35' border='0' /></a>" +
                        "<br /><br />If you are not using an iPad, <a href='https://services.earlymoments.com/ping/redirect.ashx?newUrl=https://ebooks.earlymoments.com/default.aspx?src=cemail&source=7636&brand=e&data=!_OrderNumber_!&type=red' target='_blank'>click here</a> and follow the instructions to use our eReader.<br /></div>";

                    projectSpecificText = projectSpecificText.Replace("!_OrderNumber_!",
                        Convert.ToString(oVariables.order_id));
                }

                const string nonOptputText = "Visit us online at <a href='http://www.earlymoments.com' target='_blank'>www.EarlyMoments.com</a><br />";

                string tmpStr =
                    "<tr bgcolor='#eeeeee'><td style='width: 293px;'><div style='color: #333333; float: left;'><strong>Item Description</strong></div></td><td width='60px' valign='middle' align='right'><div style='color: #333333; float: left; display:table-cell; vertical-align:middle;'><strong>Item Price</strong></div></td></tr>";
                string space_column = "<tr height='5px''><td colspan='2'></td></tr>";

                foreach (OrderEngine.ShippingVariables oShipVars in oVariables.ShipVars)
                {
                    if (oShipVars.selected)
                    {
                        if ((oComm.OfferItemsDisplayType(oShipVars.OfferVars) > 1) ||
                            (oShipVars.OfferVars.Count == 1))
                        {
                            tmpStr = oShipVars.OfferVars.Aggregate(tmpStr,
                                (current, oOffers) =>
                                    current +
                                    ("<tr><td style='width: 293px;' valign='top' align='left'>" +
                                     oOffers.item_desc +
                                     "</td><td style='width: 60px;' valign='top' align='right'><div style='float: right; display:table-cell; vertical-align:middle;'>" +
                                     ((oOffers.item_cost == 0)
                                         ? ((oComm.GetPriceDisplayType(oOffers.oeprop, oOffers.item_cost) ==
                                             "")
                                             ? String.Format("{0:c}", oOffers.item_cost * oShipVars.quantity)
                                             : "<strong>" +
                                               oComm.GetPriceDisplayType(oOffers.oeprop, oOffers.item_cost) +
                                               "</strong>")
                                         : String.Format("{0:c}", oOffers.item_cost * oShipVars.quantity)) +
                                     "</div></td></tr>"));
                            tmpStr += space_column;
                        }
                        else
                        {
                            string tmpProdlist = oShipVars.OfferVars.Aggregate("",
                                (current, oOffers) => current + (oOffers.item_desc + "<br />"));
                            tmpStr += "<tr><td style='width: 293px;' valign='top' align='left'>" +
                                       tmpProdlist +
                                       "</td><td style='width: 60px;' valign='top' align='right'><div style='float: right; display:table-cell; vertical-align:middle;'>" +
                                       ((oShipVars.unit_price == 0)
                                           ? "<strong>FREE</strong>"
                                           : String.Format("{0:c}", oShipVars.unit_price * oShipVars.quantity)) +
                                       "</div></td></tr>";
                            tmpStr += space_column;
                        }
                    }
                }

                const string shipping = "<tr><td style='width: 293px;' valign='top' align='left'>Shipping and Handling</td><td style='width: 60px;' valign='top' align='right'><div style='float: right; display:table-cell; vertical-align:middle;'>!_ship_!</div></td></tr>";

                if (!oVariables.ship_item_listed)
                {
                    tmpStr += shipping.Replace("!_ship_!",
                        ((oVariables.total_sah == 0)
                            ? "<strong>FREE</strong>"
                            : String.Format("{0:c}", oVariables.total_sah)));
                }

                var pixel =
                    "<iframe src='https://services.earlymoments.com/ping/p.ashx?source=7629&brand=e&data=" +
                    oVariables.email.Trim() +
                    "&type=ifr' height='1' width='1' frameborder='0'></iframe><br /><img src='https://services.earlymoments.com/ping/p.ashx?source=7629&brand=e&data=" +
                    oVariables.email.Trim() + "&type=img' width='1' height='1' border='0' />";

                try
                {
                    oComm.ProcessConfirmationEmails(oVariables.email
                        , tempBillFname
                        , tempBillLname
                        , oVariables.proj_desc
                        , tmpStr
                        , oVariables.special_text
                        , (oVariables.opt_out == "Y" ? optoutText : nonOptputText)
                        , bill_address
                        , ship_address
                        , oVariables.order_id.ToString()
                        , pixel
                        , String.Format("{0:c}", oVariables.tax_amt)
                        ,
                        String.Format("{0:c}", oVariables.total_amt + oVariables.total_sah + oVariables.tax_amt)
                        , projectSpecificText);
                }
                catch (Exception ex)
                {
                    oComm.SendEmail("", "", "EM Confirmation Page: Important",
                        "Error while logging Confirmation email to Database - error: " + ex.Message.ToString(),
                        "");
                }
            }
            catch (Exception ex)
            {
                oComm.SendEmail("ProcessConfirmationEmail() <br />Exception Raised from Confirmaiton Page in EM Landers. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
                    + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
            }
        }
Esempio n. 7
0
        private void NewConfirmationEmailtoExpertSender(OrderVariables oVariables, string ship_address, string bill_address, string shipall)
        {
            StreamReader emailReader;
            var oComm = new CommonModels();
            try
            {
                if (oVariables.order_id <= 0) return;

                var filePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "assets\\emails\\newOC.txt";

                emailReader = new StreamReader(filePath);
                var emailHtml = emailReader.ReadToEnd();

                if (emailHtml.Length <= 0) return;

                var tempBillFname = oVariables.bill_to_fname.Length > 0
                    ? oVariables.bill_to_fname.ToUpper().Substring(0, 1) +
                      oVariables.bill_to_fname.ToLower().Substring(1)
                    : "";
                var tempBillLname = oVariables.bill_to_lname.Length > 0
                    ? oVariables.bill_to_lname.ToUpper().Substring(0, 1) +
                      oVariables.bill_to_lname.ToLower().Substring(1)
                    : "";

                string optoutText = @"<p style=""text-align:left; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:35px; margin-right:35px; margin-top:0px;  color:#1a5eab;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">If you no longer want to receive this order, please click on the following link within 24 hours: <a href='https://www.earlymoments.com/optout' target = '_blank' > Cancel Order </a><br /><br /> If you are unable to click on the above link, please copy and paste the below link in the browser: https://www.earlymoments.com/optout</span></p>";

                var projectSpecificText = string.Empty;
                if (oVariables.project.In("DBU"))
                {
                    projectSpecificText = @"<p style=""text-align:left; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:35px; margin-right:35px; margin-top:0px;  color:#1a5eab; background-color:yellow;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;""><span style=""font-size:18px; font-weight:bold;"">Your companion ebooks are waiting for you!</span><br />Your Disney ebooks are available now through the official Early Moments <a href='https://services.earlymoments.com/ping/redirect.ashx?newUrl=https://itunes.apple.com/us/app/early-moments/id661335739?mt=8&source=7635&brand=e&data=!_OrderNumber_!&type=red' target='_blank'>iPad app</a>. Download the FREE Early Moments app from <a href='https://services.earlymoments.com/ping/redirect.ashx?newUrl=https://itunes.apple.com/us/app/early-moments/id661335739?mt=8&source=7635&brand=e&data=!_OrderNumber_!&type=red' target='_blank'>iTunes</a>, and follow the instructions to login for the first time.<br /><br /><a href='https://services.earlymoments.com/ping/redirect.ashx?newUrl=https://itunes.apple.com/us/app/early-moments/id661335739?mt=8&source=7635&brand=e&data=!_OrderNumber_!&type=red' target='_blank'><img src='https://enrollments.earlymoments.com/assets/images/available_on_the_app_store.png' alt='Earlymoments.com' width='130' height='35' border='0' /></a><br /><br />If you are not using an iPad, <a href='https://services.earlymoments.com/ping/redirect.ashx?newUrl=https://ebooks.earlymoments.com/default.aspx?src=cemail&source=7636&brand=e&data=!_OrderNumber_!&type=red' target='_blank'>click here</a> and follow the instructions to use our eReader.<br /></span></p>";
                    projectSpecificText = projectSpecificText.Replace("!_OrderNumber_!", Convert.ToString(oVariables.order_id));
                }

                emailHtml = emailHtml.Replace("!_BillName_!", tempBillFname);
                emailHtml = emailHtml.Replace("!_OrderNumber_!", Convert.ToString(oVariables.order_id));

                var tmpStr = @"<table width=""90%"" border=""0"" cellspacing=""0"" cellpadding=""8""><tr bgcolor=""#9fbcd8""><td colspan=""2"" valign=""middle""><p style=""text-align:center; font-family:'Open Sans', Helvetica, tahoma; font-size:16px; line-height: 1.3; margin-left:0px;margin-right:0px; margin-top:0px; margin-bottom:0px;  color:#143884; font-weight:bold;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">ORDER SUMMARY</span></p></td></tr><tr><td width=""50%"" valign=""middle"" bgcolor=""#dbe6f0""><p style=""text-align:left; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:25px; margin-right:0px; margin-top:0px; margin-bottom:0px;  color:#1a5eab; font-weight:bold;"">Item</p></td><td align=""center"" valign=""middle"" bgcolor=""#dbe6f0""><p style=""text-align:center; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:5px; margin-right:5px; margin-top:0px; margin-bottom:0px;  color:#1a5eab;font-weight:bold;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">Price</span></p></td></tr>";

                var prod = oVariables.proj_desc;
                if (Convert.ToBoolean(shipall))
                {
                    prod += "<br>(<span style='font-size:9px;'>Will be shipped all at once</span>)";
                }

                foreach (var oShipVars in oVariables.ShipVars)
                {
                    if (oShipVars.selected)
                    {
                        if ((oComm.OfferItemsDisplayType(oShipVars.OfferVars) > 1) ||
                            (oShipVars.OfferVars.Count == 1))
                        {
                            foreach (var oOffers in oShipVars.OfferVars)
                            {
                                tmpStr += @"<tr><td width=""50%"" valign=""middle"" bgcolor=""#dbe6f0""><p style=""text-align:left; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:25px; margin-right:0px; margin-top:0px; margin-bottom:0px;  color:#1a5eab;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">"
                                          + oOffers.item_desc
                                          + @"</span></p></td><td align=""center"" valign=""middle"" bgcolor=""#dbe6f0""><p style=""text-align:center; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:5px; margin-right:5px; margin-top:0px; margin-bottom:0px; color:#c65696; font-weight: bold;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">" + ((oOffers.item_cost == 0) ? ((oComm.GetPriceDisplayType(oOffers.oeprop, oOffers.item_cost) == "") ? String.Format("{0:c}", oOffers.item_cost * oShipVars.quantity) : "<strong>" + oComm.GetPriceDisplayType(oOffers.oeprop, oOffers.item_cost) + "</strong>") : String.Format("{0:c}", oOffers.item_cost * oShipVars.quantity)) + @"</span></p></td></tr>";
                            }
                        }
                        else
                        {
                            string tmpProdlist = "";
                            foreach (var oOffers in oShipVars.OfferVars)
                            {
                                tmpProdlist += oOffers.item_desc + "<br />";
                            }
                            tmpStr += @"<tr><td width=""50%"" valign=""middle"" bgcolor=""#dbe6f0""><p style=""text-align:left; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:25px; margin-right:0px; margin-top:0px; margin-bottom:0px;  color:#1a5eab;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">"
                                      + tmpProdlist + @"</td><td align=""center"" valign=""middle"" bgcolor=""#dbe6f0""><p style=""text-align:center; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:5px; margin-right:5px; margin-top:0px; margin-bottom:0px;  color:#1a5eab;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">" + ((oShipVars.unit_price == 0) ? "<strong>FREE</strong>" : String.Format("{0:c}", oShipVars.unit_price * oShipVars.quantity)) + @"</span></p></td></tr>";
                        }
                    }
                }

                string shipping = @"<tr><td width=""50%"" valign=""top"" bgcolor=""#dbe6f0""><p style=""text-align:left; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:25px; margin-right:0px; margin-top:0px; margin-bottom:0px;  color:#1a5eab;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">Shipping &amp; Handling</span></p></td><td align=""center"" valign=""bottom"" bgcolor=""#dbe6f0""><p style=""text-align:center; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:5px; margin-right:5px; margin-top:0px; margin-bottom:0px;  color:#c65696;font-weight: bold;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">!_ship_!</span></p></td></tr>";

                if (!oVariables.ship_item_listed)
                {
                    tmpStr += shipping.Replace("!_ship_!",
                        ((oVariables.total_sah == 0)
                            ? "<strong>FREE</strong>"
                            : String.Format("{0:c}", oVariables.total_sah)));
                }

                string taxString = @"<tr><td width=""50%"" valign=""middle"" bgcolor=""#dbe6f0""><p style=""text-align:left; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:25px; margin-right:0px; margin-top:0px; margin-bottom:0px;  color:#1a5eab;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">Tax (estimated)</span></p></td><td align=""center"" valign=""middle"" bgcolor=""#dbe6f0""><p style=""text-align:center; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:5px; margin-right:5px; margin-top:0px; margin-bottom:0px;  color:#1a5eab;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">!_tax_!</span></p></td></tr>";
                tmpStr += taxString.Replace("!_tax_!", String.Format("{0:c}", oVariables.tax_amt));

                string grandTotalText = @"<tr bgcolor=""#9fbcd8""><td width=""50%"" valign=""middle""><p style=""text-align:left; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:25px; margin-right:0px; margin-top:0px; margin-bottom:10px;  color:#143884; font-weight:bold;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">GRAND TOTAL</span></p></td><td align=""center"" valign=""middle""><p style=""text-align:center; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:5px; margin-right:5px; margin-top:0px; margin-bottom:10px;  color:#143884; font-weight:bold;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;"">!_grandTotal_!</span></p></td></tr></table>";
                tmpStr += grandTotalText.Replace("!_grandTotal_!", String.Format("{0:c}", oVariables.total_amt + oVariables.total_sah + oVariables.tax_amt));

                emailHtml = emailHtml.Replace("!_item_list_!", tmpStr);
                emailHtml = emailHtml.Replace("!_Discount_!",
                    String.Format("{0:c}", oVariables.discount_amt));

                if (oVariables.discount_amt > 0)
                    emailHtml = emailHtml.Replace("!_hidden_!", "block");
                else
                    emailHtml = emailHtml.Replace("!_hidden_!", "none");

                emailHtml = emailHtml.Replace("!_Tax_!", String.Format("{0:c}", oVariables.tax_amt));
                emailHtml = emailHtml.Replace("!_GrandTotal_!",
                    String.Format("{0:c}", oVariables.total_amt + oVariables.total_sah + oVariables.tax_amt));
                emailHtml = emailHtml.Replace("!_ShipAddress_!", ship_address);
                emailHtml = emailHtml.Replace("!_BillAddress_!", bill_address);
                emailHtml = emailHtml.Replace("!_conf_pg_tac_!", oVariables.PageVars[0].conf_pg_tac);
                emailHtml = emailHtml.Replace("!_reward_code_!", "");
                emailHtml = emailHtml.Replace("!_special_text_!", oVariables.special_text);
                emailHtml = emailHtml.Replace("!_email_!", oVariables.email);

                string pixel =
                    "<iframe src='https://services.earlymoments.com/ping/p.ashx?source=7629&brand=e&data=" +
                    oVariables.email.Trim() +
                    "&type=ifr' height='1' width='1' frameborder='0'></iframe><br /><img src='https://services.earlymoments.com/ping/p.ashx?source=7629&brand=e&data=" +
                    oVariables.email.Trim() + "&type=img' width='1' height='1' border='0' />";
                emailHtml = emailHtml.Replace("!_link_!", pixel);

                emailHtml = emailHtml.Replace("*[tr_specialText]*", projectSpecificText);
                emailHtml = emailHtml.Replace("*[tr_optOutText]*", oVariables.opt_out == "Y" ? optoutText : "");
                emailHtml = emailHtml.Replace("*[tr_customerFirstName]*", tempBillFname);
                emailHtml = emailHtml.Replace("*[tr_orderSummary]*", tmpStr);
                emailHtml = emailHtml.Replace("*[tr_specialPromotionalText]*", "");
                emailHtml = emailHtml.Replace("*[tr_childName]*",
                    oVariables.ShipVars[oVariables.default_shp_id].child_fname.Trim().Length == 0
                        ? "your child"
                        : oVariables.ShipVars[oVariables.default_shp_id].child_fname);

                emailHtml = emailHtml.Replace("*[tr_orderNumber]*", oVariables.order_id.ToString());

                var adSpaceHTML = @"<p style=""text-align:left; font-family:'Open Sans', Helvetica, tahoma; font-size:14px; line-height: 1.3; margin-left:35px; margin-right:35px; margin-top:5px;  color:#1a5eab;""><span style=""font-family:'Open Sans', Helvetica, tahoma; !important;""><strong> ***NOTICE: This order qualifies for a CASH BACK REBATE!***&nbsp; <a href=""http://click.email.earlymoments.com/?qs=d4b5be4b2347ace6d8fe6a38c7b3bbfb0035b5c3bf0f285c63a0c9f929518fe74f384500f81401f5"" target=""_blank"">Click Here</a></strong></span></p>";
                emailHtml = emailHtml.Replace("*[tr_adSpace]*", adSpaceHTML);

                var expertSender = new ExpertSender();

                var subscriber = expertSender.AddSubscriber(oVariables.email, oVariables.bill_to_fname,
                    oVariables.bill_to_lname, oVariables.vendor_id, oVariables.ip_address, oVariables.order_id.ToString());
                ////Response.Write("subscriber: " + subscriber);

                ////string __email = ConfigurationManager.AppSettings["tempConfEmail"];
                var emailTran = expertSender.PrepareTransactionalEmail(oVariables.email, emailHtml, oVariables.order_id.ToString(), oVariables.proj_desc);
                ////Response.Write("emailTran: " + emailTran);
            }
            catch (Exception ex)
            {
                oComm.SendEmail("New-ProcessConfirmationEmail() <br />Exception Raised from Confirmaiton Page in EM Landers. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
                    + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
            }
        }
Esempio n. 8
0
        private void BuildDynamicPixel(OrderVariables oVariables)
        {
            CommonModels oComm = new CommonModels();
            string vendor_tracking = "";
            string aff_id = "";
            string aff_id2 = "";

            string finalpixel = string.Empty;
            DataTable pixeltb = new DataTable();
            DataTable vendparamstb = new DataTable();
            string pixelstring = string.Empty;

            if (oVariables.vendor_id.ToString().Trim().Length == 4)
            {
                try
                {

                    pixeltb = Dynamic_Pixel(oVariables, "get_vndr_details", oVariables.vendor_id.ToString().Trim().ToUpper());
                    //Building Pixel
                    if (pixeltb != null && pixeltb.Rows.Count > 0 && pixeltb.Rows[0]["pixel_hardcoded"].ToString().Trim() == "N")
                    {
                        vendparamstb = Dynamic_Pixel(oVariables, "GetVendorPixelData", oVariables.vendor_id.ToString().Trim().ToUpper());
                        //Raw Pixel
                        pixelstring = pixeltb.Rows[0]["pixel"].ToString().Trim();
                        if (vendparamstb != null && vendparamstb.Rows.Count >= 1)
                        {
                            string[] vendor_var = new string[vendparamstb.Rows.Count];
                            string[] sys_var = new string[vendparamstb.Rows.Count];

                            int i = 0;
                            foreach (DataRow dr in vendparamstb.Rows)
                            {
                                try
                                {
                                    vendor_var[i] = dr["vendor_var"].ToString().Trim();
                                    sys_var[i] = dr["system_var"].ToString().Trim();
                                    i = i + 1;
                                }
                                catch (Exception ex)
                                {
                                    oComm.SendEmail("BuildDynamicPixel() <br />Exception Raised from Confirmaiton Page in EM Landers. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
                                        + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
                                }
                            }

                            //pixelstring = pixeltb.Rows[0]["pixel"].ToString().Trim();
                            if (((string)Request.QueryString["tracking"]) != null) { vendor_tracking = ((string)Request.QueryString["tracking"]).ToString().Trim(); }
                            if (((string)Request.QueryString["aff_id"]) != null) { aff_id = ((string)Request.QueryString["aff_id"]).ToString().Trim(); }
                            if (((string)Request.QueryString["aff_id2"]) != null) { aff_id2 = ((string)Request.QueryString["aff_id2"]).ToString().Trim(); }

                            double base_amt = 0.00;

                            foreach (OrderEngine.ShippingVariables oShipVars in oVariables.ShipVars)
                                if (oShipVars.selected && oShipVars.offer_type.In("B", "O"))
                                    foreach (OrderEngine.OfferProperties oOffers in oShipVars.OfferVars)
                                        base_amt += oOffers.item_cost;

                            for (int j = 0; j < sys_var.Length; j++)
                            {

                                switch (sys_var[j].Trim())
                                {
                                    //[vendor_tracking]
                                    case "VDT":
                                        pixelstring = pixelstring.Replace(vendor_var[j], vendor_tracking);
                                        break;
                                    //[order_id]
                                    case "OID":
                                        pixelstring = pixelstring.Replace(vendor_var[j], oVariables.order_id.ToString());
                                        break;
                                    //[aff_id]
                                    case "AFI1":
                                        pixelstring = pixelstring.Replace(vendor_var[j], aff_id);
                                        break;
                                    //[aff_id2]
                                    case "AFI2":
                                        pixelstring = pixelstring.Replace(vendor_var[j], aff_id2);
                                        break;
                                    //[email]
                                    case "EMA":
                                        pixelstring = pixelstring.Replace(vendor_var[j], oVariables.email.ToString());
                                        break;
                                    //[promotion_code]
                                    case "PRC":
                                        pixelstring = pixelstring.Replace(vendor_var[j], oVariables.promotion_code.ToString());
                                        break;
                                    //[SubTotal]
                                    case "SUBTO":
                                        pixelstring = pixelstring.Replace(vendor_var[j], (oVariables.total_amt - oVariables.tax_amt).ToString());
                                        break;
                                    //[total_amt]
                                    case "TOA":
                                        pixelstring = pixelstring.Replace(vendor_var[j], oVariables.total_amt.ToString());
                                        break;
                                    case "BAMT":
                                        pixelstring = pixelstring.Replace(vendor_var[j], base_amt.ToString());
                                        break;
                                    case "PRJ":
                                        pixelstring = pixelstring.Replace(vendor_var[j], oVariables.project);
                                        break;
                                    default:
                                        break;
                                }
                            }
                        }
                    }
                    else if (pixeltb.Rows[0]["isPostBack"].ToString().Trim() == "N")
                    {
                        vendparamstb = null;
                        //Raw Pixel
                        pixelstring = pixeltb.Rows[0]["pixel"].ToString().Trim();
                    }

                }
                catch (Exception ex)
                {
                    oComm.SendEmail("BuildDynamicPixel() <br />Exception Raised from Confirmaiton Page in EM Landers. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
                        + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
                }
            }
            else
            {
                pixelstring = "";
            }
        }
Esempio n. 9
0
        public int UpdateOrderDetails(string OrderId, string StreetAddress1, string StreetAddress2, string City, string StateCode, string ZipCode)
        {
            CommonModels oComm = new CommonModels();
            int result = 0;
            try
            {
                if (Session["ConfirmationTokenId"]!=null && Session["ConfirmationTokenId"].ToString() == "F1BD018E50F043D58B88B4A216B8523F")
                {
                    string SQLString = System.Configuration.ConfigurationManager.AppSettings["SQLConn"].ToString();
                    dbConn.dbConnector.dbConn oDBConn = new dbConn.dbConnector.dbConn();
                    oDBConn.regKey = SQLString;
                    if (string.IsNullOrEmpty(StreetAddress2))
                        StreetAddress2 = string.Empty;
                    result = oDBConn.ExecSPReturnInteger("UPDATEOrderDetails", OrderId,StreetAddress1, StreetAddress2, City,StateCode,ZipCode,result);
                    if(result==0)
                    {
                        string subject = ConfigurationManager.AppSettings["OrderSubject"] != null ? (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["OrderSubject"].ToString()) ? ConfigurationManager.AppSettings["OrderSubject"].ToString() : "Shippment Address change after Order exported to AS 400: " + OrderId) : "Shippment Address change after Order exported to AS 400: " + OrderId;
                        string To = ConfigurationManager.AppSettings["OrderTo"] != null ? ConfigurationManager.AppSettings["OrderTo"].ToString() : "*****@*****.**";
                        string From = ConfigurationManager.AppSettings["OrderFrom"] != null ? ConfigurationManager.AppSettings["OrderFrom"].ToString() : "*****@*****.**";
                        string body = string.Empty;
                        if (!string.IsNullOrEmpty(StreetAddress2))
                            body = "Address change requested:  <br /> <br /> StreetAddress1: " + StreetAddress1 + ", <br /> StreetAddress2: " + StreetAddress2 + ", <br /> City: " + City + ", <br /> State: " + StateCode + ", <br /> ZipCode: " + ZipCode + ". <br /> Order Id: " + OrderId;
                        else
                            body = "Address change requested: <br /> <br />  StreetAddress1: " + StreetAddress1 + ", <br /> City: " + City + ", <br /> State: " + StateCode + ", <br /> ZipCode: " + ZipCode + ". <br /> Order Id: " + OrderId;

                        oComm.SendEmail(subject, body, To, From);
                    }
                }
                return result;
            }
            catch (Exception ex)
            {

                throw;
            }
        }
        public ActionResult Four_for_99(FormCollection form, ShippingModels.ShoppingOrder shipping, string[] SelectedBooks)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["GenderList"] = UtilitiesModels.GetChildGenderNameList();
            ViewData["MonthList"] = UtilitiesModels.GetMonthNameList();
            ViewData["YearList"] = UtilitiesModels.GetCardExpiryYearList();
            OrderProcess oProcess = new OrderProcess();
            CommonMethods oComm = new CommonMethods();
            OrderVariables oVariables = new OrderVariables();
            try
            {
                if (shipping.isBillingSameToShipping)
                {
                    shipping.BillingFirstName = shipping.ShippingFirstName;
                    shipping.BillingLastName = shipping.ShippingLastName;
                    shipping.BillingAddress1 = shipping.ShippingAddress1;
                    shipping.BillingCity = shipping.ShippingCity;
                    shipping.BillingZipCode = shipping.ShippingZipCode;
                    shipping.CCBillZipCode = shipping.BillingZipCode;
                }

                if (ModelState.IsValid == false)
                {
                    var message = string.Join("<br/>", ModelState.Values
                        .SelectMany(v => v.Errors)
                        .Select(e => e.ErrorMessage));
                    ViewBag.ErrorMsg = message.ToString();
                    return View();
                }

                oVariables = oProcess.GetOfferAndPageDetails("fosina-disney-4for99-secure");

                if ((string)Request.QueryString["vendorcode"] != null) { oVariables.vendor_id = (string)Request.QueryString["vendorcode"]; }
                if ((string)Request.QueryString["key"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["key"]; }
                if ((string)Request.QueryString["vc"] != null) { oVariables.vendor_id = (string)Request.QueryString["vc"]; }
                if ((string)Request.QueryString["pc"] != null) { oVariables.promotion_code = (string)Request.QueryString["pc"]; }
                if ((string)Request.QueryString["aff_id"] != null) { oVariables.vendor_data1 = (string)Request.QueryString["aff_id"]; } if ((string)Request.QueryString["tracking"] != null) { oVariables.vendor_cust_ref_id = (string)Request.QueryString["tracking"]; }
                if ((string)Request.QueryString["src"] != null) { oVariables.pcode_pos_8 = (string)Request.QueryString["src"]; }
                if ((string)Request.QueryString["seg"] != null) { oVariables.pcode_segment = (string)Request.QueryString["seg"]; } if ((string)Request.QueryString["aff_id2"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["aff_id2"]; }
                oVariables.referring_url = System.Web.HttpContext.Current.Request.Url.ToString();

                oVariables = ShippingModels.AssignShoppingDetailsToOrderVariable(oVariables, shipping);
                string choiceBooks = string.Join(",", SelectedBooks);

                if (!string.IsNullOrEmpty(choiceBooks))
                {
                    oVariables.has_shopping_Cart = true;
                    oVariables.shopping_cart_items = choiceBooks;
                }

                //Submitting shipping details to order engin for order process
                //Code commented for passing to payment page.
                oVariables = oProcess.OrderSubmit(oVariables);
                if (oVariables != null)
                {
                    if (oVariables.order_id > 0)
                    {
                        Session.Add("NewOrderDetails", oVariables);
                        return RedirectToAction("Confirmation", "Home");
                    }
                    else
                    {
                        if (oVariables.err.Length >= 0)
                        {
                            if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                            {
                                //   page_log += "Order is NOT processed with Order Status X or F. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                //  Response.Redirect("../orderstatus.aspx" + oComm.GetURIString(), false);
                                // HttpContext.Current.ApplicationInstance.CompleteRequest();
                                return RedirectToAction("orderstatus", "Home");
                            }
                            else if (oVariables.err.Length > 0)
                            {
                                //  page_log += "Order is NOT processed with an ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                //  lblErrorMsg.Text = oVariables.err;
                                //  oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                //  string error_msg = string.Empty;
                                //  error_msg = "alert('" + oVariables.err + "')";
                                //  ScriptManager.RegisterStartupScript(this, this.GetType(), "client_error", error_msg, true);
                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                            else if ((oVariables.order_status == "N") || (oVariables.redirect_page.Length > 0))
                            {
                                //  page_log += "Order is NOT processed with NO ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                Session.Add("NewSBMDetails", oVariables);
                                //   Response.Redirect("../" + oVariables.redirect_page + oComm.GetURIString() + "&template=club", false);
                                //   HttpContext.Current.ApplicationInstance.CompleteRequest();
                                return RedirectToAction("Payment4_for_99", "Disney");
                            }
                            else
                            {
                                /* page_log += "Order is NOT processed with YES ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                 lblErrorMsg.Text = oVariables.err;
                                 oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                 string error_msg = string.Empty;
                                 error_msg = "alert('" + oVariables.err + "')";
                                 ScriptManager.RegisterStartupScript(this, this.GetType(), "client_error", error_msg, true); */

                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                        }
                    }
                }
                else
                {
                    //page_log += "Order is NOT processed, Order Process returned NULL.<br>";
                    Session["NewSBMDetails"] = null;
                    return RedirectToAction("orderstatus", "Home");
                }
                //ends Submitting shipping details to order engin for order process
                //Session["NewSBMDetails"] = oVariables;
                //Session["ShippingDetails"] = oVariables;
                //return RedirectToAction("Payment4_for_1", "Seuss");
            }
            catch (Exception ex)
            {
                string page_log = "Exception raised. Exception: " + ex.Message.ToString() + "<br>";
                CommonModels oCom = new CommonModels();
                string s = "";// oCom.LogBrowserCapabilities(Request.Browser);
                oCom.SendEmail(HttpContext.Request.Url.ToString() + "<br>ex.message = " + ex.Message.ToString() + "<br> Additional Information - " + page_log + ".<br> Browser Details....<br>" + s);
                return View();
            }
            finally
            {
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
            return View();
        }
Esempio n. 11
0
        public ActionResult four_for_1_spring2(string SubmitButton, FormCollection form, ShippingModels.ShippingBillingOrder shipping)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["GenderList"] = UtilitiesModels.GetChildGenderNameList();
            ViewData["MonthList"] = UtilitiesModels.GetMonthNameList();
            ViewData["YearList"] = UtilitiesModels.GetCardExpiryYearList();
            OrderProcess oProcess = new OrderProcess();
            CommonMethods oComm = new CommonMethods();
            CommonModels oCom = new CommonModels();
            OrderVariables oVariables = new OrderVariables();
            string cart_details, conf_pg_tac, total = "";
            string shipall = "false";
            string template = "";
            string pixel = "";
            try
            {
                if (!string.IsNullOrEmpty(SubmitButton))
                {
                    switch (SubmitButton.ToLower())
                    {
                        case "rush my books":
                            oVariables = oProcess.GetOfferAndPageDetails("fosina-seuss-4for1-secure-activity");
                            shipping.stepNumber = 1;
                            var offerService = new OfferService();
                            oVariables = offerService.MapQueryStringToOrderVariables(oVariables: oVariables);
                            oVariables = ShippingModels.AssignShippingBillingToOrderVariables(oVariables, shipping);
                            oVariables = oProcess.OrderSubmit(oVariables);
                            if (oVariables != null)
                            {
                                if (oVariables.order_id > 0)
                                {
                                    Session.Add("NewOrderDetails", oVariables);
                                    if (oVariables.upsellId != 0)
                                    {
                                        Session["fireFaceBookConfirmationPixel"] = "false";
                                        return RedirectToAction("OrderDetails", "AdditionalOffers");
                                    }
                                    else
                                    {
                                        Session["fireFaceBookConfirmationPixel"] = "true";
                                        return RedirectToAction("Confirmation", "Home");
                                    }
                                }
                                else
                                {
                                    if (oVariables.err.Length >= 0)
                                    {
                                        if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                                        {
                                            Session.Add("NewOrderDetails", oVariables);
                                            return RedirectToAction("orderstatus", "Home");
                                        }
                                        else if (oVariables.err.Length > 0)
                                        {
                                            ViewBag.ErrorMsg = oVariables.err;
                                            oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                        }
                                        else if ((oVariables.order_status == "N") || (oVariables.redirect_page.Length > 0))
                                        {
                                            Session.Add("NewSBMDetails", oVariables);
                                            shipping.stepNumber = 2;
                                            #region LoadPaymentSection
                                            try
                                            {
                                                if (Session["NewSBMDetails"] != null)
                                                {
                                                    oVariables = (OrderVariables)Session["NewSBMDetails"];
                                                    Dictionary<string, string> d = oCom.GetOfferCreatives(oVariables);
                                                    ViewBag.HeaderImageSrc = oComm.GetDictionaryValue("payment_header", d);
                                                    if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                                                    if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                                                    string cartId = oVariables.cart_id.ToString();
                                                    conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                                                    cart_details = oCom.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                                                    total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                                                    ViewBag.IsBonusSelected = false;
                                                    if (oVariables.bonus_option == true)
                                                    {
                                                        ViewBag.IsBonusSelected = true;
                                                    }
                                                    ViewBag.CartSummary = cart_details;
                                                    ViewBag.Cart = cartId;
                                                    ViewBag.Total = total;
                                                    ViewBag.ConfPgTAC = conf_pg_tac;
                                                    return View();
                                                }
                                                else
                                                {
                                                    return RedirectToAction("four_for_1_spring", "seuss", routeValues: ViewContextExtensions.OptionalParamters(Request.QueryString));
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                oCom.SendEmail("Exception Raised in EM Landers Payment Page - " + ex.Message.ToString());
                                                return View();
                                            }
                                            finally
                                            {
                                                oComm = null;
                                                oVariables = null;
                                            }
                                            #endregion
                                        }
                                        else
                                        {
                                            ViewBag.ErrorMsg = oVariables.err;
                                            oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                        }
                                    }
                                }
                            }
                            else
                            {
                                //page_log += "Order is NOT processed, Order Process returned NULL.<br>";
                                Session["NewSBMDetails"] = null;
                                return RedirectToAction("orderstatus", "Home");
                            }
                            break;

                        case "submit order":
                            #region Payment Submit
                            if (!string.IsNullOrEmpty(shipping.SecurityCaptch) && Session["rndtext"] != null)
                            {
                                string strCaptch = Session["rndtext"] as string;
                                if (!strCaptch.Equals(shipping.SecurityCaptch))
                                {
                                    ViewBag.ErrorMsg = "Invalid Security Captch.";
                                    // return View();
                                }
                            }
                            else
                            {
                                //if (string.IsNullOrEmpty(billing.SecurityCaptch))
                                //{
                                ViewBag.ErrorMsg = "Security Captch is required.";
                                // return View();
                                //}
                            }

                            if (Session["ShippingDetails"] != null)
                                oVariables = Session["ShippingDetails"] as OrderVariables;

                            try
                            {
                                if (Session["NewSBMDetails"] != null)
                                {
                                    oVariables = (OrderVariables)Session["NewSBMDetails"];

                                    if (oVariables != null)
                                    {
                                        if (ViewBag.ErrorMsg != null && ViewBag.ErrorMsg != "")
                                        {
                                            //Setting values if page is getting back to the payment view only.
                                            Dictionary<string, string> d = oCom.GetOfferCreatives(oVariables);
                                            ViewBag.HeaderImageSrc = oCom.GetDictionaryValue("payment_header", d);
                                            if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                                            if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                                            string cartId = oVariables.cart_id.ToString();
                                            conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                                            cart_details = oCom.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                                            total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                                            ViewBag.IsBonusSelected = false;
                                            if (oVariables.bonus_option == true)
                                            {
                                                ViewBag.IsBonusSelected = true;
                                            }
                                            ViewBag.CartSummary = cart_details;
                                            ViewBag.Cart = cartId;
                                            ViewBag.Total = total;
                                            ViewBag.ConfPgTAC = conf_pg_tac;
                                            // billing.SecurityCaptch = "";
                                            // ViewData.Model = billing;
                                            //return View(ViewData.Model);
                                            return View();
                                        }

                                        shipping.stepNumber = 2;
                                        oVariables = ShippingModels.AssignShippingBillingToOrderVariables(oVariables, shipping);
                                        oVariables = oProcess.OrderSubmit(oVariables);
                                        if (oVariables != null)
                                        {
                                            if (oVariables.order_id > 0)
                                            {
                                                Session["NewSBMDetails"] = null;
                                                Session.Add("NewOrderDetails", oVariables);
                                                if (oVariables.upsellId != 0)
                                                {
                                                    Session["fireFaceBookConfirmationPixel"] = "false";
                                                    return RedirectToAction("OrderDetails", "AdditionalOffers");
                                                }
                                                else
                                                {
                                                    Session["fireFaceBookConfirmationPixel"] = "true";
                                                    return RedirectToAction("Confirmation", "Home");
                                                }
                                            }
                                            else
                                            {
                                                if (oVariables.err.Length > 0)
                                                {
                                                    if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                                                    {
                                                        Session["NewSBMDetails"] = null;
                                                        Session.Add("NewOrderDetails", oVariables);
                                                        return RedirectToAction("orderstatus", "Home");
                                                    }
                                                    else
                                                    {
                                                        Session.Add("NewSBMDetails", oVariables);
                                                        ViewBag.ErrorMsg = oVariables.err;
                                                        oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                                    }
                                                }
                                                else if (oVariables.isSoftDeclined)
                                                {
                                                    Session["NewSBMDetails"] = null;
                                                    return RedirectToAction("ThankYou", "home");
                                                }
                                                //Setting values if page is getting back to the payment view only.
                                                Dictionary<string, string> d = oCom.GetOfferCreatives(oVariables);
                                                ViewBag.HeaderImageSrc = oComm.GetDictionaryValue("payment_header", d);
                                                if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                                                if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                                                string cartId = oVariables.cart_id.ToString();
                                                conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                                                cart_details = oCom.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                                                total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                                                ViewBag.IsBonusSelected = false;
                                                if (oVariables.bonus_option == true)
                                                {
                                                    ViewBag.IsBonusSelected = true;
                                                }
                                                ViewBag.CartSummary = cart_details;
                                                ViewBag.Cart = cartId;
                                                ViewBag.Total = total;
                                                ViewBag.ConfPgTAC = conf_pg_tac;
                                            }
                                        }
                                        else
                                        {
                                            return RedirectToAction("orderstatus", "Home");
                                        }
                                    }
                                    return View();
                                }
                                else
                                {
                                    return RedirectToAction("four_for_1_spring2", "seuss", routeValues: ViewContextExtensions.OptionalParamters(Request.QueryString));
                                }

                            }
                            catch (Exception ex)
                            {
                                oCom.SendEmail("Exception Raised in EM Landers Payment Page (Submit) - " + ex.Message.ToString());
                                return View();
                            }
                            finally
                            {
                                oComm = null;
                                oVariables = null;
                                oProcess = null;
                            }
                            #endregion
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                string page_log = "Exception raised. Exception: " + ex.Message.ToString() + "<br>";
                string s = "";// oCom.LogBrowserCapabilities(Request.Browser);
                oCom.SendEmail(HttpContext.Request.Url.ToString() + "<br>ex.message = " + ex.Message.ToString() + "<br> Additional Information - " + page_log + ".<br> Browser Details....<br>" + s);
                return View();
            }
            finally
            {
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
            return View();
        }
Esempio n. 12
0
        private void ProcessConfirmationEmail(OrderVariables oVariables, string ship_address, string bill_address, string shipall)
        {
            StreamReader emailReader;
            OrderProcess oProcess = new OrderEngine.OrderProcess();
            CommonModels oComm = new CommonModels();
            try
            {
                if (oVariables.order_id > 0)
                {
                    string emailHTML = "";

                    if (oVariables.email_template == "4")
                    {
                        oProcess.ProcessConfirmationEmails(oVariables);
                    }
                    else
                    {
                        string tmp = oProcess.BuildConfirmationEmail(oVariables.email_template);

                        if (tmp.Trim().Length == 0) { tmp = "general.htm"; }

                        //string filePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "assets\\emails\\" + tmp;
                        string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Assets\emails\" + tmp);
                        emailReader = new StreamReader(filePath);
                        emailHTML = emailReader.ReadToEnd();
                        if (emailHTML.Length > 0)
                        {
                            string temp_bill_fname = oVariables.bill_to_fname.Length > 0 ? oVariables.bill_to_fname.ToUpper().Substring(0, 1) + oVariables.bill_to_fname.ToLower().Substring(1) : "";
                            string temp_bill_lname = oVariables.bill_to_lname.Length > 0 ? oVariables.bill_to_lname.ToUpper().Substring(0, 1) + oVariables.bill_to_lname.ToLower().Substring(1) : "";

                            string non_optput_text = "Visit us online at <a href='https://www.earlymoments.com' target='_blank'>www.earlymoments.com</a><br />";

                            emailHTML = emailHTML.Replace("!_spl_optout_text_!", non_optput_text);

                            emailHTML = emailHTML.Replace("!_BillName_!", temp_bill_fname);
                            emailHTML = emailHTML.Replace("!_OrderNumber_!", Convert.ToString(oVariables.order_id));

                            string tmp_str = "<tr bgcolor='#eeeeee'><td style='width: 293px;'><div style='color: #333333; float: left;'><strong>Item Description</strong></div></td><td width='60px' valign='middle' align='right'><div style='color: #333333; float: left; display:table-cell; vertical-align:middle;'><strong>Item Price</strong></div></td></tr>";
                            string space_column = "<tr height='5px''><td colspan='2'></td></tr>";

                            string prod = oVariables.proj_desc;

                            if (Convert.ToBoolean(shipall)) { prod += "<br>(<span style='font-size:9px;'>Will be shipped all at once</span>)"; }

                            tmp_str += "<tr><td style='width: 293px;' valign='top' align='left'>" + prod + "</td><td style='width: 60px;' valign='top' align='right'><div style='float: right; display:table-cell; vertical-align:middle;'>" + ((oVariables.ShipVars[0].unit_price == 0) ? "<strong>FREE</strong>" : String.Format("{0:c}", oVariables.ShipVars[0].unit_price)) + "</div></td></tr>";

                            string shipping = "<tr><td style='width: 293px;' valign='top' align='left'>Shipping and Handling</td><td style='width: 60px;' valign='top' align='right'><div style='float: right; display:table-cell; vertical-align:middle;'>!_ship_!</div></td></tr>";

                            if (!oVariables.ship_item_listed) { tmp_str += shipping.Replace("!_ship_!", ((oVariables.total_sah == 0) ? "<strong>FREE</strong>" : String.Format("{0:c}", oVariables.total_sah))); }

                            emailHTML = emailHTML.Replace("!_item_list_!", tmp_str);
                            emailHTML = emailHTML.Replace("!_Discount_!", String.Format("{0:c}", oVariables.discount_amt));

                            if (oVariables.discount_amt > 0)
                                emailHTML = emailHTML.Replace("!_hidden_!", "block");
                            else
                                emailHTML = emailHTML.Replace("!_hidden_!", "none");

                            emailHTML = emailHTML.Replace("!_Tax_!", String.Format("{0:c}", oVariables.tax_amt));
                            emailHTML = emailHTML.Replace("!_GrandTotal_!", String.Format("{0:c}", oVariables.total_amt + oVariables.total_sah + oVariables.tax_amt));
                            emailHTML = emailHTML.Replace("!_ShipAddress_!", ship_address);
                            emailHTML = emailHTML.Replace("!_BillAddress_!", bill_address);
                            emailHTML = emailHTML.Replace("!_conf_pg_tac_!", oVariables.PageVars[0].conf_pg_tac);
                            emailHTML = emailHTML.Replace("!_reward_code_!", "");
                            emailHTML = emailHTML.Replace("!_special_text_!", oVariables.special_text);
                            emailHTML = emailHTML.Replace("!_email_!", oVariables.email);

                            string pixel = "<iframe src='https://services.earlymoments.com/ping/p.ashx?source=7629&brand=e&data=" + oVariables.email.Trim() + "&type=ifr' height='1' width='1' frameborder='0'></iframe><br /><img src='https://services.earlymoments.com/ping/p.ashx?source=7629&brand=e&data=" + oVariables.email.Trim() + "&type=img' width='1' height='1' border='0' />";
                            emailHTML = emailHTML.Replace("!_link_!", pixel);
                            if ((oVariables.bill_to_fname.ToLower().Trim() == "xyz") && (oVariables.bill_to_lname.ToLower().Trim() == "xyz"))
                            {
                                oComm.SendEmail("\"Early Moments\"*****@*****.**", oVariables.email, "Confirmation of EarlyMoments Order # " + oVariables.order_id.ToString(), emailHTML, "");
                            }
                            else
                            {
                                try
                                {
                                    oProcess.LogConfirmationEmail(emailHTML, oVariables.cart_id.ToString());
                                }
                                catch (Exception ex)
                                {
                                    oComm.SendEmail("", "", "EM Confirmation Page: Important", "Error while logging Confirmation email to Database - error: " + ex.Message.ToString(), "");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                oComm.SendEmail("ProcessConfirmationEmail() <br />Exception Raised from Confirmaiton Page in EM Landers. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
                    + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
            }
        }
Esempio n. 13
0
        public ActionResult Confirmation()
        {
            OrderVariables oVariables = new OrderVariables();
            OrderProcess oProcess = new OrderProcess();
            CommonModels oComm = new CommonModels();
            string template = "";
            string shipall = "";
            string orderSummary = "";
            string shipping_address = "";
            string billing_address = "";
            try
            {
                if (Session["NewOrderDetails"] != null)
                {
                    oVariables = new OrderVariables();
                    oVariables = Session["NewOrderDetails"] as OrderVariables;
                    if (oVariables != null)
                    {
                        shipall = ((string)Request.QueryString["shipall"] != null) ? (string)Request.QueryString["shipall"] : "false";
                        ViewBag.product = oVariables.proj_desc;
                        ViewBag.special_text = oVariables.special_text;
                        ViewBag.order_id = oVariables.order_id.ToString();

                        ViewBag.amt = oVariables.total_amt.ToString();
                        ViewBag.Project = oVariables.project;
                        string CCNumber = oVariables.CCVars[0] != null ? oVariables.CCVars[0].number : "";

                        ViewBag.CreditCardNumber = EncryptCreditCard(CCNumber);
                        string ccExpiryDate = oVariables.CCVars[0] != null ? oVariables.CCVars[0].expdate : "";
                        ViewBag.CardExpiry = FormatCCExpiryDate(ccExpiryDate);
                        shipping_address = oComm.Confirmation_ShippingAddress(oVariables);
                        ViewBag.ShippingAddress = shipping_address;
                        billing_address = oComm.Confirmation_BillingAddress(oVariables, template);
                        ViewBag.BillingAddress = billing_address;

                        orderSummary = oComm.ResponsiveConfirmation_GiftingProducts(oVariables);

                        ViewBag.Cart = orderSummary;
                        string email = oVariables.email.ToString();
                        ViewBag.email = email;
                        if (!string.IsNullOrEmpty(email))
                        {
                            ProcessConfirmationEmail(oVariables, shipping_address, billing_address, shipall);
                            BuildDynamicPixel(oVariables);
                            //internalPixel = "<img src='https://ping.earlymoments.com/conversion.ashx?o=" + oVariables.order_id + "&e=" + oVariables.email + "' width='1' height='1' border='0' /><iframe src='https://services.earlymoments.com/ping/p.ashx?source=7630&brand=e&data=" + oVariables.order_id.ToString() + "&type=ifr' height='1' width='1' frameborder='0'></iframe><br /><img src='https://services.earlymoments.com/ping/p.ashx?source=7630&brand=e&data=" + oVariables.order_id.ToString() + "&type=img' width='1' height='1' border='0' />";
                            //internalPixel = "<iframe src='https://services.earlymoments.com/ping/p.ashx?source=7630&brand=e&data=" + oVariables.order_id.ToString() + "&type=ifr' height='1' width='1' frameborder='0'></iframe><br /><img src='https://services.earlymoments.com/ping/p.ashx?source=7630&brand=e&data=" + oVariables.order_id.ToString() + "&type=img' width='1' height='1' border='0' />";
                            //Session["IsPostBack"] = true;

                            FirePostBackPixel(oVariables);
                        }
                    }
                }
                return View();
            }
            catch (Exception ex)
            {
                oComm.SendEmail("Page_Load() <br />Exception Raised from Confirmaiton Page in EM Landers. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
                  + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
                return View();
            }
            finally
            {
                Session["NewOrderDetails"] = null;
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
        }
        public ActionResult OrderDetails()
        {
            var oComm = new CommonModels();
            OrderVariables oVariables = new OrderVariables();
            try
            {
                if (Session["NewOrderDetails"] != null)
                {

                    oVariables = Session["NewOrderDetails"] as OrderVariables;
                    string serviceUrl = ConfigurationManager.AppSettings["iservice"].ToString();
                    if (oVariables != null)
                    {
                        BindCartDetails();
                        serviceUrl += "getupselloffers/?token=741889E3-4565-40A1-982A-F15F7A923D72&UpsellId=" + oVariables.upsellId.ToString() + "&PromotionId=" + oVariables.campaign_id + "&format=json";
                        //serviceUrl += "getupselloffers/?token=741889E3-4565-40A1-982A-F15F7A923D72&UpsellId=19790613&PromotionId=12469&format=json";
                        connectIServices connectIServices = new connectIServices();

                        string obj = connectIServices.returnJson(serviceUrl);
                        var yourOjbect = new JavaScriptSerializer().DeserializeObject(obj);
                        List<object> offerList = new List<object>();
                        object[] O_bookList;

                        int i = 0;
                        foreach (var item1 in (Dictionary<string, object>)yourOjbect)
                        {
                            i++;
                            var item2 = item1.Value;
                            if (i < 2)
                            {
                                O_bookList = (object[])item2;
                                offerList = O_bookList.ToList();
                            }
                        }

                        BindOfferDetails(offerList);
                        AssignValuestoViewBag(1);
                        ViewBag.BillZipCode = oVariables.bill_to_zipcode;

                    }
                }
            }
            catch (Exception ex)
            {
                oComm.SendEmail("Upsell Page 1 deals <br />Exception Raised from Upsell Page 1 deals. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
                    + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
            }
            return View();
        }
Esempio n. 15
0
        public ActionResult Three_99(FormCollection form, ShippingModels.ShippingAddress shipping)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["GenderList"] = UtilitiesModels.GetChildGenderNameList();
            OrderProcess oProcess = new OrderProcess();
            CommonMethods oComm = new CommonMethods();
            OrderVariables oVariables = new OrderVariables();
            try
            {
                if (ModelState.IsValid == false)
                {
                    var message = string.Join("<br>", ModelState.Values
                        .SelectMany(v => v.Errors)
                        .Select(e => e.ErrorMessage));
                    ViewBag.ErrorMsg = message.ToString();
                    return View();
                }

                //var value = HttpContext.Request.Params.Get("vendorcode");
                //oVariables = oProcess.GetOfferAndPageDetails("seuss-winter-595-responsive");
                oVariables = oProcess.GetOfferAndPageDetails("fosina-elmo-399-secure");

                #region "Commented by Samrat_Globsyn @ 07.11.2016"
                //if ((string)Request.QueryString["vendorcode"] != null) { oVariables.vendor_id = (string)Request.QueryString["vendorcode"]; }
                //if ((string)Request.QueryString["key"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["key"]; }
                //if ((string)Request.QueryString["vc"] != null) { oVariables.vendor_id = (string)Request.QueryString["vc"]; }
                //if ((string)Request.QueryString["pc"] != null) { oVariables.promotion_code = (string)Request.QueryString["pc"]; }
                //if ((string)Request.QueryString["aff_id"] != null) { oVariables.vendor_data1 = (string)Request.QueryString["aff_id"]; } if ((string)Request.QueryString["tracking"] != null) { oVariables.vendor_cust_ref_id = (string)Request.QueryString["tracking"]; }
                //if ((string)Request.QueryString["src"] != null) { oVariables.pcode_pos_8 = (string)Request.QueryString["src"]; }
                //if ((string)Request.QueryString["seg"] != null) { oVariables.pcode_segment = (string)Request.QueryString["seg"]; } if ((string)Request.QueryString["aff_id2"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["aff_id2"]; }
                //oVariables.referring_url = System.Web.HttpContext.Current.Request.Url.ToString();
                #endregion

                var offerService = new OfferService();
                oVariables = offerService.MapQueryStringToOrderVariables(oVariables: oVariables);
                oVariables = ShippingModels.AssignShippingToOrderVariable(oVariables, shipping);

                //Submitting shipping details to order engin for order process
                //Code commented for passing to payment page.
                oVariables = oProcess.OrderSubmit(oVariables);
                if (oVariables != null)
                {
                    if (oVariables.order_id > 0)
                    {
                        Session.Add("NewOrderDetails", oVariables);
                        return RedirectToAction("Confirmation", "Home");
                    }
                    else
                    {
                        if (oVariables.err.Length >= 0)
                        {
                            // page_log += "Order is NOT processed. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                            if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                            {
                                //   page_log += "Order is NOT processed with Order Status X or F. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                //  Response.Redirect("../orderstatus.aspx" + oComm.GetURIString(), false);
                                // HttpContext.Current.ApplicationInstance.CompleteRequest();
                                Session.Add("NewOrderDetails", oVariables);
                                return RedirectToAction("orderstatus", "Home");
                            }
                            else if (oVariables.err.Length > 0)
                            {
                                //  page_log += "Order is NOT processed with an ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                //  lblErrorMsg.Text = oVariables.err;
                                //  oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                //  string error_msg = string.Empty;
                                //  error_msg = "alert('" + oVariables.err + "')";
                                //  ScriptManager.RegisterStartupScript(this, this.GetType(), "client_error", error_msg, true);
                                //oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                            else if ((oVariables.order_status == "N") || (oVariables.redirect_page.Length > 0))
                            {
                                //  page_log += "Order is NOT processed with NO ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                Session.Add("NewSBMDetails", oVariables);
                                //   Response.Redirect("../" + oVariables.redirect_page + oComm.GetURIString() + "&template=club", false);
                                //   HttpContext.Current.ApplicationInstance.CompleteRequest();
                                return RedirectToAction("Payment_399", "Elmo");
                            }
                            else
                            {
                                /* page_log += "Order is NOT processed with YES ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                 lblErrorMsg.Text = oVariables.err;
                                 oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                 string error_msg = string.Empty;
                                 error_msg = "alert('" + oVariables.err + "')";
                                 ScriptManager.RegisterStartupScript(this, this.GetType(), "client_error", error_msg, true); */

                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                        }
                    }
                }
                else
                {
                    //page_log += "Order is NOT processed, Order Process returned NULL.<br>";
                    Session["NewSBMDetails"] = null;
                    return RedirectToAction("orderstatus", "Home");
                }
                //ends Submitting shipping details to order engin for order process
                //Session["NewSBMDetails"] = oVariables;
                //Session["ShippingDetails"] = oVariables;
                //return RedirectToAction("Payment4_for_1", "Seuss");
            }
            catch (Exception ex)
            {
                string page_log = "Exception raised. Exception: " + ex.Message.ToString() + "<br>";
                CommonModels oCom = new CommonModels();
                string s = "";// oCom.LogBrowserCapabilities(Request.Browser);
                oCom.SendEmail(HttpContext.Request.Url.ToString() + "<br>ex.message = " + ex.Message.ToString() + "<br> Additional Information - " + page_log + ".<br> Browser Details....<br>" + s);
                return View();
            }
            finally
            {
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
            return View();
        }
Esempio n. 16
0
        public ActionResult OrderStatus()
        {
            OrderVariables oVariables = new OrderVariables();
            CommonModels oComm = new CommonModels();
            try
            {
                int errorCode = 0;
                if (Session["NewOrderDetails"] != null)
                {
                    oVariables = new OrderVariables();
                    oVariables = Session["NewOrderDetails"] as OrderVariables;

                    if (oVariables != null)
                    {
                        errorCode = oVariables.error_code;
                    }
                    ViewBag.ErrorMessage = GetError(errorCode.ToString());
                }
                else
                {
                    ViewBag.ErrorMessage = GetError(errorCode.ToString());
                }
            }
            catch (Exception ex)
            {
                if (oVariables != null)
                {
                    oComm.SendEmail("Page_Load() <br />Exception Raised from Confirmaiton Page in EM Landers. Exception: " + ex.Message.ToString() + ".<br />More Data (Offer URL): "
                      + oVariables.referring_url + ". <br />More Data (Order Id):" + oVariables.order_id);
                }
            }
            finally
            {
                Session["NewOrderDetails"] = null;
                oVariables = null;
                oComm = null;

            }
            return View();
        }
Esempio n. 17
0
        public ActionResult Payment_399(FormCollection form, ShippingModels.BillingDetails billing)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["MonthList"] = UtilitiesModels.GetMonthNameList();
            ViewData["YearList"] = UtilitiesModels.GetCardExpiryYearList();

            OrderVariables oVariables = new OrderVariables();
            OrderProcess oProcess = new OrderProcess();
            CommonModels oComm = new CommonModels();

            string cart_details, conf_pg_tac, total = "";
            string shipall = "false";
            string template = "";
            string pixel = "";

            if (!string.IsNullOrEmpty(billing.SecurityCaptch) && Session["rndtext"] != null)
            {
                string strCaptch = Session["rndtext"] as string;
                if (!strCaptch.Equals(billing.SecurityCaptch))
                {
                    ViewBag.ErrorMsg = "Invalid Security Captcha.";
                    //return View();
                }
            }
            else
            {
                //if (string.IsNullOrEmpty(billing.SecurityCaptch))
                //{
                ViewBag.ErrorMsg = "Security Captcha is required.";
                // return View();
                //}
            }

            if (Session["ShippingDetails"] != null)
                oVariables = Session["ShippingDetails"] as OrderVariables;

            try
            {
                if (Session["NewSBMDetails"] != null)
                {
                    oVariables = (OrderVariables)Session["NewSBMDetails"];

                    if (oVariables != null)
                    {
                        if (ViewBag.ErrorMsg != null && ViewBag.ErrorMsg != "")
                        {
                            //Setting values if page is getting back to the payment view only.
                            Dictionary<string, string> d = oComm.GetOfferCreatives(oVariables);
                            ViewBag.HeaderImageSrc = oComm.GetDictionaryValue("payment_header", d);
                            if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                            if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                            string cartId = oVariables.cart_id.ToString();
                            conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                            cart_details = oComm.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                            total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                            ViewBag.IsBonusSelected = false;
                            if (oVariables.bonus_option == true)
                            {
                                ViewBag.IsBonusSelected = true;
                            }
                            ViewBag.CartSummary = cart_details;
                            ViewBag.Cart = cartId;
                            ViewBag.Total = total;
                            ViewBag.ConfPgTAC = conf_pg_tac;

                            return View();
                        }

                        oVariables = ShippingModels.AssignBillingToOrderVariable(oVariables, billing);
                        oVariables = oProcess.OrderSubmit(oVariables);
                        if (oVariables != null)
                        {
                            if (oVariables.order_id > 0)
                            {
                                Session["NewSBMDetails"] = null;
                                Session.Add("NewOrderDetails", oVariables);
                                return RedirectToAction("Confirmation", "Home");
                            }
                            else
                            {
                                if (oVariables.err.Length > 0)
                                {
                                    if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                                    {
                                        Session["NewSBMDetails"] = null;
                                        Session.Add("NewOrderDetails", oVariables);
                                        return RedirectToAction("orderstatus", "Home");
                                    }
                                    else
                                    {
                                        Session.Add("NewSBMDetails", oVariables);
                                        ViewBag.ErrorMsg = oVariables.err;
                                        oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                    }
                                }
                                else if (oVariables.isSoftDeclined)
                                {
                                    Session["NewSBMDetails"] = null;
                                    return RedirectToAction("ThankYou", "home");
                                }
                                //Setting values if page is getting back to the payment view only.
                                Dictionary<string, string> d = oComm.GetOfferCreatives(oVariables);
                                ViewBag.HeaderImageSrc = oComm.GetDictionaryValue("payment_header", d);
                                if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                                if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                                string cartId = oVariables.cart_id.ToString();
                                conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                                cart_details = oComm.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                                total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                                ViewBag.IsBonusSelected = false;
                                if (oVariables.bonus_option == true)
                                {
                                    ViewBag.IsBonusSelected = true;
                                }
                                ViewBag.CartSummary = cart_details;
                                ViewBag.Cart = cartId;
                                ViewBag.Total = total;
                                ViewBag.ConfPgTAC = conf_pg_tac;
                            }
                        }
                        else
                        {
                            return RedirectToAction("orderstatus", "Home");
                        }
                    }
                    return View();
                }
                else
                {
                    return RedirectToAction("Three_99", "Elmo", routeValues: ViewContextExtensions.OptionalParamters(Request.QueryString));
                }

            }
            catch (Exception ex)
            {
                oComm.SendEmail("Exception Raised in EM Landers Payment Page (Submit) - " + ex.Message.ToString());
                return View();
            }
            finally
            {
                oComm = null;
                oVariables = null;
                oProcess = null;
            }
        }
        private ActionResult submitDetails(string upsellDataDetails, string orderItems )
        {
            OrderVariables oVariables = new OrderVariables();
            OrderProcess oProcess = new OrderProcess();
            CommonModels oComm = new CommonModels();
            try
            {
                if (Session["NewOrderDetails"] != null)
                {
                    List<upSellproperties> upsellDetails = new List<upSellproperties>();
                    oVariables = (OrderVariables)Session["NewOrderDetails"];

                    oVariables.applyDupeCheck = false;
                    oVariables.applyEnhancedCTI = false;
                    oVariables.has_shopping_Cart = true;

                    if (upsellDataDetails == "OrderDetails")
                    {
                        if (Session["UpsellDataSet"] != null)
                        {
                            upsellDetails = (List<upSellproperties>)Session["UpsellDataSet"];
                            upSellproperties upsellFirst = upsellDetails.Find(x => x.display_Sequence == 1);
                            if (upsellFirst != null || upsellFirst.id != "")
                                oVariables.shopping_cart_items = upsellFirst.id;
                        }
                    }
                    else if (upsellDataDetails == "CartDetails")
                    {
                        if (Session["UpsellDataSet"] != null)
                        {
                            upsellDetails = (List<upSellproperties>)Session["UpsellDataSet"];
                        }
                            oVariables.shopping_cart_items = orderItems;
                        if (orderItems != "" && orderItems != null && orderItems != ",")
                            Session["fireFaceBookUpsell2Pixel"] = "true";
                    }

                    oVariables.promotion_code = oVariables.promotion_code.Length >= 6
                        ? oVariables.promotion_code.Substring(0, 6)
                        : oVariables.promotion_code;

                    // oVariables.promotion_code = oVariables.promotion_code + eithPosition;

                    #region "This is a common logict to this and to all special pages"
                    int tempDefaultShipId = oVariables.default_shp_id;
                    int i = 0;
                    foreach (ShippingVariables ShipVar in oVariables.ShipVars)
                    {
                        if (oVariables.shopping_cart_items!=null && ShipVar.offer_id.IndexOf(oVariables.shopping_cart_items) >= 0)
                        {
                            oVariables.default_shp_id = i;
                        }
                        i++;
                    }

                    oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname = oVariables.ShipVars[tempDefaultShipId].ship_to_fname;
                    oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname = oVariables.ShipVars[tempDefaultShipId].ship_to_lname;
                    oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1 = oVariables.ShipVars[tempDefaultShipId].ship_to_address1;
                    oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt = oVariables.ShipVars[tempDefaultShipId].ship_to_apt;
                    oVariables.ShipVars[oVariables.default_shp_id].ship_to_city = oVariables.ShipVars[tempDefaultShipId].ship_to_city;
                    oVariables.ShipVars[oVariables.default_shp_id].ship_to_state = oVariables.ShipVars[tempDefaultShipId].ship_to_state;
                    oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode = oVariables.ShipVars[tempDefaultShipId].ship_to_zipcode;
                    oVariables.ShipVars[oVariables.default_shp_id].child_gender = oVariables.ShipVars[tempDefaultShipId].child_gender;

                    #endregion

                    oVariables.err = "";
                    oVariables.payment_type = "CC";
                    oVariables.total_amt = 0.00;
                    oVariables.total_sah = 0.00;
                    oVariables.order_status = "N";

                    oVariables.isOrderUpgraded = true;
                    oVariables.cancelOriginalOrder = true;
                    oVariables.originalOrderId = oVariables.order_id;
                    oVariables.pcode_pos_7 = "W";
                    if (upsellDataDetails == "OrderDetails" || (upsellDataDetails == "CartDetails" && (Session["fireFaceBookUpsell2Pixel"]!=null && Session["fireFaceBookUpsell2Pixel"].ToString() == "true")))
                        oVariables = oProcess.OrderSubmit(oVariables);
                    if (oVariables != null)
                    {
                        if (oVariables.order_id > 0)
                        {
                            Session["DefaultDetails"] = null;
                            Session.Add("NewOrderDetails", oVariables);
                            if (upsellDetails.Count > 1 && upsellDataDetails == "OrderDetails")
                            {
                                Session["fireFaceBookPixel"] = "true";
                                Session["fireFaceBookUpsell1Pixel"] = "false";
                                return RedirectToAction("CartDetails", "AdditionalOffers");
                            }
                            else
                            {
                                if(upsellDetails.Count==1)
                                Session["fireFaceBookUpsell1Pixel"] = "true";
                                return RedirectToAction("confirmation", "Home");
                            }
                        }
                        else
                        {
                            if (oVariables.err.Length >= 0)
                            {
                                if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                                {
                                    return RedirectToAction("orderstatus", "Home");
                                }
                                else if (oVariables.err.Length > 0)
                                {
                                    ViewBag.ErrorMsg = oVariables.err;
                                    oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                }
                                else if ((oVariables.order_status == "N") || (oVariables.redirect_page.Length > 0))
                                {
                                    Session.Add("NewSBMDetails", oVariables);
                                    return RedirectToAction("OrderDetails", "AdditionalOffers");
                                }
                                else
                                {
                                    ViewBag.ErrorMsg = oVariables.err;
                                    oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                }
                            }
                        }
                    }
                    else
                    {

                    }
                }
            }
            catch (Exception ex)
            {
                oComm.SendEmail("Exception Raised in EM Landers Payment Page - " + ex.Message.ToString());
            }
            finally
            {
                //  oComm = null;
                //  oVariables = null;
            }
            return View();
        }