Ejemplo n.º 1
0
        //public ContinuityBatch GetContBatch(Order orderItem)
        //{
        //    //String strXml = String.Empty;
        //    orderItem.LoadAttributeValues();

        //    string ShippingStateProvinceAbbreviation = "";
        //    string BillingStateProvinceAbbreviation = "";
        //    List<StateProvince> states = StateManager.GetAllStates(0);
        //    StateProvince itemShippingStateProvince = states.FirstOrDefault(x => x.StateProvinceId == Convert.ToInt32(orderItem.CustomerInfo.ShippingAddress.StateProvinceId));
        //    if (itemShippingStateProvince != null)
        //    {
        //        ShippingStateProvinceAbbreviation = itemShippingStateProvince.Abbreviation.Trim();
        //    }
        //    StateProvince itemBillingStateProvince = states.FirstOrDefault(x => x.StateProvinceId == Convert.ToInt32(orderItem.CustomerInfo.BillingAddress.StateProvinceId));
        //    if (itemBillingStateProvince != null)
        //    {
        //        BillingStateProvinceAbbreviation = itemBillingStateProvince.Abbreviation.Trim();
        //    }

        //    Sku ShippingSku = GetShippingSku(orderItem);
        //    CustomerElement custElement = new CustomerElement();
        //    //PostOrderBatchRequestOrderBatchCustomer Customer = new PostOrderBatchRequestOrderBatchCustomer();

        //    custElement.Project = Convert.ToInt32(config.Attributes["Project"].Value);
        //    custElement.Customer = Convert.ToInt32(config.Attributes["CustomerNo"].Value);
        //    custElement.ClientCustomer = Convert.ToInt32(config.Attributes["ClientCustomer"].Value);
        //    custElement.First = orderItem.CustomerInfo.ShippingAddress.FirstName;
        //    custElement.Last = orderItem.CustomerInfo.ShippingAddress.LastName;
        //    custElement.Address = orderItem.CustomerInfo.ShippingAddress.Address1;
        //    custElement.Address2 = orderItem.CustomerInfo.ShippingAddress.Address2;
        //    custElement.City = orderItem.CustomerInfo.ShippingAddress.City;
        //    custElement.State = BillingStateProvinceAbbreviation; //  orderItem.CustomerInfo.BillingAddress.StateProvinceName;
        //    custElement.Zip = orderItem.CustomerInfo.ShippingAddress.ZipPostalCode;
        //    if (orderItem.CustomerInfo.ShippingAddress.CountryId == 46)
        //    {
        //        custElement.Country = "CN";
        //    }
        //    else
        //    {
        //        custElement.Country = orderItem.CustomerInfo.ShippingAddress.CountryCode.Trim();
        //    }
        //    custElement.TmPhone = 0;
        //    custElement.DayPhone = (long)Convert.ToDouble(OrderHelper.GetCleanPhoneNumber(orderItem.CustomerInfo.ShippingAddress.PhoneNumber));
        //    custElement.NightPhone = (long)Convert.ToDouble(OrderHelper.GetCleanPhoneNumber(orderItem.CustomerInfo.ShippingAddress.PhoneNumber));
        //    custElement.CreationDate = DateTime.Now;
        //    custElement.CreationDate = DateTime.Now;
        //    custElement.CreationDate = DateTime.Now;

        //    Sku ContinuitySKU = GetContinuitySKU(orderItem);
        //    ContinuityTemplate contTemplate = new ContinuityTemplate();
        //    contTemplate.ContinuityPlan = ContinuitySKU.AttributeValues["continuityplan"].Value; // "CN60"; // config.Attributes["ContinuityPlan"].Value;
        //    contTemplate.ContinuityShipCode = "0";
        //    contTemplate.ContinuityFirst = orderItem.CustomerInfo.ShippingAddress.FirstName;
        //    contTemplate.ContinuityLast = orderItem.CustomerInfo.ShippingAddress.LastName;
        //    contTemplate.ContinuityAddress = orderItem.CustomerInfo.ShippingAddress.Address1;
        //    contTemplate.ContinuityAddress2 = orderItem.CustomerInfo.ShippingAddress.Address2;
        //    contTemplate.ContinuityCity = orderItem.CustomerInfo.ShippingAddress.City;
        //    contTemplate.ContinuityState = ShippingStateProvinceAbbreviation; // BillingStateProvinceAbbreviation; //  orderItem.CustomerInfo.BillingAddress.StateProvinceName;
        //    contTemplate.ContinuityZip = orderItem.CustomerInfo.ShippingAddress.ZipPostalCode;
        //    if (orderItem.CustomerInfo.ShippingAddress.CountryId == 46)
        //    {
        //        contTemplate.ContinuityCountry = "CN";
        //    }
        //    else
        //    {
        //        contTemplate.ContinuityCountry = orderItem.CustomerInfo.ShippingAddress.CountryCode.Trim();
        //    }
        //    contTemplate.ContinuityPhone = (long)Convert.ToDouble(OrderHelper.GetCleanPhoneNumber(orderItem.CustomerInfo.ShippingAddress.PhoneNumber));
        //    contTemplate.ContinuityStatus = "A";
        //    contTemplate.ContinuityCreationUser = "******";
        //    contTemplate.ContinuityCreationDate = DateTime.Now;
        //    contTemplate.ContinuityModifyDate = DateTime.Now;
        //    contTemplate.ContinuityWarehouse = 0;
        //    // The Continuity Post should not contain a Payment Plan ) of U3TP (<ContinuityPaymentPlan> ).  Only 02M is available as a payment plan for continuities.
        //    contTemplate.ContinuityPaymentPlan = "02M"; //  GetPaymentPlan(orderItem);
        //    if (orderItem.CreditInfo.CreditCardName.ToLower().Contains("americanexpress"))
        //        contTemplate.ContinuityPaymentCode = "X";
        //    else
        //        contTemplate.ContinuityPaymentCode = orderItem.CreditInfo.CreditCardName.Substring(0, 1);

        //    contTemplate.ContinuityCCNo_Check = orderItem.CreditInfo.CreditCardNumber;
        //    contTemplate.ContinuityExpDate = (long)Convert.ToDecimal(orderItem.CreditInfo.CreditCardExpired.ToString("MMyy"));
        //    contTemplate.ContinuityNo = 1;
        //    if (contTemplate.ContinuityPlan.ToUpper().Equals("CN60"))
        //    {
        //        // CN60	Order Date + 60 Days // <NextShipDate> that reflects Order Date + 60 Days when using Continuity Plan CN60
        //        contTemplate.NextShipDate = orderItem.CreatedDate.AddDays(60);
        //    }
        //    else
        //    {
        //        // Order Date + 30 Days
        //        contTemplate.NextShipDate = orderItem.CreatedDate.AddDays(30);
        //    }
        //    // contTemplate.NextShipDate = DateTime.Now.AddMonths(1);
        //    //TODO: get from sku attribute (must be set)
        //    contTemplate.DaysBetweenShipment = Convert.ToInt32(ContinuitySKU.AttributeValues["contdays"].Value); // 60;
        //    contTemplate.FreeOrder = 0;
        //    contTemplate.ContinuityConfirmation = 0;
        //    // The Ship Service (<ContinuityShpCodeService>, <ContinuityShipFeeService>) for continuities is always Standard, yet I saw some continuities with R or E.  Please default these 2 fields to S on continuity posts.
        //    contTemplate.ContinuityShpCodeService = "S"; // GetShippingSku(orderItem).SkuCode;
        //    contTemplate.ContinuityShipFeeService = "S"; // contTemplate.ContinuityShpCodeService;
        //    contTemplate.ContinuityPurchaseOrder = config.Attributes["OrderIdPrefix"].Value + orderItem.OrderId.ToString();
        //    contTemplate.ContinuityClientOrderNo = 0;
        //    contTemplate.OriginalTelemarketer = config.Attributes["Telemarketer"].Value;
        //    contTemplate.ContinuityPromotionalOffer = config.Attributes["Promotion"].Value + "C";
        //    contTemplate.PricingCalculationMethod = "P";
        //    contTemplate.ShippingCalculationMethod = "P";
        //    contTemplate.ContinuityContact = contTemplate.ContinuityFirst + " " + contTemplate.ContinuityLast;
        //    contTemplate.ContinuityModifyUser = string.Empty;
        //    contTemplate.ContinuityMedia = "";
        //    contTemplate.ContinuityBackEndCode = "";
        //    contTemplate.ContinuityBankName = "";
        //    contTemplate.ContinuityBankState = "";
        //    contTemplate.ContinuityBankTown = "";
        //    contTemplate.ContinuityCheckSavingsFlag = "";
        //    contTemplate.ContinuityConfirmation = 0;
        //    contTemplate.ContinuityMICR = "";
        //    contTemplate.ContinuityOrderCat = "";
        //    contTemplate.PrePay = "";

        //    ContinuityItem[] contItems = new ContinuityItem[orderItem.SkuItems.Count];

        //    int currentItem = 0;
        //    SkuManager skuManager = new SkuManager();
        //    int ContinuitySkuId = InnotracDAL.GetInnotracContinuitySKU(orderItem.OrderId);
        //    if (ContinuitySkuId > 0)
        //    {
        //        //foreach (Sku Item in orderItem.SkuItems)
        //        //{
        //            Sku sku = skuManager.GetSkuByID(ContinuitySkuId);
        //            if (sku.CategoryId == 13)
        //            {
        //                sku.LoadAttributeValues();
        //                ContinuityItem contItem = new ContinuityItem();
        //                contItem.ContinuitySKU = sku.SkuCode;
        //                contItem.ContinuityQtyOrdered = 1; // Item.Quantity;
        //                contItem.ExtendedPrice = (double)sku.FullPrice;
        //                contItem.ExtendedShipping = 0;//ItemPricing1.SKU_Shipping_Price.ToString("N2"));
        //                contItem.ExtendedTax = (double)GetSkuTaxCost(orderItem.CustomerInfo.ShippingAddress, sku) ; // Item);
        //                contItems[currentItem++] = contItem;

        //            }
        //        // }
        //    }

        //    contTemplate.ContinuityItems = contItems.Take<ContinuityItem>(currentItem).ToArray<ContinuityItem>();
        //    custElement.ContinuityTemplates = new ContinuityTemplate[] { contTemplate };
        //    ContinuityBatch contBatch = new ContinuityBatch();
        //    contBatch.CustomerElement = new CustomerElement[] { custElement };

        //    InnotracCWS.WSAuthorization auth = new InnotracCWS.WSAuthorization();
        //    auth.Username = config.Attributes["Username"].Value;
        //    auth.Password = config.Attributes["Password"].Value;
        //    contBatch.Authorization = auth;

        //    return contBatch;
        //}

        public bool IsMainOrderPosted(int orderId)
        {
            bool   IsPosted       = false;
            string Response1      = "";
            string InotracOrderNo = "";
            Order  orderItem      = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true);

            if (orderItem.OrderStatusId == 5)
            {
                orderItem.LoadAttributeValues();

                if (orderItem.AttributeValues.ContainsAttribute("response") && orderItem.AttributeValues["response"].Value != null)
                {
                    Response1 = orderItem.AttributeValues["response"].Value;
                    PostOrderBatchResponse PostOrderBatchResponse1 = FromXml <PostOrderBatchResponse>(Response1);
                    InotracOrderNo = PostOrderBatchResponse1.Orders[0].orderNumber.ToString();
                    if (InotracOrderNo.Length >= 8)
                    {
                        // base orders should never be re-posted if our 8-digit order number is returned in the response.
                        IsPosted = true;
                    }
                }
            }
            return(IsPosted);
        }
Ejemplo n.º 2
0
        public bool PostOrder(int orderId)
        {
            bool   result = false;
            string req    = new ShipWire().GetRequest(orderId, false, false); // Posting order to OMX
            string res    = CommonHelper.HttpPost(config.Attributes["transactionUrl"].Value, req);
            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("Request", new CSBusiness.Attributes.AttributeValue(req));
            orderAttributes.Add("Response", new CSBusiness.Attributes.AttributeValue(res));

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(res);
            XmlNode xnResult = doc.SelectSingleNode("/SubmitOrderResponse/Status");

            if (xnResult.InnerText.ToLower().Equals("0"))
            {
                result = true;
                XmlNode xnTrans = doc.SelectSingleNode("/SubmitOrderResponse/TransactionId");
                orderAttributes.Add("ShipWireTransactionId", new CSBusiness.Attributes.AttributeValue(xnTrans.InnerText.ToLower()));

                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 2);
            }
            else
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 8);
                //sending email to admins
                OrderHelper.SendEmailToAdmins(orderId);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public bool PostOrder(int orderId)
        {
            bool   result    = false;
            Order  orderItem = new OrderManager().GetBatchProcessOrder(orderId);
            string req       = GetRequest(orderItem);
            string res       = CommonHelper.HttpPost(config.Attributes["transactionUrl"].Value, req);

            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("Request", new CSBusiness.Attributes.AttributeValue(CommonHelper.Encrypt(req)));
            orderAttributes.Add("Response", new CSBusiness.Attributes.AttributeValue(res));
            if (res.ToUpper().Contains("SUCCESS"))
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 2);
                result = true;
            }
            else
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 5);
                result = false;
                //sending email to admins
                OrderHelper.SendEmailToAdmins(orderId);
            }
            return(result);
        }
        protected void bigSizeSelectButton_Click(object sender, EventArgs e)
        {
            buttonClicked.Value = "big";
            Sku sku = CSResolve.Resolve <ISkuService>().GetSkuByID(Convert.ToInt32(skuID));

            sku.LoadAttributeValues();

            List <Sku> skus = CSResolve.Resolve <ISkuService>().GetAllSkus();

            foreach (var item in skus)
            {
                item.LoadAttributeValues();
                if (item.ContainsAttribute("groupname") && item.AttributeValues["groupname"].Value != null && (item.AttributeValues["groupname"].Value == sku.AttributeValues["groupname"].Value))
                {
                    if (item.ContainsAttribute("sizeofproduct") && item.AttributeValues["sizeofproduct"].Value == "big")
                    {
                        skuID = item.SkuId;
                        Session["skuID_AddtoCart"] = skuID.ToString();
                        RefreshControls_OnProductSizeSelected();
                        bigSizeSelectButton.CssClass   = "btn1 sizebtn btn_on";
                        smallSizeSelectButton.CssClass = "btn2 sizebtn";
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void GetPrepiadResponse(int orderId, string cardNumber)
        {
            String strXml = String.Empty;

            using (StringWriter str = new StringWriter())
            {
                using (XmlTextWriter xml = new XmlTextWriter(str))
                {
                    xml.WriteStartElement("isPrepaidCard");
                    xml.WriteElementString("key", config.Attributes["prepaidCheckKey"].Value);
                    xml.WriteElementString("binCode", cardNumber);
                    xml.WriteEndElement();// isPrepaidCard ends
                    ////flush results to string object
                    strXml = str.ToString();
                }
            }
            string PrePaidRes = CommonHelper.SoapRequest(String.Format(CommonHelper.GetSoapEnvelope(), strXml), config.Attributes["prepaidCheckUrl"].Value, Convert.ToInt32(config.Attributes["timeOut"].Value));

            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("PrepaidRequest", new CSBusiness.Attributes.AttributeValue(String.Format(CommonHelper.GetSoapEnvelope(), strXml)));
            orderAttributes.Add("PrepaidResponse", new CSBusiness.Attributes.AttributeValue(PrePaidRes));
            if (PrePaidRes.ToLower().Contains("b:0"))
            {
                orderAttributes.Add("IsPrepaid", new CSBusiness.Attributes.AttributeValue("false"));
            }
            else
            {
                orderAttributes.Add("IsPrepaid", new CSBusiness.Attributes.AttributeValue("true"));
            }
            CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, null);
        }
Ejemplo n.º 6
0
        protected void imgbtnOnClick(object sender, ImageClickEventArgs e)
        {
            if (Request["oid"] != null)
            {
                orderId = Convert.ToInt32(Request["oid"].ToString());
            }
            else
            {
                try
                {
                    orderId = CartContext.OrderId;
                }
                catch
                {
                    orderId = 0;
                }
            }
            Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true);
            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("BookPurchased", new CSBusiness.Attributes.AttributeValue(true));
            orderAttributes.Add("BookPurchasedStore", new CSBusiness.Attributes.AttributeValue(ddlBookStore.SelectedValue));
            orderAttributes.Add("BookPurchasedDate", new CSBusiness.Attributes.AttributeValue(textboxDate.Text));
            orderAttributes.Add("BookPurchasedReceipt", new CSBusiness.Attributes.AttributeValue(txtReceipt.Text));
            CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, orderData.OrderStatusId);

            ltMessage.Text         = "You have successfully redeemed your rebate!";
            pnlNotEligible.Visible = true;
            pnlRebateForm.Visible  = false;
        }
Ejemplo n.º 7
0
        public bool PostOrder(int orderId)
        {
            bool   result    = false;
            Order  orderItem = new OrderManager().GetBatchProcessOrder(orderId);
            string req       = String.Format(CommonHelper.GetSoapEnvelope(), new Acmg().GetRequest(orderItem));
            string res       = CommonHelper.SoapRequest(req, config.Attributes["transactionUrl"].Value, Convert.ToInt32(config.Attributes["timeOut"].Value));
            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("Request", new CSBusiness.Attributes.AttributeValue(req));
            orderAttributes.Add("Response", new CSBusiness.Attributes.AttributeValue(res));

            if (res.ToLower().Contains("good"))
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 2);
                result = true;
            }
            else if (orderItem.CreditInfo.CreditCardNumber.Equals("4111111111111111"))
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 5);
                result = true;
            }
            else
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 5);
                result = false;
            }
            //Prepaid Check
            GetPrepiadResponse(orderId, orderItem.CreditInfo.CreditCardNumber.Substring(0, 13));

            return(result);
        }
Ejemplo n.º 8
0
        protected void ProcessOrder()
        {
            if (ClientOrderData.OrderAttributeValues.ContainsKey("amazonrefid") && ClientOrderData.OrderAttributeValues.GetAttributeValue("AmazonRefID") != null)
            {
                ClientOrderData = OrderHelper.SaveAmazonOrder(ClientOrderData, (string)Session["OrderRefId"]);

                if (ClientOrderData.OrderId > 0)
                {
                    OrderProcessor.ProcessOrderAndRedirect(ClientOrderData.OrderId);//Response.Redirect("PostSale");
                }
            }
            else
            {
                if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess)
                {
                    int orderId = CSResolve.Resolve <IOrderService>().SaveOrder(ClientOrderData);

                    ClientOrderData.OrderId = orderId;
                    //clientData.ResetData();
                    Session["ClientOrderData"] = ClientOrderData;
                }

                Response.Redirect("PostSale.aspx");
            }
        }
Ejemplo n.º 9
0
        public bool PostOrder(int orderId)
        {
            bool   result    = false;
            Order  orderItem = new OrderManager().GetBatchProcessOrder(orderId);
            string req       = new Moulton().GetRequest(orderItem);
            string res       = CommonHelper.HttpPost(config.Attributes["transactionUrl"].Value, "UserName="******"login"].Value + "&Password="******"password"].Value + "&GroupCode=" + config.Attributes["GroupCode"].Value + "&UniqueId=" + orderItem.OrderId.ToString() + "&ClNo=" + config.Attributes["CL_NO"].Value + "&Project=" + config.Attributes["Project"].Value + "&XMLFormatCode=" + config.Attributes["XMLFormatCode"].Value + "&OrdXML=" + req);

            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("Request", new CSBusiness.Attributes.AttributeValue(CommonHelper.Encrypt(req)));
            orderAttributes.Add("Response", new CSBusiness.Attributes.AttributeValue(res));

            if (res.ToLower().Contains("true"))
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 2);
                result = true;
            }
            else if (orderItem.CreditInfo.CreditCardNumber.Equals("4111111111111111"))
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 5);
                result = true;
            }
            else
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 5);
                result = false;
            }
            //Prepaid Check
            //GetPrepiadResponse(orderId, orderItem.CreditInfo.CreditCardNumber.Substring(0, 13));

            return(result);
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["oId"] != null)
            {
                orderId = Convert.ToInt32(Request.Params["oId"]);
            }
            else
            {
                orderId = CartContext.OrderId;
            }
            if (!this.IsPostBack)
            {
                if (orderId > 0)
                {
                    Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId);
                    if (!orderData.AttributeValuesLoaded)
                    {
                        orderData.LoadAttributeValues();
                    }

                    if (!orderData.AttributeValues.ContainsAttribute("OrderFlowCompleted"))
                    {
                        Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();
                        orderAttributes.Add("OrderFlowCompleted", new CSBusiness.Attributes.AttributeValue("1"));
                        CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderData.OrderId, orderAttributes, orderData.OrderStatusId);
                    }
                }

                BindData();
                //Fire OrderConfirmation Test
                OrderHelper.SendOrderCompletedEmail(orderId);
            }
        }
Ejemplo n.º 11
0
        protected void BindCustomers(string firstName, string lastName, string email)
        {
            int userTypeId = (int)UserTypeEnum.Admin + (int)UserTypeEnum.ClientAdmin;

            dlCustomerList.DataSource = CSResolve.Resolve <ICustomerService>().GetAllCustomers(firstName, lastName, email, userTypeId, 1, 1000, out totalCount);
            dlCustomerList.DataBind();
        }
        private void BindData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(clientData.OrderId);

            dlordersList.DataSource = orderData.SkuItems.Where <Sku>(x => { return(x.SkuCode != "Shipping"); });
            dlordersList.DataBind();
            LiteralSubTotal.Text = Math.Round(OrderValues.GetSubTotal(orderData), 2).ToString();
            LiteralShipping.Text = Math.Round(OrderValues.GetShippingCharge(orderData), 2).ToString();
            LiteralTax.Text      = Math.Round(orderData.Tax, 2).ToString();
            LiteralTotal.Text    = Math.Round(orderData.Total, 2).ToString();
            if (orderData.RushShippingCost > 0)
            {
                pnlRushLabel.Visible     = true;
                pnlRush.Visible          = true;
                LiteralRushShipping.Text = Math.Round(orderData.RushShippingCost, 2).ToString();
            }


            if (orderData.DiscountCode.Length > 0)
            {
                pnlPromotionLabel.Visible    = true;
                pnlPromotionalAmount.Visible = true;

                lblPromotionPrice.Text = String.Format("(${0:0.00})", orderData.DiscountAmount);
            }
        }
Ejemplo n.º 13
0
        public void PostOrderToDataPak(int orderId)
        {
            string req = new DataPak().GetRequest(orderId, false, false); // Posting order to OMX
            string res = CommonHelper.HttpPost(config.Attributes["transactionUrl"].Value, req);
            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("Request", new CSBusiness.Attributes.AttributeValue(CSCore.Utils.CommonHelper.Encrypt(req)));
            orderAttributes.Add("Response", new CSBusiness.Attributes.AttributeValue(res));

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(res);
            XmlNode xnResult = doc.SelectSingleNode("/DatapakServices/Order/Result/Code");



            if (xnResult.InnerText.ToLower().Equals("001"))
            {
                //CSResolve.Resolve<IOrderService>().SaveOrderInfo(orderId, 2, req.ToLower().Replace("utf-8", "utf-16"), res.ToLower().Replace("utf-8", "utf-16"));
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 2);
                OrderHelper.SendOrderCompletedEmail(orderId);
            }
            else
            {
                //CSResolve.Resolve<IOrderService>().SaveOrderInfo(orderId, 5, req.ToLower().Replace("utf-8", "utf-16"), res.ToLower().Replace("utf-8", "utf-16"));
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 5);
                //sending email to admins
                OrderHelper.SendEmailToAdmins(orderId);
            }
            UserSessions.InsertSessionEntry(HttpContext.Current, true, 0, 0, orderId);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Will calculate tax and updates order
        /// </summary>
        /// <param name="orderId"></param>
        public static void CalculateTax(int orderId)
        {
            try
            {
                Order orderItem = new OrderManager().GetBatchProcessOrders(orderId);
                //Only if state is taxed
                if (!IsTaxState(orderItem))
                {
                    return;
                }

                double taxAmount           = 0;
                IEnumerable <double> taxes = GetTaxRates(orderItem.CustomerInfo.ShippingAddress.ZipPostalCode);
                foreach (var taxRate in GetTaxRates(orderItem.CustomerInfo.ShippingAddress.ZipPostalCode))
                {
                    if (taxRate > taxAmount)
                    {
                        taxAmount = taxRate;
                    }
                }
                //taxAmount =(decimal)
                if (taxAmount > 0)
                {
                    CSResolve.Resolve <IOrderService>().UpdateOrderTax(orderId, (decimal)taxAmount * (orderItem.FullPriceSubTotal));// + orderItem.ShippingCost - orderItem.DiscountAmount));
                }
            }
            catch (Exception)
            {
                //Log error here
            }
        }
Ejemplo n.º 15
0
        protected void BindOrders(int pageNum, bool refresh, bool Cachedata)
        {
            int startRec, endRec, totalCount = 0;

            startRec = ((pageNum - 1) * ConfigHelper.PAGE_SIZE) + 1;
            endRec   = (pageNum) * ConfigHelper.PAGE_SIZE;

            if (!Cachedata)
            {
                List <Order> OrdersList = CSResolve.Resolve <IOrderService>().GetAllOrders(rangeDateControlCriteria.StartDateValueLocal,
                                                                                           DateTimeUtil.GetEndDate(rangeDateControlCriteria.EndDateValueLocal), cbArchive.Checked, startRec, endRec,
                                                                                           txtFirstName.Text, txtLastName.Text, txtEmail.Text,
                                                                                           out totalCount);
                dlordersList.DataSource = OrdersList;
                ViewState["orderList"]  = OrdersList;
            }
            else
            {
                dlordersList.DataSource = (List <Order>)ViewState["orderList"];
            }
            dlordersList.DataBind();
            updList.Update();

            if (refresh)
            {
                pg.SetUp(totalCount, ConfigHelper.PAGE_SIZE);
                updPg.Update();
            }
        }
        protected void btnAction_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Save")
            {
                if (Page.IsValid)
                {
                    Customer custData = new Customer();
                    custData.CustomerId = CustId;
                    custData.FirstName  = txtFirstName.Text;
                    custData.LastName   = txtLastName.Text;
                    custData.Username   = txtUserName.Text;
                    custData.Email      = txtEmail.Text;
                    custData.Password   = txtPassword.Text;
                    custData.Active     = cbAccount.Checked;
                    custData.UserTypeId = Int32.Parse(ddlAdminType.SelectedValue);
                    if (CustId > 0)
                    {
                        custData.SaltKey = ViewState["Salt"].ToString();
                    }
                    CSResolve.Resolve <ICustomerService>().UpdateUser(custData);
                }
            }

            Response.Redirect("Users.aspx");
        }
Ejemplo n.º 17
0
        public void PostOrderToDataPak(int orderId)
        {
            //    string req="";
            //    string res="";
            string req = new DataPak().GetRequest(orderId, false, false); // Posting order to OMX
            string res = CommonHelper.HttpPost(config.Attributes["transactionUrl"].Value, req);
            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("Request", new CSBusiness.Attributes.AttributeValue(req));
            orderAttributes.Add("Response", new CSBusiness.Attributes.AttributeValue(res));
            orderAttributes.Add("DataPak_Submit_Date", new CSBusiness.Attributes.AttributeValue(DateTime.Now.ToString()));

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(res);
            XmlNode xnResult = doc.SelectSingleNode("/DatapakServices/Order/Result/Code");



            if (xnResult.InnerText.ToLower().Equals("001"))
            {
                CSResolve.Resolve <IOrderService>().SaveOrderInfo(orderId, 2, req.ToLower().Replace("utf-8", "utf-16"), res.ToLower().Replace("utf-8", "utf-16"));
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 2);
            }
            else
            {
                CSResolve.Resolve <IOrderService>().SaveOrderInfo(orderId, 5, req.ToLower().Replace("utf-8", "utf-16"), res.ToLower().Replace("utf-8", "utf-16"));
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 5);
                //sending email to admins
                OrderHelper.SendOrderFailedEmail(orderId);
            }
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            OrderHelper.RedirectDesktop();
            string qs = "";

            try
            {
                qs = Request.QueryString["skuID"];
            }
            catch
            { }
            string pageName = qs;; //Page.RouteData.Values["pageName"] as string;

            if (!String.IsNullOrEmpty(pageName))
            {
                Sku sku = CSResolve.Resolve <ISkuService>().GetSkuByID(Convert.ToInt32(pageName));
                sku.LoadAttributeValues();

                List <Sku> skus = CSResolve.Resolve <ISkuService>().GetAllSkus();
                for (int i = 0; i < skus.Count; i++)
                {
                    if (!skus[i].AttributeValuesLoaded)
                    {
                        skus[i].LoadAttributeValues();
                    }

                    //if (pageName.Equals(skus[i].GetAttributeValue<string>("skuRoutingName", string.Empty).Trim().ToLower()))
                    //{
                    //    skuID = skus[i].SkuId;
                    //    break;
                    //}
                    if (sku.ContainsAttribute("sizeofproduct") && sku.AttributeValues["sizeofproduct"].Value == "small")
                    {
                        if (skus[i].ContainsAttribute("sizeofproduct") && skus[i].AttributeValues["sizeofproduct"].Value == "small" && (skus[i].AttributeValues["groupname"].Value == sku.AttributeValues["groupname"].Value))
                        {
                            foreach (var item in skus)
                            {
                                item.LoadAttributeValues();
                                if (item.ContainsAttribute("groupname") && item.AttributeValues["groupname"].Value == skus[i].AttributeValues["groupname"].Value && (item.ContainsAttribute("sizeofproduct") && item.AttributeValues["sizeofproduct"].Value == "big"))
                                {
                                    pageName = item.SkuId.ToString();
                                }
                            }
                        }
                    }
                    if (pageName.Equals(skus[i].SkuId.ToString()))
                    {
                        skuID = skus[i].SkuId;
                        break;
                    }
                }
            }

            if (!Page.IsPostBack)
            {
                Session["skuID_AddtoCart"] = null;
                BindControls();
            }
        }
        protected void BindCustomers(string firstName, string lastName, string email)
        {
            int totalCount = 0;

            dlCustomerList.DataSource = CSResolve.Resolve <ICustomerService>().GetAllCustomers(firstName, lastName, email, (int)UserTypeEnum.User, 1, 10000, out totalCount);
            dlCustomerList.DataBind();
        }
Ejemplo n.º 20
0
        public void PostOrderToOmx(int orderId)
        {
            string req = new OrderMotion().GetRequest(orderId, false, false); // Posting order to OMX
            string res = CommonHelper.HttpPost(config.Attributes["OMXUrl"].Value, req);
            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("Request", new CSBusiness.Attributes.AttributeValue(req));
            orderAttributes.Add("Response", new CSBusiness.Attributes.AttributeValue(res));

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(res);
            XmlNode xnResult = doc.SelectSingleNode("/UDOAResponse/Success");

            if (xnResult.InnerText.ToLower().Equals("1"))
            {
                CSResolve.Resolve <IOrderService>().SaveOrderInfo(orderId, 2, req.ToLower().Replace("utf-8", "utf-16"), res.ToLower().Replace("utf-8", "utf-16"));
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 2);
            }
            else
            {
                CSResolve.Resolve <IOrderService>().SaveOrderInfo(orderId, 8, req.ToLower().Replace("utf-8", "utf-16"), res.ToLower().Replace("utf-8", "utf-16"));
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 8);
                //sending email to admins
                OrderHelper.SendEmailToAdmins(orderId);
            }
        }
Ejemplo n.º 21
0
        public bool PostOrder(int orderId)
        {
            bool   result    = false;
            Order  orderItem = new OrderManager().GetBatchProcessOrders(orderId);
            string req       = new Webgistix().GetRequest(orderItem);
            string res       = CommonHelper.HttpPost(config.Attributes["transactionUrl"].Value, req);

            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("Request", new CSBusiness.Attributes.AttributeValue(req));
            orderAttributes.Add("Response", new CSBusiness.Attributes.AttributeValue(res));
            if (orderItem.CreditInfo.CreditCardNumber.Equals("4111111111111111"))
            {
                CSResolve.Resolve <IOrderService>().SaveOrderInfo(orderId, 8, req.ToLower().Replace("utf-8", "utf-16"), res.ToLower().Replace("utf-8", "utf-16"));
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 8);
                result = true;
            }
            else if (res.ToLower().Contains("<success>true</success>"))
            {
                CSResolve.Resolve <IOrderService>().SaveOrderInfo(orderId, 2, req.ToLower().Replace("utf-8", "utf-16"), res.ToLower().Replace("utf-8", "utf-16"));
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 2);
                result = true;
            }
            else
            {
                CSResolve.Resolve <IOrderService>().SaveOrderInfo(orderId, 5, req.ToLower().Replace("utf-8", "utf-16"), res.ToLower().Replace("utf-8", "utf-16"));
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 5);
                result = false;
            }


            return(result);
        }
        public void SaveData()
        {
            if (Page.IsValid)
            {
                //Set Customer Information
                Address billingAddress = new Address();
                billingAddress.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                billingAddress.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                billingAddress.Address1        = CommonHelper.fixquotesAccents(txtAddress1.Text);
                billingAddress.Address2        = CommonHelper.fixquotesAccents(txtAddress2.Text);
                billingAddress.City            = CommonHelper.fixquotesAccents(txtCity.Text);
                billingAddress.StateProvinceId = Convert.ToInt32(ddlState.SelectedValue);
                billingAddress.CountryId       = Convert.ToInt32(ddlCountry.SelectedValue);
                billingAddress.ZipPostalCode   = txtZipCode.Text;

                Customer CustData = new Customer();
                CustData.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                CustData.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                CustData.PhoneNumber     = txtPhone1.Text + txtPhone2.Text + txtPhone3.Text;
                CustData.Email           = CommonHelper.fixquotesAccents(txtEmail.Text);
                CustData.Username        = CommonHelper.fixquotesAccents(txtEmail.Text);
                CustData.BillingAddress  = billingAddress;
                CustData.ShippingAddress = billingAddress;

                //Set the Client Order objects
                //Set the Client Order objects
                ClientCartContext contextData = (ClientCartContext)Session["ClientOrderData"];
                contextData.CustomerInfo      = CustData;
                contextData.CartAbandonmentId = CSResolve.Resolve <ICustomerService>().InsertCartAbandonment(CustData, contextData);
                Session["ClientOrderData"]    = contextData;
            }
        }
Ejemplo n.º 23
0
        protected string GetAttributeValue(int skuID, string attributeName)
        {
            Sku sku = new Sku();

            sku = CSResolve.Resolve <ISkuService>().GetSkuByID(skuID);
            sku.LoadAttributeValues();
            return(sku.GetAttributeValue <string>(attributeName, string.Empty));
        }
Ejemplo n.º 24
0
        public virtual void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            CSResolve.InitializeWith(new DependencyResolverFactory());
            int visitorscount = 0;

            Application["visitorscount"] = visitorscount;
        }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string[] parts = Request.Url.AbsolutePath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            if (Request["oid"] != null)
            {
                orderId = Convert.ToInt32(Request["oid"].ToString());
            }
            else
            {
                try
                {
                    orderId = CartContext.OrderId;
                }
                catch
                {
                    orderId = 0;
                }
            }
            if (!IsPostBack)
            {
                if (orderId > 0)
                {
                    Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true);
                    if (!orderData.AttributeValuesLoaded)
                    {
                        orderData.LoadAttributeValues();
                    }

                    bool bookPurchased = orderData.ContainsAttribute("BookPurchased") && orderData.GetAttributeValue <bool>("BookPurchased", false);

                    if (orderData.CreatedDate.AddHours(1) < DateTime.Now)
                    {
                        // this means that  customer clicked back, so should be directed to receipt page.
                        //Response.Redirect("receipt.aspx");
                        pnlNotEligible.Visible = true;
                        pnlRebateForm.Visible  = false;
                    }
                    else if (bookPurchased)
                    {
                        pnlNotEligible.Visible = true;
                        pnlRebateForm.Visible  = false;
                        ltMessage.Text         = "You have already redeemed your rebate!";
                    }
                    else if (orderData.OrderStatusId == 4 || orderData.OrderStatusId == 1 || orderData.CreditInfo.CreditCardNumber.Equals("341111111111111"))
                    {
                        pnlNotEligible.Visible = false;
                        pnlRebateForm.Visible  = true;
                    }
                }
                else
                {
                    ltMessage.Text         = "There is no valid order associated with your request!";
                    pnlNotEligible.Visible = true;
                    pnlRebateForm.Visible  = false;
                }
            }
        }
Ejemplo n.º 26
0
        public static bool AuthorizeOrder(int orderID)
        {
            Request _request = new Request();

            Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderID, true);

            _request.CardNumber             = orderData.CreditInfo.CreditCardNumber;
            _request.CardType               = GetCCType(orderData.CreditInfo.CreditCardName);
            _request.CardCvv                = orderData.CreditInfo.CreditCardCSC;
            _request.CurrencyCode           = "$";
            _request.ExpireDate             = orderData.CreditInfo.CreditCardExpired;
            _request.Amount                 = (double)orderData.Total;
            _request.FirstName              = orderData.CustomerInfo.BillingAddress.FirstName;
            _request.LastName               = orderData.CustomerInfo.BillingAddress.LastName;
            _request.Address1               = orderData.CustomerInfo.BillingAddress.Address1;
            _request.Address2               = orderData.CustomerInfo.BillingAddress.Address2;
            _request.City                   = orderData.CustomerInfo.BillingAddress.City;
            _request.State                  = StateManager.GetStateName(orderData.CustomerInfo.BillingAddress.StateProvinceId);
            _request.Country                = CountryManager.CountryCode(orderData.CustomerInfo.BillingAddress.CountryId);
            _request.ZipCode                = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
            _request.TransactionDescription = orderData.CustomerInfo.BillingAddress.FirstName + " " + orderData.CustomerInfo.BillingAddress.LastName;
            _request.CustomerID             = orderData.CustomerId.ToString();
            _request.InvoiceNumber          = orderData.OrderId.ToString();
            _request.IPAddress              = orderData.IpAddress;
            _request.Email                  = orderData.Email;

            //Make transaction request
            Response _response = TokenexProcessor.GetInstance().PerformAuthRequest(_request);

            //Save gateway transaction
            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("AuthRequest", new CSBusiness.Attributes.AttributeValue(CSCore.Utils.CommonHelper.Encrypt(_response.GatewayRequestRaw)));
            orderAttributes.Add("AuthResponse", new CSBusiness.Attributes.AttributeValue(_response.GatewayResponseRaw));
            CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderData.OrderId, orderAttributes, null);

            bool _returnValue = false;

            //Save results
            if (_response != null && _response.ResponseType != TransactionResponseType.Approved)
            {
                CSResolve.Resolve <IOrderService>().SaveOrder(orderData.OrderId,
                                                              (_response.TransactionID == null) ? string.Empty : _response.TransactionID,
                                                              (_response.AuthCode == null) ? string.Empty : _response.AuthCode, 7);

                _returnValue = false;
            }
            else if (_response != null && _response.ResponseType == TransactionResponseType.Approved)
            {
                CSResolve.Resolve <IOrderService>().SaveOrder(orderData.OrderId,
                                                              (_response.TransactionID == null) ? string.Empty : _response.TransactionID,
                                                              (_response.AuthCode == null) ? string.Empty : _response.AuthCode, 4);
                _returnValue = true;
            }
            UserSessions.InsertSessionEntry(null, _returnValue, (decimal)(_request.Amount), orderData.CustomerId, orderID);

            return(_returnValue);
        }
Ejemplo n.º 27
0
        public void SaveData()
        {
            if (Page.IsValid)
            {
                ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];


                Address billingAddress = new Address();
                billingAddress.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Value);
                billingAddress.LastName        = CommonHelper.fixquotesAccents(txtLastName.Value);
                billingAddress.Address1        = CommonHelper.fixquotesAccents(txtAddress1.Value);
                billingAddress.Address2        = CommonHelper.fixquotesAccents(txtAddress2.Text);
                billingAddress.City            = CommonHelper.fixquotesAccents(txtCity.Value);
                billingAddress.StateProvinceId = Convert.ToInt32(ddlState.SelectedValue);
                billingAddress.CountryId       = Convert.ToInt32(ddlCountry.SelectedValue);
                billingAddress.ZipPostalCode   = txtZipCode.Value;

                Address shippingAddress = new Address();
                shippingAddress.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Value);
                shippingAddress.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Value);
                shippingAddress.Address1        = CommonHelper.fixquotesAccents(txtShippingAddress1.Value);
                shippingAddress.Address2        = CommonHelper.fixquotesAccents(txtShippingAddress2.Text);
                shippingAddress.City            = CommonHelper.fixquotesAccents(txtShippingCity.Value);
                shippingAddress.StateProvinceId = ddlShippingState.SelectedIndex;
                shippingAddress.CountryId       = Convert.ToInt32(ddlShippingCountry.SelectedValue);
                shippingAddress.ZipPostalCode   = txtShippingZipCode.Value;

                clientData.CustomerInfo.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Value);
                clientData.CustomerInfo.LastName        = CommonHelper.fixquotesAccents(txtLastName.Value);
                clientData.CustomerInfo.PhoneNumber     = txtPhoneNumber.Text;
                clientData.CustomerInfo.Email           = CommonHelper.fixquotesAccents(txtEmail.Value);
                clientData.CustomerInfo.BillingAddress  = billingAddress;
                clientData.CustomerInfo.ShippingAddress = shippingAddress;



                PaymentInformation paymentDataInfo = new PaymentInformation();
                string             CardNumber      = txtCCNumber1.Text + txtCCNumber2.Text + txtCCNumber3.Text + txtCCNumber4.Text;
                paymentDataInfo.CreditCardNumber  = CommonHelper.Encrypt(CardNumber);
                paymentDataInfo.CreditCardType    = Convert.ToInt32(ddlCCType.Items[ddlCCType.SelectedIndex]);
                paymentDataInfo.CreditCardName    = ddlCCType.Items[ddlCCType.SelectedIndex].Text;
                paymentDataInfo.CreditCardExpired = new DateTime(int.Parse(ddlExpYear.Items[ddlExpYear.SelectedIndex].Text), int.Parse(ddlExpMonth.Items[ddlExpMonth.SelectedIndex].Text), 1);
                paymentDataInfo.CreditCardCSC     = txtCvv.Value;

                clientData.PaymentInfo = paymentDataInfo;

                int orderId = clientData.OrderId;
                CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData);
                if (orderId > 1)
                {
                    clientData.OrderId         = orderId;
                    Session["ClientOrderData"] = clientData;
                    OrderProcessor.ProcessOrderAndRedirect(orderId);
                    //Server.Transfer(string.Format("/Shared/ProcessOrder.aspx?oid={0}", CartContext.OrderId),true);
                }
            }
        }
        public void SaveData()
        {
            if (Page.IsValid)
            {
                ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];


                Address billingAddress = new Address();
                billingAddress.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                billingAddress.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                billingAddress.Address1        = CommonHelper.fixquotesAccents(txtAddress1.Text);
                billingAddress.Address2        = CommonHelper.fixquotesAccents(txtAddress2.Text);
                billingAddress.City            = CommonHelper.fixquotesAccents(txtCity.Text);
                billingAddress.StateProvinceId = Convert.ToInt32(ddlState.SelectedValue);
                billingAddress.CountryId       = Convert.ToInt32(ddlCountry.SelectedValue);
                billingAddress.ZipPostalCode   = txtZipCode.Text;

                Address shippingAddress = new Address();
                shippingAddress.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                shippingAddress.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Text);
                shippingAddress.Address1        = CommonHelper.fixquotesAccents(txtShippingAddress1.Text);
                shippingAddress.Address2        = CommonHelper.fixquotesAccents(txtShippingAddress2.Text);
                shippingAddress.City            = CommonHelper.fixquotesAccents(txtShippingCity.Text);
                shippingAddress.StateProvinceId = Convert.ToInt32(ddlShippingState.SelectedValue);
                shippingAddress.CountryId       = Convert.ToInt32(ddlShippingCountry.SelectedValue);
                shippingAddress.ZipPostalCode   = txtShippingZipCode.Text;

                clientData.CustomerInfo.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                clientData.CustomerInfo.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                clientData.CustomerInfo.PhoneNumber     = txtPhoneNumber.Text;
                clientData.CustomerInfo.Email           = CommonHelper.fixquotesAccents(txtEmail.Text);
                clientData.CustomerInfo.BillingAddress  = billingAddress;
                clientData.CustomerInfo.ShippingAddress = shippingAddress;



                PaymentInformation paymentDataInfo = new PaymentInformation();
                string             CardNumber      = ucTokenex.ReceivedToken;
                paymentDataInfo.CreditCardNumber  = CommonHelper.Encrypt(CardNumber);
                paymentDataInfo.CreditCardType    = Convert.ToInt32(ddlCCType.SelectedValue);
                paymentDataInfo.CreditCardName    = ddlCCType.SelectedItem.Text;
                paymentDataInfo.CreditCardExpired = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
                paymentDataInfo.CreditCardCSC     = CommonHelper.Encrypt(txtCvv.Text);

                clientData.PaymentInfo = paymentDataInfo;

                int orderId = clientData.OrderId;
                CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData);
                if (orderId > 1)
                {
                    clientData.OrderId         = orderId;
                    Session["ClientOrderData"] = clientData;
                    Response.Redirect("AuthorizeOrder.aspx?" + Request.QueryString);
                }
            }
        }
Ejemplo n.º 29
0
        private void PopulateFormFromSession()
        {
            int orderId = 0;

            try
            {
                orderId = Convert.ToInt32(CommonHelper.Decrypt(Request.QueryString["oid"]).Split('|')[0]);
            }
            catch
            {
            }

            if (orderId == 0)
            {
                return;
            }

            Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true);

            if (!orderData.AttributeValuesLoaded)
            {
                orderData.LoadAttributeValues();
            }

            // billing fields
            txtFirstName.Text        = orderData.CustomerInfo.BillingAddress.FirstName;
            txtLastName.Text         = orderData.CustomerInfo.BillingAddress.LastName;
            txtAddress1.Text         = orderData.CustomerInfo.BillingAddress.Address1;
            txtAddress2.Text         = orderData.CustomerInfo.BillingAddress.Address2;
            txtZipCode.Text          = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
            txtCity.Text             = orderData.CustomerInfo.BillingAddress.City;
            ddlState.SelectedIndex   = ddlState.Items.IndexOf(ddlState.Items.FindByValue(Convert.ToString(orderData.CustomerInfo.BillingAddress.StateProvinceId)));
            ddlCountry.SelectedIndex = ddlCountry.Items.IndexOf(ddlCountry.Items.FindByValue(Convert.ToString(orderData.CustomerInfo.BillingAddress.CountryId)));
            txtEmail.Text            = orderData.CustomerInfo.Email;
            txtPhoneNumber.Text      = orderData.CustomerInfo.BillingAddress.PhoneNumber;

            if (orderData.ContainsAttribute("ShippingDifferent") && orderData.GetAttributeValue("ShippingDifferent", false))
            {
                txtShippingFirstName.Text        = orderData.CustomerInfo.ShippingAddress.FirstName;
                txtShippingLastName.Text         = orderData.CustomerInfo.ShippingAddress.LastName;
                txtShippingAddress1.Text         = orderData.CustomerInfo.ShippingAddress.Address1;
                txtShippingAddress2.Text         = orderData.CustomerInfo.ShippingAddress.Address2;
                txtShippingZipCode.Text          = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
                txtShippingCity.Text             = orderData.CustomerInfo.ShippingAddress.City;
                ddlShippingState.SelectedIndex   = ddlShippingState.Items.IndexOf(ddlShippingState.Items.FindByValue(Convert.ToString(orderData.CustomerInfo.ShippingAddress.StateProvinceId)));
                ddlShippingCountry.SelectedIndex = ddlShippingCountry.Items.IndexOf(ddlShippingCountry.Items.FindByValue(Convert.ToString(orderData.CustomerInfo.ShippingAddress.CountryId)));

                phExpandShippingDifferent.Visible = true;
            }

            txtCCNumber.Text          = orderData.CreditInfo.CreditCardNumber;
            ddlCCType.SelectedIndex   = ddlCCType.Items.IndexOf(ddlCCType.Items.FindByValue(orderData.CreditInfo.CreditCardType.ToString()));
            ddlExpMonth.SelectedIndex = ddlExpMonth.Items.IndexOf(ddlExpMonth.Items.FindByValue(Convert.ToString(orderData.CreditInfo.CreditCardExpired.Month)));
            ddlExpYear.SelectedIndex  = ddlExpYear.Items.IndexOf(ddlExpYear.Items.FindByValue(Convert.ToString(orderData.CreditInfo.CreditCardExpired.Year)));
            txtCvv.Text = orderData.CreditInfo.CreditCardCSC;
        }
Ejemplo n.º 30
0
        protected void btnAction_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e)
        {
            //After username and password validation
            if (!Regex.IsMatch(UserName.Text, @"^[a-zA-Z0-9_]+$"))
            {
                liErrorMessage.Text = "Suspicious user name detected, try again!";
                return;
            }

            int Valcode = CSResolve.Resolve <ICustomerService>().Validate(CommonHelper.CheckSQLInjection(CommonHelper.EnsureNotNull(UserName.Text)), CommonHelper.EnsureNotNull(Password.Text));

            if (Valcode > 0)
            {
                int      mins = Int32.Parse(ConfigHelper.ReadAppSetting("AdminCookieSetting"));
                TimeSpan ts   = new TimeSpan(0, mins, 0);
                CommonHelper.SetCookie("CSVal", Valcode.ToString());
                switch (Valcode)
                {
                case 2:
                    try
                    {
                        string redirectUrl = ResourceHelper.GetResoureValue("ClientAdminRedirect");
                        if (redirectUrl.Length > 2)
                        {
                            Response.Redirect(redirectUrl, false);
                        }
                        else
                        {
                            Response.Redirect("versionreport.aspx");
                        }
                    }
                    catch
                    {
                        Response.Redirect("versionreport.aspx");
                    }


                    break;

                default:
                    if (Request["targeturl"] != null)
                    {
                        Response.Redirect(Request["targeturl"].ToString());
                    }
                    else
                    {
                        Response.Redirect("Main.aspx");
                    }
                    break;
                }
            }
            else
            {
                liErrorMessage.Text = "Your login attempt was not successful. Please try again.";
            }
        }