Esempio n. 1
0
        public async Task <OrderProcess> Add(OrderProcess model)
        {
            var entity = _menuUnitRepository.Add(model);
            await _menuUnitRepository.SaveChangeAsync();

            return(model);
        }
        public void ProcessMessage(IHandlerContext <ArchiveOrderProcessCommand> context)
        {
            using (_databaseContextFactory.Create(ProcessManagementData.ConnectionStringName))
            {
                var stream       = _eventStore.Get(context.Message.OrderProcessId);
                var orderProcess = new OrderProcess(context.Message.OrderProcessId);
                stream.Apply(orderProcess);

                if (!orderProcess.CanArchive)
                {
                    context.Publish(new ArchiveOrderProcessRejectedEvent
                    {
                        OrderProcessId = context.Message.OrderProcessId,
                        Status         = orderProcess.Status
                    });

                    return;
                }

                stream.AddEvent(orderProcess.ChangeStatus("Order Archived"));

                _eventStore.SaveEventStream(stream);
            }

            context.Publish(new OrderProcessArchivedEvent
            {
                OrderProcessId = context.Message.OrderProcessId
            });
        }
Esempio n. 3
0
        // GET: Orders/Edit
        public ActionResult Edit(int id)
        {
            var op    = new OrderProcess();
            var order = op.Find(id);

            return(View(order));
        }
        public void ProcessMessage(IHandlerContext <EMailSentEvent> context)
        {
            if (!context.TransportMessage.IsHandledHere())
            {
                return;
            }

            var orderProcessId = new Guid(context.TransportMessage.CorrelationId);

            using (_databaseContextFactory.Create(ProcessManagementData.ConnectionStringName))
            {
                var stream = _eventStore.Get(orderProcessId);

                if (stream.IsEmpty)
                {
                    throw new ApplicationException(
                              string.Format("Could not find an order process with correlation id '{0}'.",
                                            context.TransportMessage.CorrelationId));
                }

                var orderProcess = new OrderProcess(orderProcessId);
                stream.Apply(orderProcess);

                stream.AddEvent(orderProcess.ChangeStatus("Dispatched-EMail Sent"));

                _eventStore.SaveEventStream(stream);
            }

            context.Send(new CompleteOrderProcessCommand
            {
                OrderProcessId = orderProcessId
            }, c => c.Local());
        }
Esempio n. 5
0
        public string CreateOrderProcess(string name, int type, string categoryid, int days, int isdefault, string ownerid, string userid, string clientid)
        {
            string id             = Guid.NewGuid().ToString().ToLower();
            string otherProcessID = "";
            bool   bl             = SystemDAL.BaseProvider.CreateOrderProcess(id, name, type, categoryid, days, isdefault, ownerid, userid, clientid, out otherProcessID);

            if (bl)
            {
                if (!OrderProcess.ContainsKey(clientid))
                {
                    GetOrderProcess(clientid);
                }
                var model = GetOrderProcessByID(id, clientid);
                if (OrderProcess[clientid].Where(m => m.ProcessID.ToLower() == id).Count() == 0)
                {
                    OrderProcess[clientid].Add(model);
                }

                if (!string.IsNullOrEmpty(otherProcessID))
                {
                    var oModel = GetOrderProcessByID(otherProcessID, clientid);

                    if (OrderProcess[clientid].Where(m => m.ProcessID.ToLower() == otherProcessID.ToLower()).Count() == 0)
                    {
                        OrderProcess[clientid].Add(oModel);
                    }
                }

                return(id);
            }
            return("");
        }
Esempio n. 6
0
        // GET: Orders/Order
        public ActionResult Index()
        {
            var op    = new OrderProcess();
            var lista = op.SelectList();

            return(View(lista));
        }
        public void ProcessMessage(IHandlerContext <CancelOrderProcessCommand> context)
        {
            using (_databaseContextFactory.Create(ProcessManagementData.ConnectionStringName))
            {
                var stream       = _eventStore.Get(context.Message.OrderProcessId);
                var orderProcess = new OrderProcess(context.Message.OrderProcessId);
                stream.Apply(orderProcess);

                if (!orderProcess.CanCancel)
                {
                    context.Publish(new CancelOrderProcessRejectedEvent
                    {
                        OrderProcessId = context.Message.OrderProcessId,
                        Status         = orderProcess.Status
                    });

                    return;
                }

                _eventStore.Remove(context.Message.OrderProcessId);
            }

            context.Publish(new OrderProcessCancelledEvent
            {
                OrderProcessId = context.Message.OrderProcessId
            });
        }
Esempio n. 8
0
        public ResResultModel DeleteOrderMake(string itemAppend)
        {
            try
            {
                MenusDataProxy.ValidateAccess((int)EnumData.EnumOperationAccess.除, true);

                if (string.IsNullOrWhiteSpace(itemAppend))
                {
                    return(ResResult.Response(false, MC.Request_Params_InvalidError, ""));
                }
                var items = itemAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                var bll    = new OrderMake();
                var opBll  = new OrderProcess();
                var effect = 0;

                foreach (var item in items)
                {
                    var orderId = Guid.Parse(item);
                    effect += bll.Delete(orderId);
                    effect += opBll.DeleteByOrder(orderId);
                }

                return(ResResult.Response(true, MC.M_Save_Ok, ""));
            }
            catch (Exception ex)
            {
                return(ResResult.Response(false, ex.Message, ""));
            }
        }
Esempio n. 9
0
        // POST: Orders/Create
        public ActionResult Create(Order order)
        {
            var op = new OrderProcess();

            op.Insert(order);
            return(RedirectToAction("Index"));
        }
Esempio n. 10
0
        // GET: Orders/Delete
        public ActionResult Delete(int id)
        {
            var op = new OrderProcess();

            op.Delete(id);
            return(RedirectToAction("Index"));
        }
Esempio n. 11
0
        // POST: Orders/Edit
        public ActionResult Edit(Order order)
        {
            var op = new OrderProcess();

            op.Edit(order);
            return(RedirectToAction("Index"));
        }
Esempio n. 12
0
        public static void DelegateCodeSample()
        {
            OrderInfo orderDetail = new OrderInfo()
            {
                orderid = 5678
            };
            OrderProcess         obj                  = new OrderProcess();
            MobileClientApp      mobileClientApp      = new MobileClientApp();
            BackGroundProcessApp backGroundProcessApp = new BackGroundProcessApp();
            WebServiceAPP        webServiceAPP        = new WebServiceAPP();

            obj.OrderProcessStarted += new OrderProcess.ProcessStarted(mobileClientApp.GetStatus);
            obj.OrderProcessStarted += new OrderProcess.ProcessStarted(backGroundProcessApp.GetStatus);
            obj.OrderProcessStarted += new OrderProcess.ProcessStarted(webServiceAPP.GetStatus);
            obj.OrderProcessStarted += delegate(OrderInfo info)
            {
                Console.WriteLine("This is anonymous method sample. Order status: " + info.status);
            };

            Action <OrderInfo> actionDEl = (order) => { Console.WriteLine("Message from action methid" + order.status); };

            obj.OrderProcessStarted += actionDEl.Invoke;

            obj.OrderProcessCompleted += mobileClientApp.GetStatus;
            obj.OrderProcessCompleted += backGroundProcessApp.GetStatus;
            obj.OrderProcessCompleted += webServiceAPP.GetStatus;
            obj.OrderProcessCompleted += delegate(object sender, OrderInfoArgs args)
            {
                Console.WriteLine("This is anonymous method sample. Order status: " + args.orderInfo.status);
            };

            obj.StarProcess(orderDetail);
        }
Esempio n. 13
0
        public void Process_WhenOrderIsZero_AddsNewCustomerOrder()
        {
            //Arrange
            var cust              = new Customer();
            var custOrder         = new CustomersOrder();
            var customerOrderList = custOrder.CustomersOrders = new List <CustomersOrder>();

            IRepository repo = new Repository(cust, custOrder);

            var orderProcessor = new OrderProcess(repo);


            var dto1 = new OrderDto {
                Code = 1, CustomerCode = 1, OrderDate = DateTime.Now.Date, OrderStatus = "OK"
            };

            var custOrder1 = new CustomersOrder {
                ID = 1, Code = 1, CustomerID = 1, Order = dto1, OrderDate = dto1.OrderDate, OrderStatus = dto1.OrderStatus
            };

            customerOrderList.Add(custOrder1);


            //Act
            orderProcessor.Process(custOrder1);

            //Assert
            Assert.AreEqual(1, customerOrderList.Count);
        }
Esempio n. 14
0
        public void ProcessMessage(IHandlerContext <AcceptOrderProcessCommand> context)
        {
            OrderProcess orderProcess;

            using (_databaseContextFactory.Create(ProcessManagementData.ConnectionStringName))
            {
                var stream = _eventStore.Get(context.Message.OrderProcessId);

                if (stream.IsEmpty)
                {
                    return;
                }

                orderProcess = new OrderProcess(context.Message.OrderProcessId);
                stream.Apply(orderProcess);

                stream.AddEvent(orderProcess.ChangeStatus("Order Accepted"));

                _eventStore.SaveEventStream(stream);
            }

            context.Send(orderProcess.CreateOrderCommand(), c => c.WithCorrelationId(orderProcess.Id.ToString()));

            context.Publish(new OrderProcessAcceptedEvent
            {
                OrderProcessId = orderProcess.Id
            });
        }
Esempio n. 15
0
        public void ProcessMessage(IHandlerContext <InvoiceCreatedEvent> context)
        {
            if (!context.TransportMessage.IsHandledHere())
            {
                return;
            }

            var orderProcessId = new Guid(context.TransportMessage.CorrelationId);

            var orderProcess = new OrderProcess(orderProcessId);

            using (_databaseContextFactory.Create(ProcessManagementData.ConnectionStringName))
            {
                var stream = _eventStore.Get(orderProcessId);

                if (stream.IsEmpty)
                {
                    throw new ApplicationException(
                              string.Format("Could not find an order process with correlation id '{0}'.",
                                            context.TransportMessage.CorrelationId));
                }

                stream.Apply(orderProcess);

                stream.AddEvent(orderProcess.ChangeStatus("Invoice Created"));
                stream.AddEvent(orderProcess.AssignInvoiceId(context.Message.InvoiceId));

                _eventStore.Save(stream);
            }

            context.Send(orderProcess.SendEMailCommand());
        }
Esempio n. 16
0
        public IHttpActionResult Get(long id)
        {
            var process = new OrderProcess(unitOfWork);

            var result = process.Get(id);

            return(GetErrorResult(result) ?? Ok(result));
        }
Esempio n. 17
0
        public IHttpActionResult Get()
        {
            var process = new OrderProcess(unitOfWork);

            var result = process.Get(User.Identity.GetId(), User.Identity.GetRole());

            return(GetErrorResult(result) ?? Ok(result));
        }
Esempio n. 18
0
        public void orderProcessNoException()
        {
            //Arrange
            var service = new OrderProcess();

            //Assert
            Assert.DoesNotThrow(() => service.GetOrder(1));
        }
Esempio n. 19
0
        public void Test()
        {
            OrderProcess orderProcess = new OrderProcess(opts, 1, 1);
            //var ret = orderProcess.AddNewOrder(TradeType.Sell, 123, 5);
            var market = orderProcess.GetMarketData();
            var orders = orderProcess.GetNewOrders();

            Assert.True(true);
        }
Esempio n. 20
0
        protected void ordersGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         index   = Convert.ToInt32(e.CommandArgument);
            GridViewRow row     = ordersGridView.Rows[index];
            var         value   = row.Cells[1].Text.ToString();
            var         orderID = Guid.Parse(value);

            OrderProcess.CompleteOrder(orderID);
            refreshGrid();
        }
Esempio n. 21
0
        public async Task <bool> Put(OrderProcess model)
        {
            var result = false;

            if (ModelState.IsValid)
            {
                result = await _orderProcessBusiness.Update(model);
            }
            return(result);
        }
Esempio n. 22
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. 23
0
        public void OrderFactory_Should_Create_Order()
        {
            //Arrange
            var service = new OrderProcess();

            //Act
            IOrder actual = service.GetOrder(1);

            //Assert
            Assert.IsNotNull(actual);
            Assert.IsInstanceOf(typeof(IOrder), actual);
        }
Esempio n. 24
0
        // GET: Orders/Details
        public ActionResult Details(int id)
        {
            var op    = new OrderProcess();
            var order = op.Find(id);

            var cp         = new ClientProcess();
            var descClient = cp.Find(order.ClientId);

            ViewData["Client"] = descClient.FirstName + " " + descClient.LastName;

            return(View(order));
        }
        public void OrderListRemove()
        {
            _cacheServices.Remove(DataCacheSetting.Order.Key);

            var lista = _cacheServices.GetOrAdd(
                DataCacheSetting.Order.Key,
                () =>
            {
                var op = new OrderProcess();
                return(op.SelectList());
            },
                DataCacheSetting.Order.SlidingExpiration);
        }
        public List <Order> OrderList()
        {
            var lista = _cacheServices.GetOrAdd(
                DataCacheSetting.Order.Key,
                () =>
            {
                var op = new OrderProcess();
                return(op.SelectList());
            },
                DataCacheSetting.Order.SlidingExpiration);

            return(lista);
        }
Esempio n. 27
0
        public void Upgrade()
        {
            switch (Process)
            {
            case OrderProcess.OnWaitingList:
                Process = OrderProcess.InProgress;
                break;

            case OrderProcess.InProgress:
                Process = OrderProcess.Ready;
                break;
            }
        }
        public JsonResult GetOrders()
        {
            var ap   = new OrderProcess();
            var list = ap.ListarOrden();

            foreach (Order item in list)

            {
                item.Fecha = item.OrderDate.ToShortDateString();
            }

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Esempio n. 29
0
        public async Task <int> Post(OrderProcess model)
        {
            var result = 0;

            if (ModelState.IsValid)
            {
                model.Status = 1;
                var modelInsert = await _orderProcessBusiness.Add(model);

                result = modelInsert.Id;
            }
            return(result);
        }
Esempio n. 30
0
        public IHttpActionResult GetLocation(long id)
        {
            if (id < 1)
            {
                return(BadRequest("Orden inválida."));
            }

            var process = new OrderProcess(unitOfWork);

            var result = process.GetBuyerLocation(User.Identity.GetId(), id);

            return(GetErrorResult(result) ?? Ok(result));
        }
Esempio n. 31
0
        public void ProcessMessage(IHandlerContext <RegisterOrderProcessCommand> context)
        {
            var message = context.Message;

            var orderProcess = new OrderProcess
            {
                OrderId         = null,
                InvoiceId       = null,
                CustomerName    = message.CustomerName,
                CustomerEMail   = message.CustomerEMail,
                TargetSystem    = message.TargetSystem,
                TargetSystemUri = message.TargetSystemUri
            };

            orderProcess.GenerateOrderNumber();

            foreach (var quotedProduct in message.QuotedProducts)
            {
                orderProcess.AddItem(new OrderProcessItem(quotedProduct.ProductId, quotedProduct.Description,
                                                          quotedProduct.Price));
            }

            var status = new OrderProcessStatus("Cooling Off");

            orderProcess.AddStatus(status);

            using (_databaseContextFactory.Create(ProcessManagementData.ConnectionStringName))
            {
                _repository.Add(orderProcess);
            }

            context.Publish(new OrderProcessRegisteredEvent
            {
                OrderProcessId  = orderProcess.Id,
                QuotedProducts  = message.QuotedProducts,
                CustomerName    = message.CustomerName,
                CustomerEMail   = message.CustomerEMail,
                OrderNumber     = orderProcess.OrderNumber,
                OrderDate       = orderProcess.DateRegistered,
                OrderTotal      = orderProcess.Total(),
                Status          = status.Status,
                StatusDate      = status.StatusDate,
                TargetSystem    = message.TargetSystem,
                TargetSystemUri = message.TargetSystemUri
            });

            context.Send(new AcceptOrderProcessCommand
            {
                OrderProcessId = orderProcess.Id
            }, c => c.Defer(DateTime.Now.AddSeconds(10)).Local());
        }
Esempio n. 32
0
        public static OrderVariables AssignShippingToOrderVariable(OrderVariables oVariables, ShippingAddress newShippingAddress)
        {
            CommonModels oComm = new CommonModels();
            OrderProcess oProcess = new OrderProcess();
            //OrderVariables oVariables = new OrderVariables();
            oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname = newShippingAddress.ShippingFirstName;
            oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname = newShippingAddress.ShippingLastName;
            oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1 = newShippingAddress.ShippingAddress1;
            oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt = newShippingAddress.ShippingAddress2;
            oVariables.ShipVars[oVariables.default_shp_id].ship_to_city = newShippingAddress.ShippingCity;
            oVariables.ShipVars[oVariables.default_shp_id].ship_to_state = newShippingAddress.ShippingState;
            oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode = newShippingAddress.ShippingZipCode;

            oVariables.ShipVars[oVariables.default_shp_id].child_dob = newShippingAddress.ChildDOB != null ? newShippingAddress.ChildDOB.ToString() : "";
            //oVariables.ShipVars[oVariables.default_shp_id].child_fname = newShippingAddress.ChildName;

            #region Code for Child Name Gender and DOB
            //========================================
            string chName = "";
            chName = string.IsNullOrEmpty(newShippingAddress.ChildName) ? "" : newShippingAddress.ChildName.Trim();
            string[] name = chName.Split(' ');
            int cnt = name.Count();

            string fname = "";
            for (int i = 0; i < name.Count() - 1; i++) { fname += name[i] + " "; }

            string lname = "";
            if (cnt > 1) { lname = name[cnt - 1]; }

            if (fname.Trim().Length == 0)
                fname = name.Length > 0 ? name[0] : "";

            if (lname.Trim().Length == 0)
                lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname;

            //oVariables.ShipVars[oVariables.default_shp_id].child_dob = oProcess.ValidateDateTime(newShippingAddress.ChildDOB.ToString());
            oVariables.ShipVars[oVariables.default_shp_id].child_fname = fname.Trim();
            oVariables.ShipVars[oVariables.default_shp_id].child_lname = lname.Trim();

            if (string.IsNullOrEmpty(newShippingAddress.ChildGender) || newShippingAddress.ChildGender == "")
                oVariables.ShipVars[oVariables.default_shp_id].child_gender = "0";
            else
                oVariables.ShipVars[oVariables.default_shp_id].child_gender = newShippingAddress.ChildGender;
            //oVariables.referring_url = HttpContext.Current.Request.Url.ToString();
            #endregion
            //=================================================
            oVariables.ip_address = oComm.GetIPAddress();
            oVariables.phone = newShippingAddress.ShippingPhone;
            oVariables.email = newShippingAddress.ShippingEmail;
            oVariables.bonus_option = false;

            if (newShippingAddress.isBonusSelected)
            {
                oVariables.bonus_option = true;
            }

            //Setting billing Address by default same as shipping address.
            // later on payment page it will be updated if shipping and biling not same
            oVariables.bill_to_fname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname;
            oVariables.bill_to_lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname;
            oVariables.bill_to_address1 = oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1;
            oVariables.bill_to_apt = oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt;
            oVariables.bill_to_city = oVariables.ShipVars[oVariables.default_shp_id].ship_to_city;
            oVariables.bill_to_state = oVariables.ShipVars[oVariables.default_shp_id].ship_to_state;
            oVariables.bill_to_zipcode = oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode;
            return oVariables;
        }
Esempio n. 33
0
        public ActionResult shipping(FormCollection form, ShippingModels.ShoppingOrder shipping)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["GenderList"] = UtilitiesModels.GetChildGenderNameList();
            ViewData["MonthList"] = UtilitiesModels.GetMonthNameList();
            ViewData["YearList"] = UtilitiesModels.GetCardExpiryYearList();
            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("disney_tripwire");
                #region "Commented by Sri @ 04.12.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();

                ////string queryStr = "";
                ////if (System.Web.HttpContext.Current.Request.UrlReferrer != null)
                ////{
                ////    queryStr = System.Web.HttpContext.Current.Request.UrlReferrer.Query;
                ////    string ref_url = System.Web.HttpContext.Current.Request.Url.ToString();
                ////    oVariables.referring_url = ref_url + queryStr;
                ////}
                //string ref_url = System.Web.HttpContext.Current.Request.Url.ToString();
                //oVariables.referring_url = ref_url;
                #endregion

                var offerService = new OfferService();
                oVariables = offerService.MapQueryStringToOrderVariables(oVariables: oVariables);

                oVariables = ShippingModels.AssignShoppingDetailsToOrderVariable(oVariables, shipping);

                oVariables.has_shopping_Cart = true;

                oVariables.pcode_pos_7 = "N";
                oVariables.order_Src = "EMS";

                //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)
                    {
                        oVariables.lastPageClientOn = "upsell_offer1";
                        Session.Add("NewOrderDetails", oVariables);
                        return RedirectToAction("upsell_offer1", "landers");
                    }
                    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.isSoftDeclined)
                            {
                                Session["NewSBMDetails"] = null;
                                return RedirectToAction("ThankYou", "home");
                            }
                            else if ((oVariables.order_status == "N") || (oVariables.redirect_page.Length > 0))
                            {
                                Session.Add("NewSBMDetails", oVariables);
                                return View();
                                //return RedirectToAction("upsell_offer1", "landers");
                            }
                            else
                            {
                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                        }

                    }
                }
                else
                {
                    Session["NewSBMDetails"] = null;
                    return RedirectToAction("orderstatus", "Home");
                }
            }
            catch (Exception ex)
            {
                string page_log = "Exception raised. Exception: " + ex.Message.ToString() + "<br>";

                ViewBag.ErrorMsg = ex.Message.ToString();
                string s = "";
                oCom.SendEmail(HttpContext.Request.Url.ToString() + "<br>ex.message = " + ex.Message.ToString() + "<br> Additional Information - " + page_log + ".<br> Browser Details....<br>" + s);
                //return RedirectToAction("shipping", "landers", new { uniqueUri = Request.RequestContext.RouteData.Values["uniqueUri"] });
                return View();
            }
            finally
            {
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
            // return RedirectToAction("shipping", "landers", new { uniqueUri = Request.RequestContext.RouteData.Values["uniqueUri"] });
            return View();
        }
Esempio n. 34
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;
            }
        }
Esempio n. 35
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. 36
0
        public ActionResult thankyou()
        {
            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 = oCom.Confirmation_ShippingAddress(oVariables);
                        ViewBag.ShippingAddress = shipping_address;
                        billing_address = oCom.Confirmation_BillingAddress(oVariables, template);
                        ViewBag.BillingAddress = billing_address;

                        orderSummary = oCom.ResponsiveConfirmation_GiftingProducts(oVariables, false, "", false);

                        ViewBag.Cart = orderSummary;
                        string email = oVariables.email.ToString();
                        ViewBag.email = email;
                        string spltext = "";
                        if (!string.IsNullOrEmpty(oVariables.special_text))
                            spltext = oVariables.special_text;
                        ViewBag.SpecialText = spltext;

                        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;

                            FirePostBackPixel(oVariables);
                        }
                    }
                    else
                    {
                        ViewBag.ErrorMsg = genericCustomerServiceMsg;
                    }
                }
                else
                {
                    ViewBag.ErrorMsg = genericCustomerServiceMsg;
                }
                return View();
            }
            catch (Exception ex)
            {
                oCom.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;
            }
        }
Esempio n. 37
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. 38
0
        public static OrderVariables AssignShippingBillingToOrderVariables(OrderVariables oVariables, ShippingBillingOrder newShippingAddress)
        {
            if (newShippingAddress != null && newShippingAddress.stepNumber == 1)
            {
                CommonModels oComm = new CommonModels();
                OrderProcess oProcess = new OrderProcess();
                //OrderVariables oVariables = new OrderVariables();
                oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname = newShippingAddress.ShippingFirstName;
                oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname = newShippingAddress.ShippingLastName;
                oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1 = newShippingAddress.ShippingAddress1;
                oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt = newShippingAddress.ShippingAddress2;
                oVariables.ShipVars[oVariables.default_shp_id].ship_to_city = newShippingAddress.ShippingCity;
                oVariables.ShipVars[oVariables.default_shp_id].ship_to_state = newShippingAddress.ShippingState;
                oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode = newShippingAddress.ShippingZipCode;
                oVariables.ShipVars[oVariables.default_shp_id].child_dob = newShippingAddress.ChildDOB != null ? newShippingAddress.ChildDOB.ToString() : "";
                //oVariables.referring_url = HttpContext.Current.Request.Url.ToString();

                #region Code for Child Name Gender and DOB
                //========================================
                string chName = "";
                chName = string.IsNullOrEmpty(newShippingAddress.ChildName) ? "" : newShippingAddress.ChildName.Trim();
                string[] name = chName.Split(' ');
                int cnt = name.Count();

                string fname = "";
                for (int i = 0; i < name.Count() - 1; i++) { fname += name[i] + " "; }

                string lname = "";
                if (cnt > 1) { lname = name[cnt - 1]; }

                if (fname.Trim().Length == 0)
                    fname = name.Length > 0 ? name[0] : "";

                if (lname.Trim().Length == 0)
                    lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname;

                // oVariables.ShipVars[oVariables.default_shp_id].child_dob = oProcess.ValidateDateTime(newShippingAddress.ChildDOB.ToString());
                oVariables.ShipVars[oVariables.default_shp_id].child_fname = fname.Trim();
                oVariables.ShipVars[oVariables.default_shp_id].child_lname = lname.Trim();

                if (string.IsNullOrEmpty(newShippingAddress.ChildGender) || newShippingAddress.ChildGender == "")
                    oVariables.ShipVars[oVariables.default_shp_id].child_gender = "0";
                else
                    oVariables.ShipVars[oVariables.default_shp_id].child_gender = newShippingAddress.ChildGender;
                //oVariables.referring_url = HttpContext.Current.Request.Url.ToString();
                #endregion
                //=================================================

                oVariables.ip_address = oComm.GetIPAddress();
                oVariables.phone = newShippingAddress.ShippingPhone;
                oVariables.email = newShippingAddress.ShippingEmail;
                oVariables.bonus_option = false;

                if (newShippingAddress.isBonusSelected)
                {
                    oVariables.bonus_option = true;
                }

                //Setting billing Address by default same as shipping address.
                // later on payment page it will be updated if shipping and biling not same
                oVariables.bill_to_fname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname;
                oVariables.bill_to_lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname;
                oVariables.bill_to_address1 = oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1;
                oVariables.bill_to_apt = oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt;
                oVariables.bill_to_city = oVariables.ShipVars[oVariables.default_shp_id].ship_to_city;
                oVariables.bill_to_state = oVariables.ShipVars[oVariables.default_shp_id].ship_to_state;
                oVariables.bill_to_zipcode = oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode;
                return oVariables;
            }
            else if (newShippingAddress != null && newShippingAddress.stepNumber == 2)
            {
                //As we are setting billing and shipping address same on landing page
                if (newShippingAddress.isBillingSameToShipping == false)
                {
                    oVariables.bill_to_fname = newShippingAddress.BillingFirstName.Trim();
                    oVariables.bill_to_lname = newShippingAddress.BillingLastName.Trim();
                    oVariables.bill_to_address1 = newShippingAddress.BillingAddress1.Trim();
                    oVariables.bill_to_apt = (!string.IsNullOrEmpty(newShippingAddress.BillingAddress2)) ? newShippingAddress.BillingAddress2.Trim() : "";
                    oVariables.bill_to_city = newShippingAddress.BillingCity.Trim();
                    oVariables.bill_to_state = newShippingAddress.BillingState.Trim();
                    oVariables.bill_to_zipcode = newShippingAddress.BillingZipCode.Trim();
                }

                //Assigning Payment details to OVariable
                oVariables.credit_rule = "CCC";
                oVariables.err = "";

                if (oVariables.CCVars.Count > 0)
                {
                    oVariables.CCVars[0].number = newShippingAddress.CreditCardNumber.Trim();
                    oVariables.CCVars[0].type = "";
                    oVariables.CCVars[0].expdate = newShippingAddress.CardExpiryMonth.Trim() + newShippingAddress.CardExpiryYear.Trim();
                    oVariables.CCVars[0].cvv = newShippingAddress.SecurityCode.Trim();
                    oVariables.CCVars[0].zipcode = newShippingAddress.CCBillZipCode.Trim();    // oVariables.bill_to_zipcode;// newShippingAddress.BillingZipCode.Trim();
                    oVariables.total_amt = 0.0;
                    oVariables.total_sah = 0.0;
                }
                else
                {
                    CCProperties oCCVars = new OrderEngine.CCProperties();
                    oVariables.payment_type = "CC";
                    oCCVars.number = newShippingAddress.CreditCardNumber.Trim();
                    oCCVars.type = "";
                    oCCVars.expdate = newShippingAddress.CardExpiryMonth.Trim() + newShippingAddress.CardExpiryYear.Trim();
                    oCCVars.cvv = newShippingAddress.SecurityCode.Trim();
                    oCCVars.zipcode = newShippingAddress.CCBillZipCode.Trim(); // oVariables.bill_to_zipcode;// (billingDetails.BillingZipCode != null && billingDetails.BillingZipCode != "") ? billingDetails.BillingZipCode.Trim() : oVariables.bill_to_zipcode; // billingDetails.BillingZipCode.Trim();
                    oVariables.credit_rule = "CCC";
                    oVariables.CCVars.Add(oCCVars);
                    oVariables.total_amt = 0.0;
                    oVariables.total_sah = 0.0;
                }

                return oVariables;
            }
            else
                return null;
        }
Esempio n. 39
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;
            }
        }
        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. 41
0
        public ActionResult upsell_offer2(string SubmitButton, FormCollection form)
        {
            try
            {
                if (Session["NewOrderDetails"] != null)
                {
                    oVariables = Session["NewOrderDetails"] as OrderVariables;
                    if (oVariables != null)
                    {
                        //  if (!string.IsNullOrEmpty(SubmitButton) && SubmitButton.IndexOf("Yes", StringComparison.OrdinalIgnoreCase) >= 0)
                        //  {
                        oVariables.applyDupeCheck = false;
                        oVariables.applyEnhancedCTI = false;
                        oVariables.has_shopping_Cart = true;
                        //oVariables.shopping_cart_items_remove = "19632366,19632367";

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

                        oVariables.pcode_pos_7 = oVariables.shopping_cart_items.In("19632368") ? "W" : "E";

                        oVariables.shopping_cart_items = "19632370,19632371";

                        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;

                        oProcess.OrderSubmit(oVariables);

                        //code for adding upsell by api call commented
                        //isUpsellAdded = addUpsellToCart(order_id, campaign_id, offer_id, upsell_id);
                        //if (isUpsellAdded)
                        //{
                        //    Session["NewOrderDetails"] = oVariables;
                        //}
                        if (oVariables != null)
                        {
                            if (oVariables.order_id > 0)
                            {
                                oVariables.lastPageClientOn = "thankyou";
                                Session.Add("NewOrderDetails", oVariables);
                                return RedirectToAction("thankyou", "landers");
                            }
                            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);
                                        return View();
                                        //return RedirectToAction("upsell_offer2", "landers", new { uniqueUri = Request.RequestContext.RouteData.Values["uniqueUri"] });
                                    }
                                    else
                                    {
                                        ViewBag.ErrorMsg = oVariables.err;
                                        oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                    }
                                }
                            }
                        }
                        else
                        {
                            Session["NewSBMDetails"] = null;
                            return RedirectToAction("orderstatus", "Home", new { uniqueUri = Request.RequestContext.RouteData.Values["uniqueUri"] });
                        }

                        // }
                        // return RedirectToAction("thankyou", "landers");
                    }
                    else
                    {
                        ViewBag.ErrorMsg = genericCustomerServiceMsg;
                    }
                }
                else
                {
                    ViewBag.ErrorMsg = genericCustomerServiceMsg;
                }
                //return RedirectToAction("upsell_offer2", "landers", new { uniqueUri = Request.RequestContext.RouteData.Values["uniqueUri"] });
                return View();

            }
            catch (Exception ex)
            {
                ViewBag.ErrorMsg = ex.Message.ToString();
                if (oVariables != null)
                {
                    oCom.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 RedirectToAction("upsell_offer2", "landers", new { uniqueUri = Request.RequestContext.RouteData.Values["uniqueUri"] });
                return View();
            }
            finally
            {
                //  Session["NewOrderDetails"] = null;
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
        }
        private void BindCartDetails()
        {
            OrderVariables oVariables = new OrderVariables();
            OrderProcess oProcess = new OrderProcess();
            CommonModels oComm = new CommonModels();
            double totalAmount = 0;
            double taxAmt = 0;
            string cart_details, conf_pg_tac, total = "";
            string shipall = "false";
            string template = "";

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

                if (oVariables != null)
                {
                    Dictionary<string, string> d = oComm.GetOfferCreatives(oVariables);
                    ViewBag.UpsellHeaderImage = oComm.GetDictionaryValue("upsell_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, out taxAmt, out totalAmount, Convert.ToBoolean(shipall), template, true);
                    ViewBag.taxAmt = String.Format("{0:C}", taxAmt);
                    ViewBag.totalAmount = String.Format("{0:C}", totalAmount);

                    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;
                    ViewBag.ChoiceBook = oVariables.shopping_cart_items;
                }

            }
        }
        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();
        }