public static int GetVersion() { int versionId = 1; //string version = HttpContext.Current.Request.Url.AbsolutePath.ToLower(); string version = VersionManager.OriginaUri.AbsolutePath.ToLower(); version = version.Substring(0, version.LastIndexOf('/')); version = version.Substring(version.LastIndexOf('/') + 1, (version.Length - (version.LastIndexOf('/') + 1))); if (version == "") { version = "control"; } List <CSBusiness.Version> list = (CSFactory.GetCacheSitePref()).VersionItems; CSBusiness.Version item = list.Find(x => x.Title.ToLower() == version); if (item != null) { versionId = item.VersionId; } return(versionId); }
protected override void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { base.Page_Load(sender, e); SitePreference sitePrefCache = CSFactory.GetCacheSitePref(); if (Request.Headers["X-HTTPS"] != null) { if (Request.Headers["X-HTTPS"].ToLower().Equals("no")) { if (Request.Url.ToString().Contains("www")) { Response.Redirect((Request.Url.ToString().Replace("http:/", "https:/").Replace("index.aspx", ""))); } else { Response.Redirect((Request.Url.ToString().Replace("http:/", "https:/").Replace("https://", "https://www.").Replace("index.aspx", ""))); } } } } }
private void GoToNextTemplate() { CurrentTemplateIndex++; if (CurrentTemplateIndex < AllTemplates.Count) { LoadTemplate(CurrentTemplateIndex); } else { //Set gift wrap items /////CSWebBase.OrderValues.SetGiftWrap(CartContext); //SriComments: Admin may setup path with empty templates: kevin business case //If Authorization is needed, use Server.Transfer("AuthorizeOrder.aspx"); instead of Response.Redirect("CheckoutThankYou.aspx"); if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess) { Server.Transfer("AuthorizeOrder.aspx");//Response.Redirect("CheckoutThankYou.aspx"); } else { Response.Redirect("ReviewOrder.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SitePref item = CSFactory.GetSitePreference(); if (item.PathOrderDate.Value.Year != 2079) { dateControlStart.ValueLocal = item.PathOrderDate; } tblCurrency.Text = item.Currency; CbShippingOption.Checked = item.OrderTotalShipping; cbGeoTarget.Checked = item.GeoTargetService; txtDays.Text = item.ArchiveData.ToString(); txtTitle.Text = item.SiteHeader; txtImagePath.Text = item.LogoPath; txtSiteName.Text = item.SiteName; txtSiteUrl.Text = item.SiteUrl; cbPaymentGateway.Checked = item.PaymentGatewayService; cbFulfillmentHouse.Checked = item.FulfillmentHouseService; BindOrderProcess(item.OrderProcessType); ucAttributes.Populate(CSFactory.GetCacheSitePref()); } }
protected void Page_Load(object sender, EventArgs e) { versionName = CSWeb.OrderHelper.GetVersionName(); if (versionName == "") { versionName = "control"; List <CSBusiness.Version> list = (CSFactory.GetCacheSitePref()).VersionItems; CSBusiness.Version item = list.Find(x => x.Title.ToLower() == versionName.ToLower()); if (item != null) { versionName = item.Title.ToUpper(); } } string url = Request.Url.AbsolutePath.ToLower(); try { if (url.EndsWith("/postsale.aspx")) { versionNameClientFunction = "'" + Session["PostSaleLabelName"].ToString() + "'"; } else { versionNameClientFunction = "GetClientVersionName('" + versionName + "')"; } } catch { } //versionNameReferrer = CSWeb.OrderHelper.GetVersionNameByReferrer(CartContext); SetHomePagePnl(); SetHomeAndSubPagesPnl(); SetCartPagePnl(); SetAllPagesPnl(); SetReceiptPagePnl(); }
public static Dictionary <string, string> GetDynamicsid(string sid, int orderId) { //string xmlData = ""; Order orderItem = new OrderManager().GetBatchProcessOrder(orderId); List <CSBusiness.Version> list = (CSFactory.GetCacheSitePref()).VersionItems; Dictionary <string, string> dict = new Dictionary <string, string>(); string connectionString = ConfigHelper.GetDBConnection(); CSBusiness.Version item = list.Find(x => x.Title.ToLower() == orderItem.VersionName.ToLower()); int versionName = 43; if (item != null) { versionName = item.VersionId; } String ProcName = "pr_site_get_dynamic_sid"; SqlParameter[] ParamVal = new SqlParameter[6]; ParamVal[0] = new SqlParameter("sid", sid ?? string.Empty); ParamVal[1] = new SqlParameter("@versionid", versionName); using (SqlDataReader reader = BaseSqlHelper.ExecuteReader(connectionString, ProcName, ParamVal)) { while (reader.Read()) { dict.Add("sid", sid); dict.Add("source", reader["source"].ToString()); dict.Add("media", reader["media"].ToString()); dict.Add("ProjectCode", reader["ProjectCode"].ToString()); dict.Add("PhoneNumber", reader["PhoneNumber"].ToString()); //xmlData = reader["DataXML"].ToString(); } } return(dict); }
protected void btnAction_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e) { switch (e.CommandName) { case "AddNew": pnlAddCategory.Visible = true; //LanguageControl.Bind(); BindCategory(); break; case "Cancel": pnlAddCategory.Visible = false; txtCategory.Text = ""; break; case "Add": if (Page.IsValid) { int orderno = 0; if (!string.IsNullOrEmpty(txtorder.Text)) { orderno = Convert.ToInt32(txtorder.Text); } CSFactory.SaveCategoy(txtCategory.Text, orderno); } pnlAddCategory.Visible = false; txtCategory.Text = ""; BindCategory(); break; case "Back": Response.Redirect("Main.aspx"); break; } }
public void LoadScripts(Page page) { //Adding scripts to header if (CartContext != null) { SitePreference sitePref = CSFactory.GetCacheSitePref(); if (!sitePref.AttributeValuesLoaded) { sitePref.LoadAttributeValues(); } if (sitePref.AttributeValues != null) { if (sitePref.ContainsAttribute("scripts") != null) { Literal li = new Literal(); li.Text = sitePref.AttributeValues["scripts"].Value; if (page.Header != null) { page.Header.Controls.Add(li); } } } } }
protected void Page_Load(object sender, EventArgs e) { BindSettings(); if (!IsPostBack) { this.BaseLoad(); //liHeader.Text = DateTime.Now.ToString("MMMM") + " " + DateTime.Now.Day.ToString() + ", " + DateTime.Now.Year.ToString(); // liSubHeader.Text = DateTime.Now.DayOfWeek + " " + DateTime.Now.AddHours(3).ToShortTimeString() + " (EST)"; ddlVersion.DataSource = CSFactory.GetAllVersion().FindAll(x => x.Visible == true); ddlVersion.DataTextField = "Title"; ddlVersion.DataValueField = "VersionId"; ddlVersion.DataBind(); ddlVersion.Items.Insert(0, new ListItem("All", "0")); //ddlPaths.DataSource = new PathManager().GetAllPaths(false); //ddlPaths.DataTextField = "Title"; //ddlPaths.DataValueField = "PathId"; //ddlPaths.DataBind(); //ddlPaths.Items.Insert(0, new ListItem("Select", "0")); if (Session["FilterFromDate"] != null && Session["FilterToDate"] != null) { rangeDateControlCriteria.StartDateValueLocal = Convert.ToDateTime(Session["FilterFromDate"]); rangeDateControlCriteria.EndDateValueLocal = Convert.ToDateTime(Session["FilterToDate"]); } else { rangeDateControlCriteria.StartDateValueLocal = DateTime.Now.Date; rangeDateControlCriteria.EndDateValueLocal = DateTime.Now.Date; } BindData(rangeDateControlCriteria.StartDateValueLocal, rangeDateControlCriteria.EndDateValueLocal.Value.AddDays(1), 0, 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 { orderId = CartContext.OrderId; } Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true); if (orderData.OrderStatusId == 2) { // this means that customer clicked back, so should be directed to receipt page. Response.Redirect("receipt.aspx"); } if (!IsPostBack) { CSWebBase.SiteBasePage.TempOrderFix(CartContext, orderData.OrderStatusId); //new CSWeb.FulfillmentHouse.DataPakTax().CalculateTax(orderId); Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>(); if (orderData.CreditInfo.CreditCardNumber.Equals("4444333322221111")) { CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderData.OrderId, orderAttributes, 7); Response.Redirect("receipt.aspx"); } else if (orderData.CreditInfo.CreditCardNumber.Equals("4111111111111111") && !orderData.CreditInfo.CreditCardCSC.Equals("999")) { CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderData.OrderId, orderAttributes, 7); Response.Redirect(string.Format("carddecline.aspx?returnUrl={0}", string.Concat("/", string.Join("/", parts, 0, parts.Length - 1), "/receipt.aspx")), true); } if (orderData.CreditInfo.CreditCardNumber.Equals("1111222233334444")) { if (orderData.OrderStatusId == 4) { } else { string message = OrderHelper.FinalizePayPalTransaction((ClientCartContext)Session["ClientOrderData"]); if (!string.IsNullOrEmpty(message)) { lblMessage.Text = message; } else { lblMessage.Text = string.Empty; SiteBasePage.ResetPayPal(); Response.Redirect("receipt.aspx", true); } } } bool authSuccess = false; // Check if payment gateway service is enabled or not. if (CSFactory.GetCacheSitePref().PaymentGatewayService) { try { authSuccess = orderData.OrderStatusId == 4 || orderData.OrderStatusId == 5 || // fulfillment failure (fulfillment was attempted after payment success), so don't charge again. OrderHelper.AuthorizeOrder(orderId); } catch (Exception ex) { CSCore.CSLogger.Instance.LogException("AuthorizeOrder - auth error - orderid: " + Convert.ToString(orderId), ex); throw; } } else { authSuccess = true; } if (authSuccess) { // Check if fulfillment gateway service is enabled or not. if (CSFactory.GetCacheSitePref().FulfillmentHouseService) { try { new CSWeb.FulfillmentHouse.Moulton().PostOrder(orderId); } catch (Exception ex) { CSCore.CSLogger.Instance.LogException("AuthorizeOrder - fulfillment post error - orderid: " + Convert.ToString(orderId), ex); throw; } if (Request.QueryString != null) { Response.Redirect("receipt.aspx?" + Request.QueryString); } else { Response.Redirect("receipt.aspx"); } } } else { Response.Redirect(string.Format("carddecline.aspx?returnUrl={0}", string.Concat("/", string.Join("/", parts, 0, parts.Length - 1), "/receipt.aspx")), true); } } Response.Redirect("receipt.aspx"); }
public void SaveData() { ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"]; // attribute save example //clientData.OrderAttributeValues = new Dictionary<string, CSBusiness.Attributes.AttributeValue>(); //clientData.OrderAttributeValues.Add("ref_url", new CSBusiness.Attributes.AttributeValue("http://www.google.com")); if (clientData.OrderAttributeValues == null) { clientData.OrderAttributeValues = new Dictionary <string, CSBusiness.Attributes.AttributeValue>(); } clientData.OrderAttributeValues.Add("CustomOrderId", new CSBusiness.Attributes.AttributeValue("CS" + CommonHelper.GetRandonOrderNumber(DateTime.Now))); clientData.OrderAttributeValues.Add("cartabandonmentid", new CSBusiness.Attributes.AttributeValue(clientData.CartAbandonmentId.ToString())); //Recapture billing information if the user modified the information if (rId == 0) { if (Convert.ToBoolean(!cbBillingDifferent.Checked)) //override if the user select yes button { 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(txtShippingFirstName.Text); clientData.CustomerInfo.LastName = CommonHelper.fixquotesAccents(txtShippingLastName.Text); clientData.CustomerInfo.ShippingAddress = shippingAddress; } } SetShippingAddress(); clientData.CartInfo.CartItems.Clear(); clientData.CartInfo.ShippingAddress = clientData.CustomerInfo.ShippingAddress; int pid = 104; int pid2 = 0; if (clientData.CustomerInfo.ShippingAddress.CountryId == 46) // Canada { pid2 = 108; } else if (clientData.CustomerInfo.ShippingAddress.CountryId == 231) //US { if (clientData.CustomerInfo.ShippingAddress.StateProvinceId == 1 || clientData.CustomerInfo.ShippingAddress.StateProvinceId == 389 || clientData.CustomerInfo.ShippingAddress.StateProvinceId == 388 || clientData.CustomerInfo.ShippingAddress.StateProvinceId == 11 || clientData.CustomerInfo.ShippingAddress.StateProvinceId == 390) { pid2 = 108; } } //int qId = 1; clientData.CartInfo.AddOrUpdate(pid, 1, true, false, false); clientData.CartInfo.AddOrUpdate(107, 1, false, false, false); if (pid2 > 0) { clientData.CartInfo.AddOrUpdate(pid2, 1, false, false, false); } clientData.CartInfo.Compute(); // Response.Redirect(string.Format("AddProduct.aspx?PId={0}&CId={1}&QId={2}&DId={3}", //pid, Convert.ToString((int)CSBusiness.ShoppingManagement.ShoppingCartType.SingleCheckout), ddlQuantityList.SelectedValue, 50)); PaymentInformation paymentDataInfo = new PaymentInformation(); string CardNumber = txtCCNumber.Text; 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 = txtCvv.Text; CartContext.PaymentInfo = paymentDataInfo; int orderId = 0; if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess || CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder) { //Save Order information before upsale process if (rId == 1) { orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData); } else { //update order with modified customer shipping and billing and credit card information orderId = clientData.OrderId; CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData); } if (orderId > 1) { clientData.OrderId = orderId; Session["ClientOrderData"] = clientData; if (rId == 1) { Response.Redirect("PostSale.aspx"); } else { Response.Redirect("CardDecline.aspx"); } } } }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!Page.IsPostBack) { if (Session["PId"] != null) { skuId = Convert.ToInt32(Session["PId"]); } if (Request.Params["CId"] != null) { cId = Convert.ToInt32(Request.Params["CId"]); } if (Request.Params["DId"] != null) { dId = Convert.ToInt32(Request.Params["DId"]); } if (Request.Params["QId"] != null) { qId = Convert.ToInt32(Request.Params["QId"]); } if (skuId > 0) { if (cId == (int)ShoppingCartType.SingleCheckout) { clientData = (ClientCartContext)Session["ClientOrderData"]; cartObject = new Cart(); cartObject.AddItem(skuId, qId, true, false); if (dId > 0) { bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false")); cartObject.AddItem(dId, qId, settingVal, false); } cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress; cartObject.Compute(); cartObject.ShowQuantity = false; clientData.CartInfo = cartObject; if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess) { int orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData); UserSessions.InsertSessionEntry(Context, true, clientData.CartInfo.Total, clientData.CustomerInfo.CustomerId, orderId); clientData.OrderId = orderId; clientData.ResetData(); Session["ClientOrderData"] = clientData; } Response.Redirect("PostSale.aspx"); } else if (cId == (int)ShoppingCartType.ShippingCreditCheckout) { clientData = (ClientCartContext)Session["ClientOrderData"]; cartObject = new Cart(); cartObject.AddItem(skuId, qId, true, false); if (dId > 0) { bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false")); cartObject.AddItem(dId, qId, settingVal, false); } cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress; cartObject.Compute(); cartObject.ShowQuantity = false; clientData.CartInfo = cartObject; Session["ClientOrderData"] = clientData; Response.Redirect("cart.aspx"); } else { //we may set this object in index page to capture request information if (Session["ClientOrderData"] == null) { clientData = new ClientCartContext(); clientData.CartInfo = new Cart(); } else { clientData = (ClientCartContext)Session["ClientOrderData"]; if (clientData.CartInfo == null) { clientData.CartInfo = new Cart(); } } clientData.CartInfo.AddItem(skuId, qId, true, false); if (dId > 0) { bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false")); cartObject.AddItem(dId, qId, settingVal, false); } clientData.CartInfo.Compute(); clientData.CartInfo.ShowQuantity = false; Session["ClientOrderData"] = clientData; Response.Redirect("Cart.aspx"); } } } }
public void SaveData() { ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"]; // attribute save example //clientData.OrderAttributeValues = new Dictionary<string, CSBusiness.Attributes.AttributeValue>(); //clientData.OrderAttributeValues.Add("ref_url", new CSBusiness.Attributes.AttributeValue("http://www.google.com")); if (clientData.OrderAttributeValues == null) { clientData.OrderAttributeValues = new Dictionary <string, CSBusiness.Attributes.AttributeValue>(); } clientData.OrderAttributeValues.Add("CustomOrderId", new CSBusiness.Attributes.AttributeValue("CS" + CommonHelper.GetRandonOrderNumber(DateTime.Now))); clientData.OrderAttributeValues.Add("cartabandonmentid", new CSBusiness.Attributes.AttributeValue(clientData.CartAbandonmentId.ToString())); // TODO: active when attribue is created /* * if (clientData.OrderAttributeValues.ContainsKey("SendOffers")) * { * clientData.OrderAttributeValues.Remove("SendOffers"); * } * if (chkboxOffers.Checked) * { * clientData.OrderAttributeValues.Add("SendOffers", new CSBusiness.Attributes.AttributeValue("1")); * } * else * { * clientData.OrderAttributeValues.Add("SendOffers", new CSBusiness.Attributes.AttributeValue("0")); * } */ //Recapture billing information if the user modified the information if (rId == 0) { if (Convert.ToBoolean(!cbBillingDifferent.Checked)) //override if the user select yes button { Address billingAddress = new Address(); billingAddress.FirstName = CommonHelper.fixquotesAccents(txtBillingFirstName.Text); billingAddress.LastName = CommonHelper.fixquotesAccents(txtBillingLastName.Text); billingAddress.Address1 = CommonHelper.fixquotesAccents(txtBillingAddress1.Text); billingAddress.Address2 = CommonHelper.fixquotesAccents(txtBillingAddress2.Text); billingAddress.City = CommonHelper.fixquotesAccents(txtBillingCity.Text); billingAddress.StateProvinceId = Convert.ToInt32(ddlBillingState.SelectedValue); billingAddress.CountryId = Convert.ToInt32(ddlBillingCountry.SelectedValue); billingAddress.ZipPostalCode = txtBillingZipCode.Text; clientData.CustomerInfo.FirstName = CommonHelper.fixquotesAccents(txtBillingFirstName.Text); clientData.CustomerInfo.LastName = CommonHelper.fixquotesAccents(txtBillingLastName.Text); clientData.CustomerInfo.BillingAddress = billingAddress; clientData.CartInfo.Compute(); } } SetBillingAddress(); PaymentInformation paymentDataInfo = new PaymentInformation(); string CardNumber = txtCCNumber1.Text + txtCCNumber2.Text + txtCCNumber3.Text + txtCCNumber4.Text; 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 = txtCvv.Text; CartContext.PaymentInfo = paymentDataInfo; int orderId = 0; if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess || CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder) { //Save Order information before upsale process if (rId == 1) { orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData); } else { //update order with modified customer shipping and billing and credit card information orderId = clientData.OrderId; CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData); } if (orderId > 1) { clientData.OrderId = orderId; Session["ClientOrderData"] = clientData; if (rId == 1) { Response.Redirect("PostSale.aspx"); } else { Response.Redirect("CardDecline.aspx"); } } } }
public bool validateInput() { if (CommonHelper.EnsureNotNull(txtShippingFirstName.Text) == String.Empty) { lblShippingFirstNameError.Text = ResourceHelper.GetResoureValue("FirstNameErrorMsg"); lblShippingFirstNameError.Visible = true; _bError = true; } else { lblShippingFirstNameError.Visible = false; } if (CommonHelper.EnsureNotNull(txtShippingLastName.Text) == String.Empty) { lblShippingLastNameError.Text = ResourceHelper.GetResoureValue("LastNameErrorMsg"); lblShippingLastNameError.Visible = true; _bError = true; } else { lblShippingLastNameError.Visible = false; } if (CommonHelper.EnsureNotNull(txtShippingAddress1.Text) == String.Empty) { lblShippingAddress1Error.Text = ResourceHelper.GetResoureValue("ShippingAddress1ErrorMsg"); lblShippingAddress1Error.Visible = true; _bError = true; } else if (!OrderHelper.ValidatePOBox(txtShippingAddress1.Text)) { lblShippingAddress1Error.Text = ResourceHelper.GetResoureValue("ShippingPOBoxErrorMsg"); lblShippingAddress1Error.Visible = true; _bError = true; } else if (!OrderHelper.ValidateAddress(txtShippingAddress1.Text)) { lblShippingAddress1Error.Text = ResourceHelper.GetResoureValue("ValidShippingAddressErrorMsg"); lblShippingAddress1Error.Visible = true; _bError = true; } else { lblShippingAddress1Error.Visible = false; } if (CommonHelper.EnsureNotNull(txtShippingCity.Text) == String.Empty) { lblShippingCityError.Text = ResourceHelper.GetResoureValue("ShippingCityErrorMsg"); lblShippingCityError.Visible = true; _bError = true; } else { lblShippingCityError.Visible = false; } if (ddlShippingState.SelectedValue.Equals("")) { lblShippingStateError.Text = ResourceHelper.GetResoureValue("ShippingStateErrorMsg"); lblShippingStateError.Visible = true; _bError = true; } else { lblShippingStateError.Visible = false; } string strPhoneNum = txtPhoneNumber.Text; if (!CommonHelper.IsValidPhone(strPhoneNum)) { lblShippingPhoneNumberError.Text = ResourceHelper.GetResoureValue("PhoneNumberErrorMsg"); lblShippingPhoneNumberError.Visible = true; _bError = true; } else { lblShippingPhoneNumberError.Visible = false; } if (CommonHelper.EnsureNotNull(txtShippingZipCode.Text) == String.Empty) { lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg"); lblShippingZiPError.Visible = true; _bError = true; } else { if (ddlShippingCountry.SelectedValue.Contains("231") || ddlShippingCountry.SelectedValue.Contains("327") || ddlShippingCountry.SelectedValue.Contains("397") || ddlShippingCountry.SelectedValue.Contains("444")) { if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Text)) { lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); lblShippingZiPError.Visible = true; _bError = true; } else { lblShippingZiPError.Visible = false; } } else { if (!CommonHelper.IsValidZipCodeCanadian(txtShippingZipCode.Text)) { lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); lblShippingZiPError.Visible = true; _bError = true; } else { lblShippingZiPError.Visible = false; } } } //if (CommonHelper.EnsureNotNull(txtShippingZipCode.Text) == String.Empty) //{ // lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg"); // lblShippingZiPError.Visible = true; // _bError = true; //} //else //{ // if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Text)) // { // lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); // lblShippingZiPError.Visible = true; // _bError = true; // } // else // lblShippingZiPError.Visible = false; //} if (CommonHelper.EnsureNotNull(txtEmail.Text) == String.Empty) { lblEmailError.Text = ResourceHelper.GetResoureValue("EmailErrorMsg"); lblEmailError.Visible = true; _bError = true; } else { if (!CommonHelper.IsValidEmail(txtEmail.Text)) { lblEmailError.Text = ResourceHelper.GetResoureValue("EmailValidationErrorMsg"); lblEmailError.Visible = true; _bError = true; } else { lblEmailError.Visible = false; } } SitePreference sitePrefCache = CSFactory.GetCacheSitePref(); if (!sitePrefCache.AttributeValuesLoaded) { sitePrefCache.LoadAttributeValues(); } if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true)) { if (DuplicateOrderDAL.IsDuplicateOrder(txtEmail.Text)) { lblEmailError.Text = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />"; lblEmailError.Visible = true; _bError = true; } else { lblEmailError.Visible = false; } } if (pnlQuantity.Visible) { if (ddlQuantityList.SelectedValue.Equals("select")) { lblQuantityList.Text = ResourceHelper.GetResoureValue("QuantityErrorMsg"); lblQuantityList.Visible = true; _bError = true; } else { lblQuantityList.Visible = false; } } return(_bError); }
protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e) { CSBusiness.Version versionItem = e.Item.DataItem as CSBusiness.Version; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HyperLink hlTitle = e.Item.FindControl("hlTitle") as HyperLink; ITextControl lblStatus = e.Item.FindControl("lblStatus") as ITextControl; ITextControl lblShortName = e.Item.FindControl("lblShortName") as ITextControl; ITextControl lblCategoy = e.Item.FindControl("lblCategoy") as ITextControl; ITextControl lbModelVersion = e.Item.FindControl("lbModelVersion") as ITextControl; Label imgIsDynamic = e.Item.FindControl("imgIsDynamic") as Label; GroupRadioButton rbDesktop = (GroupRadioButton)e.Item.FindControl("rbDesktop"); GroupRadioButton rbTablet = (GroupRadioButton)e.Item.FindControl("rbTablet"); GroupRadioButton rbMobile = (GroupRadioButton)e.Item.FindControl("rbMobile"); LinkButton lbRemove = e.Item.FindControl("lbRemove") as LinkButton; if (!versionItem.IsDynamic) { imgIsDynamic.Visible = false; } hlTitle.Text = versionItem.Title; hlTitle.NavigateUrl = string.Format("~/{0}/", versionItem.Title); lblShortName.Text = versionItem.ShortName; lbModelVersion.Text = versionItem.ModelVersion; lblCategoy.Text = versionItem.CategoryTitle; lblStatus.Text = versionItem.Visible ? "Active" : "Inactive"; rbDesktop.Checked = versionItem.IsDesktopDefault; rbTablet.Checked = versionItem.IsTabletDefault; rbMobile.Checked = versionItem.IsMobileDefault; //Make sure admin mistakenly remove category if (versionItem.ShortName.ToLower() == "control") { lbRemove.Visible = false; } if (versionItem.HideRemove) { lbRemove.Visible = false; } } if (e.Item.ItemType == ListItemType.EditItem) { //Bind Categories DropDownList ddlEditCategory = (DropDownList)e.Item.FindControl("ddlEditCategory"); ddlEditCategory.DataSource = CSFactory.GetAllVersionCateogry(); ddlEditCategory.DataTextField = "Title"; ddlEditCategory.DataValueField = "CategoryId"; ddlEditCategory.DataBind(); ddlEditCategory.Items.Insert(0, new ListItem("Select", "")); GroupRadioButton rbDesktop = (GroupRadioButton)e.Item.FindControl("rbDesktop"); GroupRadioButton rbTablet = (GroupRadioButton)e.Item.FindControl("rbTablet"); GroupRadioButton rbMobile = (GroupRadioButton)e.Item.FindControl("rbMobile"); rbDesktop.Checked = versionItem.IsDesktopDefault; rbTablet.Checked = versionItem.IsTabletDefault; rbMobile.Checked = versionItem.IsMobileDefault; if (versionItem.CategoryId > 0) { ddlEditCategory.Items.FindByValue(versionItem.CategoryId.ToString()).Selected = true; } BindModelVersions(versionItem.Title, e.Item); if (versionItem.ModelVersionId > 0) { ListItem selectedItem = ddlModel.Items.FindByValue(versionItem.ModelVersionId.ToString()); if (selectedItem != null) { selectedItem.Selected = true; } } } }
protected void Page_Load(object sender, EventArgs e) { string[] parts = Request.Url.AbsolutePath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); if (Session["oid"] != null) { orderId = Convert.ToInt32(Session["oid"].ToString()); } else if (CartContext.OrderId > 0) { orderId = CartContext.OrderId; } else { Response.Redirect("index.aspx"); } Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true); if (orderData.OrderStatusId == 2) { // this means that customer clicked back, so should be directed to receipt page. Response.Redirect("receipt.aspx"); } if (Session["oid"] == null && OrderHelper.IsCustomerOrderFlowCompleted(CartContext.OrderId)) { Response.Redirect("receipt.aspx"); } if (!IsPostBack) { //Calculate and save tax new CSWeb.FulfillmentHouse.DataPakTax().PostOrderToDataPak(orderId); string[] testCreditCards; testCreditCards = ResourceHelper.GetResoureValue("TestCreditCard").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);; foreach (string word in testCreditCards) { if (orderData.CreditInfo.CreditCardNumber.Equals(word)) { CSResolve.Resolve <IOrderService>().UpdateOrderStatus(orderData.OrderId, 7); // This will avoid order from getting posted to OMX for test orders Session["OrderStatus"] = "Receipt"; Response.Redirect("receipt.aspx"); } } bool authSuccess = false; // Check if payment gateway service is enabled or not. if (CSFactory.GetCacheSitePref().PaymentGatewayService) { try { authSuccess = orderData.OrderStatusId == 4 || orderData.OrderStatusId == 5 || // fulfillment failure (fulfillment was attempted after payment success), so don't charge again. OrderHelper.AuthorizeOrder(orderId); ////if (!authSuccess) //// OrderHelper.SendOrderDeclinedEmail(orderId); } catch (Exception ex) { CSCore.CSLogger.Instance.LogException("AuthorizeOrder - auth error - orderid: " + Convert.ToString(orderId), ex); throw; } } else { authSuccess = true; } if (authSuccess) { // Check if fulfillment gateway service is enabled or not. if (CSFactory.GetCacheSitePref().FulfillmentHouseService) { try { new CSWeb.FulfillmentHouse.DataPak().PostOrderToDataPak(orderId); } catch (Exception ex) { CSCore.CSLogger.Instance.LogException("AuthorizeOrder - fulfillment post error - orderid: " + Convert.ToString(orderId), ex); } Session["OrderStatus"] = "Receipt"; if (Request.QueryString != null) { Response.Redirect("receipt.aspx?" + Request.QueryString); } else { Response.Redirect("receipt.aspx"); } } } else { Response.Redirect(string.Format("carddecline.aspx?returnUrl={0}", string.Concat("/", string.Join("/", parts, 0, parts.Length - 1), "/receipt.aspx")), true); } } Session["OrderStatus"] = "Receipt"; Response.Redirect("receipt.aspx"); }
private void BindCoupons() { dlCouponList.DataSource = CSFactory.GetAllCoupon(); dlCouponList.DataKeyField = "CouponId"; dlCouponList.DataBind(); }
/// <summary> /// Retrieve data that is going to be stored in cache /// </summary> /// <returns></returns> protected override object GetData() { SitePreference list = CSFactory.GetCartPrefrence(); return(list); }
protected void BindData(DateTime?startDate, DateTime?endDate) { DateTime?timezoneStartDate = new DateTime(); DateTime?timezoneEndDate = new DateTime(); if (OrderHelper.IsReportEST()) { timezoneStartDate = DateTimeUtil.GetEastCoastStartDate(rangeDateControlCriteria.StartDateValueLocal); timezoneEndDate = DateTimeUtil.GetEastCoastDate(rangeDateControlCriteria.EndDateValueLocal); } else//PST { timezoneStartDate = rangeDateControlCriteria.StartDateValueLocal; timezoneEndDate = DateTimeUtil.GetEndDate(rangeDateControlCriteria.EndDateValueLocal); // liSubHeader.Text = DateTime.Now.DayOfWeek + " " + DateTime.Now.ToShortTimeString() + " (PST)"; } dtCollectionList = new OrderManager().GetVersionSummary(timezoneStartDate, timezoneEndDate, false); try { Data rptData = new ReportWSSoapClient().GetDataFromTimeframe(hitsLinkUserName, hitsLinkPassword, ReportsEnum.MultiVariate, TimeFrameEnum.Daily, Convert.ToDateTime(startDate), Convert.ToDateTime(endDate), 100000000, 0, 0); for (int i = 0; i <= rptData.Rows.GetUpperBound(0); i++) { HitLinkVisitor.Add(rptData.Rows[i].Columns[0].Value.ToLower(), rptData.Rows[i].Columns[9].Value); } } catch (Exception ex) { } //Update Version List information foreach (ReportFields item in dtCollectionList[1]) { decimal visitor = 0; if (item.Title.ToLower().Equals(item.ShortName.ToLower())) { if (HitLinkVisitor.ContainsKey(item.Title)) { visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString()); visitor = Math.Abs(visitor); } } else { //Added this to fix bug of orderhelper.getversionname() if (HitLinkVisitor.ContainsKey(item.Title)) { visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString()); } if (HitLinkVisitor.ContainsKey(item.ShortName.ToLower())) { visitor += Convert.ToDecimal(HitLinkVisitor[item.ShortName.ToLower()].ToString()); } visitor = Math.Abs(visitor); } item.UniqueVisitors = visitor; if (visitor > 0) { item.Conversion = Math.Round((Convert.ToDecimal(item.TotalOrders) * 100) / visitor, 1); item.RevenuePerVisit = Convert.ToDecimal(item.TotalRevenue) / visitor; } else { item.Conversion = 0; item.RevenuePerVisit = 0; } } dlVersionCategoryList.DataSource = CSFactory.GetAllVersionCateogry(); dlVersionCategoryList.DataBind(); //FCLiteral.Text = CreateCharts(dtCollectionList[1dtCollectionList }
public bool validateInput() { if (CommonHelper.EnsureNotNull(txtFirstName.Text) == String.Empty) { lblFirstNameError.Text = ResourceHelper.GetResoureValue("FirstNameErrorMsg"); lblFirstNameError.Visible = true; _bError = true; } else { lblFirstNameError.Visible = false; } if (CommonHelper.EnsureNotNull(txtLastName.Text) == String.Empty) { lblLastNameError.Text = ResourceHelper.GetResoureValue("LastNameErrorMsg"); lblLastNameError.Visible = true; _bError = true; } else { lblLastNameError.Visible = false; } if (CommonHelper.EnsureNotNull(txtAddress1.Text) == String.Empty) { lblAddress1Error.Text = ResourceHelper.GetResoureValue("BillingAddress1ErrorMsg"); lblAddress1Error.Visible = true; _bError = true; } else { lblAddress1Error.Visible = false; } if (CommonHelper.EnsureNotNull(txtCity.Text) == String.Empty) { lblCityError.Text = ResourceHelper.GetResoureValue("BillingCityErrorMsg"); lblCityError.Visible = true; _bError = true; } else { lblCityError.Visible = false; } if (ddlState.SelectedValue.Equals("select")) { lblStateError.Text = ResourceHelper.GetResoureValue("BillingStateErrorMsg"); lblStateError.Visible = true; _bError = true; } else { lblStateError.Visible = false; } string strPhoneNum = txtPhoneNumber.Text; if (!CommonHelper.IsValidPhone(strPhoneNum)) { lblPhoneNumberError.Text = ResourceHelper.GetResoureValue("PhoneNumErrorMsg"); lblPhoneNumberError.Visible = true; _bError = true; } else { lblPhoneNumberError.Visible = false; } if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty) { lblZiPError.Text = ResourceHelper.GetResoureValue("BillingZipCodeErrorMsg"); lblZiPError.Visible = true; _bError = true; } else { if (!CommonHelper.IsValidZipCode(txtZipCode.Text)) { lblZiPError.Text = ResourceHelper.GetResoureValue("BillingZipCodeValidationErrorMsg"); lblZiPError.Visible = true; _bError = true; } else { lblZiPError.Visible = false; } } if (CommonHelper.EnsureNotNull(txtEmail.Text) == String.Empty) { lblEmailError.Text = ResourceHelper.GetResoureValue("EmailErrorMsg"); lblEmailError.Visible = true; _bError = true; } else { if (!CommonHelper.IsValidEmail(txtEmail.Text)) { lblEmailError.Text = ResourceHelper.GetResoureValue("EmailValidationErrorMsg"); lblEmailError.Visible = true; _bError = true; } else { lblEmailError.Visible = false; } } SitePreference sitePrefCache = CSFactory.GetCacheSitePref(); if (!sitePrefCache.AttributeValuesLoaded) { sitePrefCache.LoadAttributeValues(); } if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true)) { if (DuplicateOrderDAL.IsDuplicateOrder(txtEmail.Text)) { lblEmailError.Text = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />"; lblEmailError.Visible = true; _bError = true; } else { lblEmailError.Visible = false; } } if (ddlQuantityList.SelectedValue.Equals("select")) { lblQuantityList.Text = ResourceHelper.GetResoureValue("QuantityErrorMsg"); lblQuantityList.Visible = true; _bError = true; } else { lblQuantityList.Visible = false; } return(_bError); }
protected void BindData(DateTime?startDate, DateTime?endDate) { DateTime?timezoneStartDate = DateTimeUtil.GetEastCoastStartDate(rangeDateControlCriteria.StartDateValueLocal); DateTime?timezoneEndDate = DateTimeUtil.GetEastCoastDate(rangeDateControlCriteria.EndDateValueLocal); dtCollectionList = GetVersionSummary(timezoneStartDate, timezoneEndDate, false); Data rptData = new ReportWSSoapClient().GetDataFromTimeframe(hitsLinkUserName, hitsLinkPassword, ReportsEnum.MultiVariate, TimeFrameEnum.Daily, Convert.ToDateTime(startDate), Convert.ToDateTime(endDate), 100000000, 0, 0); for (int i = 0; i <= rptData.Rows.GetUpperBound(0); i++) { HitLinkVisitor.Add(rptData.Rows[i].Columns[0].Value.ToLower(), rptData.Rows[i].Columns[9].Value); } //Update Version List information foreach (ReportFields item in dtCollectionList[1]) { decimal visitor = 0; if (item.Title.ToLower().Equals(item.ShortName.ToLower())) { if (HitLinkVisitor.ContainsKey(item.Title)) { visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString()); visitor = Math.Abs(visitor); } } else { //Added this to fix bug of orderhelper.getversionname() if (HitLinkVisitor.ContainsKey(item.Title)) { visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString()); } if (HitLinkVisitor.ContainsKey(item.ShortName.ToLower())) { visitor += Convert.ToDecimal(HitLinkVisitor[item.ShortName.ToLower()].ToString()); } visitor = Math.Abs(visitor); } item.UniqueVisitors = visitor; if (visitor > 0) { item.Conversion = Math.Round((Convert.ToDecimal(item.TotalOrders) * 100) / visitor, 1); item.RevenuePerVisit = Convert.ToDecimal(item.TotalRevenue) / visitor; } else { item.Conversion = 0; item.RevenuePerVisit = 0; } } // Fetching data from 2nd hitslink account rptData = new ReportWSSoapClient().GetDataFromTimeframe(hitsLinkUserName, hitsLinkPassword, ReportsEnum.MultiVariate, TimeFrameEnum.Daily, Convert.ToDateTime(startDate), Convert.ToDateTime(endDate), 100000000, 0, 0); for (int i = 0; i <= rptData.Rows.GetUpperBound(0); i++) { if (!HitLinkVisitor.ContainsKey(rptData.Rows[i].Columns[0].Value.ToLower())) { HitLinkVisitor.Add(rptData.Rows[i].Columns[0].Value.ToLower(), rptData.Rows[i].Columns[9].Value); } } //Update Version List information - Start foreach (ReportFields item in dtCollectionList[2]) { decimal visitor = 0; if (endDate <= new DateTime(2013, 03, 25)) { if (item.Title.ToLower().Equals(item.ShortName.ToLower())) { if (HitLinkVisitor.ContainsKey(item.Title)) { visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString()); visitor = Math.Abs(visitor); } } else { //Added this to fix bug of orderhelper.getversionname() if (HitLinkVisitor.ContainsKey(item.Title)) { visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString()); } if (HitLinkVisitor.ContainsKey(item.ShortName.ToLower())) { visitor += Convert.ToDecimal(HitLinkVisitor[item.ShortName.ToLower()].ToString()); } visitor = Math.Abs(visitor); } } else { if (!item.Title.Contains("-")) { if (HitLinkVisitor.ContainsKey(item.Title + "-" + item.CategoryTitle)) { visitor += Convert.ToDecimal(HitLinkVisitor[item.Title + "-" + item.CategoryTitle].ToString()); } } else { if (HitLinkVisitor.ContainsKey(item.Title)) { visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString()); } } visitor = Math.Abs(visitor); } item.UniqueVisitors = visitor; if (visitor > 0) { item.Conversion = Math.Round((Convert.ToDecimal(item.TotalOrders) * 100) / visitor, 1); item.RevenuePerVisit = Convert.ToDecimal(item.TotalRevenue) / visitor; } else { item.Conversion = 0; item.RevenuePerVisit = 0; } } //Update Version List information - End dlVersionCategoryList.DataSource = CSFactory.GetAllVersionCateogry(); dlVersionCategoryList.DataBind(); //FCLiteral.Text = CreateCharts(dtCollectionList[1dtCollectionList }
private void BindCategory() { dlCategoryList.DataSource = CSFactory.GetAllCategories(); dlCategoryList.DataKeyField = "CategoryId"; dlCategoryList.DataBind(); }
/// <summary> /// Performs a Process Transaction request on First Data Gateway. /// </summary> /// <param name="request"></param> /// <returns></returns> public Response PerformAuthRequest(Request request) { RestClient _client; _client = new RestClient(ConfigurationManager.AppSettings["TokenExPaymentUrl"]); _client.AddDefaultHeader("Content-Type", "application/json"); string requestXML = RequestGenerator.GetRequest(request); var req = new RestRequest(); req.AddParameter("application/json", requestXML, ParameterType.RequestBody); var res = _client.Post(req); var jsonConf = new JsonSerializerSettings(); string authCode = ""; string transactionCode = ""; string cvvCode = ""; string avsCode = ""; Response1 response1 = JsonConvert.DeserializeObject <Response1>(res.Content); foreach (Param param in response1.Params) { if (param.Key.ToLower().Equals("auth_code")) { authCode = param.Value; } if (param.Key.ToLower().Equals("ref_num")) { transactionCode = param.Value; } //avs_result_code if (param.Key.ToLower().Equals("avs_result_code")) { avsCode = param.Value; } //cvv2_result_code if (param.Key.ToLower().Equals("cvv2_result_code")) { cvvCode = param.Value; } } Response response = new Response(); response.GatewayRequestRaw = requestXML; response.GatewayResponseRaw = res.Content; response.MerchantDefined1 = avsCode; response.MerchantDefined2 = cvvCode; Hashtable addinfo = new Hashtable(); SitePreference sitePreference = CSFactory.GetCacheSitePref(); sitePreference.LoadAttributeValues(); addinfo.Add("merchantId", sitePreference.GetAttributeValue <string>("gatewaymerchantid", string.Empty, string.Empty)); response.AdditionalInfo = addinfo; response.AuthCode = authCode; response.TransactionID = transactionCode; if (response1.TransactionResult) { response.ResponseType = TransactionResponseType.Approved; } else { response.ResponseType = TransactionResponseType.Denied; } return(response); }
public bool validateInput() { if (CommonHelper.EnsureNotNull(txtShippingFirstName.Text) == String.Empty) { lblShippingFirstName.Text = ResourceHelper.GetResoureValue("FirstNameErrorMsg"); lblShippingFirstName.Visible = true; _bError = true; } else { lblShippingFirstName.Visible = false; } if (CommonHelper.EnsureNotNull(txtShippingLastName.Text) == String.Empty) { lblShippingLastName.Text = ResourceHelper.GetResoureValue("LastNameErrorMsg"); lblShippingLastName.Visible = true; _bError = true; } else { lblShippingLastName.Visible = false; } if (CommonHelper.EnsureNotNull(txtShippingAddress1.Text) == String.Empty) { lblShippingAddress1Error.Text = ResourceHelper.GetResoureValue("Address1ErrorMsg"); lblShippingAddress1Error.Visible = true; _bError = true; } else { lblShippingAddress1Error.Visible = false; } if (CommonHelper.EnsureNotNull(txtShippingCity.Text) == String.Empty) { lblShippingCityError.Text = ResourceHelper.GetResoureValue("CityErrorMsg"); lblShippingCityError.Visible = true; _bError = true; } else { lblShippingCityError.Visible = false; } if (ddlShippingState.SelectedValue.Equals("")) { lblShippingStateError.Text = ResourceHelper.GetResoureValue("ShippingStateErrorMsg"); lblShippingStateError.Visible = true; _bError = true; } else { lblShippingStateError.Visible = false; } if (CommonHelper.EnsureNotNull(txtShippingZipCode.Text) == String.Empty) { lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg"); lblShippingZiPError.Visible = true; _bError = true; } else { if (ddlShippingCountry.SelectedValue.Contains("231")) { if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Text)) { lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); lblShippingZiPError.Visible = true; _bError = true; } else { lblShippingZiPError.Visible = false; } } else { if (!CommonHelper.IsValidZipCodeCanadian(txtShippingZipCode.Text)) { lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); lblShippingZiPError.Visible = true; _bError = true; } else { lblShippingZiPError.Visible = false; } } } //if (CommonHelper.EnsureNotNull(txtShippingZipCode.Text) == String.Empty) //{ // lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg"); // lblShippingZiPError.Visible = true; // _bError = true; //} //else //{ // if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Text)) // { // lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); // lblShippingZiPError.Visible = true; // _bError = true; // } // else // lblShippingZiPError.Visible = false; //} string strPhoneNum = txtPhoneNumber1.Text + txtPhoneNumber2.Text + txtPhoneNumber3.Text; if (!CommonHelper.IsValidPhone(strPhoneNum)) { lblPhoneNumberError.Text = ResourceHelper.GetResoureValue("PhoneNumberErrorMsg"); lblPhoneNumberError.Visible = true; _bError = true; } else { lblPhoneNumberError.Visible = false; } if (CommonHelper.EnsureNotNull(txtEmail.Text) == String.Empty) { lblEmailError.Text = ResourceHelper.GetResoureValue("EmailErrorMsg"); lblEmailError.Visible = true; _bError = true; } else { if (!CommonHelper.IsValidEmail(txtEmail.Text)) { lblEmailError.Text = ResourceHelper.GetResoureValue("EmailValidationErrorMsg"); lblEmailError.Visible = true; _bError = true; } else { lblEmailError.Visible = false; } } SitePreference sitePrefCache = CSFactory.GetCacheSitePref(); if (!sitePrefCache.AttributeValuesLoaded) { sitePrefCache.LoadAttributeValues(); } if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true)) { if (DuplicateOrderDAL.IsDuplicateOrder(txtEmail.Text)) { lblEmailError.Text = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />"; lblEmailError.Visible = true; _bError = true; } else { lblEmailError.Visible = false; } } if (pnlQuantity.Visible) { if (ddlQuantityList.SelectedValue.Equals("select")) { lblQuantityList.Text = ResourceHelper.GetResoureValue("QuantityErrorMsg"); lblQuantityList.Visible = true; _bError = true; } else { lblQuantityList.Visible = false; } } #region Name & Address if (pnlShippingAddress.Visible) { if (CommonHelper.EnsureNotNull(txtFirstName.Text) == String.Empty) { lblFirstNameError.Text = ResourceHelper.GetResoureValue("FirstNameErrorMsg"); lblFirstNameError.Visible = true; _bError = true; } else { lblFirstNameError.Visible = false; } if (CommonHelper.EnsureNotNull(txtLastName.Text) == String.Empty) { lblLastNameError.Text = ResourceHelper.GetResoureValue("LastNameErrorMsg"); lblLastNameError.Visible = true; _bError = true; } else { lblLastNameError.Visible = false; } if (CommonHelper.EnsureNotNull(txtAddress1.Text) == String.Empty) { lblAddress1Error.Text = ResourceHelper.GetResoureValue("Address1ErrorMsg"); lblAddress1Error.Visible = true; _bError = true; } else { lblAddress1Error.Visible = false; } if (CommonHelper.EnsureNotNull(txtCity.Text) == String.Empty) { lblCityError.Text = ResourceHelper.GetResoureValue("CityErrorMsg"); lblCityError.Visible = true; _bError = true; } else { lblCityError.Visible = false; } if (ddlState.SelectedValue.Equals("")) { lblStateError.Text = ResourceHelper.GetResoureValue("BillingStateErrorMsg"); lblStateError.Visible = true; _bError = true; } else { lblStateError.Visible = false; } if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty) { lblZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg"); lblZiPError.Visible = true; _bError = true; } else { if (ddlCountry.SelectedItem.Text.Contains("United States")) { if (!CommonHelper.IsValidZipCode(txtZipCode.Text)) { lblZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); lblZiPError.Visible = true; _bError = true; } else { lblZiPError.Visible = false; } } else { if (!CommonHelper.IsValidZipCodeCanadian(txtZipCode.Text)) { lblZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); lblZiPError.Visible = true; _bError = true; } else { lblZiPError.Visible = false; } } } //if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty) //{ // lblZiPError.Text = ResourceHelper.GetResoureValue("ZipCodeErrorMsg"); // lblZiPError.Visible = true; // _bError = true; //} //else //{ // if (!CommonHelper.IsValidZipCode(txtZipCode.Text)) // { // lblZiPError.Text = ResourceHelper.GetResoureValue("ZipCodeValidationErrorMsg"); // lblZiPError.Visible = true; // _bError = true; // } // else // lblZiPError.Visible = false; //} } #endregion #region Credit Card if (ddlCCType.SelectedIndex < 0) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeErrorMsg"); lblCCType.Visible = true; _bError = true; } else { lblCCType.Visible = false; } DateTime expire = new DateTime(); if (ddlExpYear.SelectedIndex > -1 && ddlExpMonth.SelectedIndex > -1) { expire = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1); } DateTime today = DateTime.Today; if (expire.Year <= today.Year && expire.Month <= today.Month) { lblExpDate.Text = ResourceHelper.GetResoureValue("ExpDateErrorMsg"); lblExpDate.Visible = true; _bError = true; } else { lblExpDate.Visible = false; } string c = txtCCNumber1.Text; if (c.Equals("")) { lblCCNumberError.Text = ResourceHelper.GetResoureValue("CCErrorMsg"); lblCCNumberError.Visible = true; _bError = true; } else { if ((c.ToString() != "4444333322221111") && (txtCvv.Text.IndexOf("147114711471") == -1)) { if (!CommonHelper.ValidateCardNumber(c)) { lblCCNumberError.Text = ResourceHelper.GetResoureValue("CCErrorMsg"); lblCCNumberError.Visible = true; _bError = true; } else { lblCCNumberError.Visible = false; } } } if (CommonHelper.EnsureNotNull(txtCvv.Text) == String.Empty) { lblCvvError.Text = ResourceHelper.GetResoureValue("CVVErrorMsg"); lblCvvError.Visible = true; _bError = true; } else { if (CommonHelper.onlynums(txtCvv.Text) == false) { lblCvvError.Text = ResourceHelper.GetResoureValue("CVVErrorMsg"); lblCvvError.Visible = true; _bError = true; } if ((CommonHelper.CountNums(txtCvv.Text) != 3) && (CommonHelper.CountNums(txtCvv.Text) != 4)) { lblCvvError.Text = ResourceHelper.GetResoureValue("CVVErrorMsg"); lblCvvError.Visible = true; _bError = true; } else { lblCvvError.Visible = false; } if ((c[0].ToString() == "5") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.MasterCard.ToString())) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); lblCCType.Visible = true; _bError = true; } else if ((c[0].ToString() == "4") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.VISA.ToString())) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); lblCCType.Visible = true; _bError = true; } else if ((c[0].ToString() == "6") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.Discover.ToString())) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); lblCCType.Visible = true; _bError = true; } else if ((c[0].ToString() == "3") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.AmericanExpress.ToString())) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); lblCCType.Visible = true; _bError = true; } else { lblCCType.Visible = false; } } #endregion return(_bError); }
//protected void rblBillingReview_CheckedChanged(object sender, EventArgs e) //{ // bool billingVal = Convert.ToBoolean(rbBillingReview.SelectedItem.Value); // if (billingVal) // pnlBilling.Visible = true; // else // pnlBilling.Visible = false; //} //public void ReloadCartData() //{ // ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"]; // LabelCreditCardNumberError.Visible=true; // LabelCreditCardNumberError.Text = "Sorry, we were unable to process your Payment Information as entered. Please try placing your order again or call Customer Service at (800) 672-2259."; // rfvFirstName.ErrorMessage = ResourceHelper.GetResoureValue("FirstNameErrorMsg"); // rfvLastName.ErrorMessage = ResourceHelper.GetResoureValue("LastNameErrorMsg"); // rfvAddress1.ErrorMessage = ResourceHelper.GetResoureValue("BillingAddress1ErrorMsg"); // rfvCity.ErrorMessage = ResourceHelper.GetResoureValue("BillingCityErrorMsg"); // rfvZipCode.ErrorMessage = ResourceHelper.GetResoureValue("BillingZipCodeErrorMsg"); // rfvZipCodeReg.ErrorMessage = ResourceHelper.GetResoureValue("BillingZipCodeValidationErrorMsg"); // rfvPhone.ErrorMessage = ResourceHelper.GetResoureValue("PhoneNumErrorMsg"); // rfvEmail.ErrorMessage = ResourceHelper.GetResoureValue("EmailErrorMsg"); // rfvEmailReg.ErrorMessage = ResourceHelper.GetResoureValue("EmailValidationErrorMsg"); // pnlBillingReview.Visible = true; // BindBillingCountries(false); // BindShippingCountries(false); // ddlShippingCountry.Items.FindByValue(clientData.CustomerInfo.ShippingAddress.CountryId.ToString()).Selected = true; // ddlCountry.Items.FindByValue(clientData.CustomerInfo.BillingAddress.CountryId.ToString()).Selected = true; // BindBillingRegions(); // BindShippingRegions(); // ddlShippingState.Items.FindByValue(clientData.CustomerInfo.ShippingAddress.StateProvinceId.ToString()).Selected = true; // ddlState.Items.FindByValue(clientData.CustomerInfo.BillingAddress.StateProvinceId.ToString()).Selected = true; // //Shipping information // TextBoxShippingFirstName.Text = clientData.CustomerInfo.ShippingAddress.FirstName; // TextBoxShippingLastName.Text = clientData.CustomerInfo.ShippingAddress.LastName; // TextBoxShippingAddress1.Text = clientData.CustomerInfo.ShippingAddress.Address1; // TextBoxShippingAddress2.Text = clientData.CustomerInfo.ShippingAddress.Address2; // TextBoxShippingCity.Text = clientData.CustomerInfo.ShippingAddress.City; // TextBoxShippingZip.Text = clientData.CustomerInfo.ShippingAddress.ZipPostalCode; // //Payment information // TextBoxCCNum.Text = CommonHelper.Decrypt(clientData.PaymentInfo.CreditCardNumber); // TextBoxCVV.Text = clientData.PaymentInfo.CreditCardCSC; // DateTime expireDate = DateTime.MinValue; // DateTime.TryParse(clientData.PaymentInfo.CreditCardExpired.ToString(), out expireDate); // DropDownListExpMonth.Items.FindByValue(expireDate.Month.ToString()).Selected = true; // DropDownListExpYear.Items.FindByValue(expireDate.Year.ToString()).Selected = true; // //Billing informarion // TextBoxFirstName.Text = clientData.CustomerInfo.BillingAddress.FirstName; // TextBoxLastName.Text = clientData.CustomerInfo.BillingAddress.LastName; // TextBoxAddress1.Text = clientData.CustomerInfo.BillingAddress.Address1; // TextBoxAddress2.Text = clientData.CustomerInfo.BillingAddress.Address2; // TextBoxCity.Text = clientData.CustomerInfo.BillingAddress.City; // TextBoxZip.Text = clientData.CustomerInfo.BillingAddress.ZipPostalCode; // TextBoxEmail.Text = clientData.CustomerInfo.Email; // //quick fix // TextBoxArea.Text = clientData.CustomerInfo.PhoneNumber.Substring(0, 3); // TextBoxPhoneNum1.Text = clientData.CustomerInfo.PhoneNumber.Substring(3, 3); // TextBoxPhoneNum2.Text = clientData.CustomerInfo.PhoneNumber.Substring(6, 4); //} public bool validateInput() { //_bError = false; if (cbBillingDifferent.Checked) { if (CommonHelper.EnsureNotNull(txtFirstName.Text) == String.Empty) { lblFirstNameError.Text = ResourceHelper.GetResoureValue("FirstNameErrorMsg"); lblFirstNameError.Visible = true; _bError = true; } else { lblFirstNameError.Visible = false; } if (CommonHelper.EnsureNotNull(txtLastName.Text) == String.Empty) { lblLastNameError.Text = ResourceHelper.GetResoureValue("LastNameErrorMsg"); lblLastNameError.Visible = true; _bError = true; } else { lblLastNameError.Visible = false; } if (CommonHelper.EnsureNotNull(txtAddress1.Text) == String.Empty) { lblAddress1Error.Text = ResourceHelper.GetResoureValue("Address1ErrorMsg"); lblAddress1Error.Visible = true; _bError = true; } else { lblAddress1Error.Visible = false; } if (CommonHelper.EnsureNotNull(txtCity.Text) == String.Empty) { lblCityError.Text = ResourceHelper.GetResoureValue("CityErrorMsg"); lblCityError.Visible = true; _bError = true; } else { lblCityError.Visible = false; } if (ddlState.SelectedValue.Equals("")) { lblStateError.Text = ResourceHelper.GetResoureValue("StateErrorMsg"); lblStateError.Visible = true; _bError = true; } else { lblStateError.Visible = false; } if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty) { lblZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg"); lblZiPError.Visible = true; _bError = true; } else { if (ddlCountry.SelectedItem.Text.Contains("United States") || ddlCountry.SelectedValue.Contains("327") || ddlCountry.SelectedValue.Contains("397") || ddlCountry.SelectedValue.Contains("444")) { if (!CommonHelper.IsValidZipCode(txtZipCode.Text)) { lblZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); lblZiPError.Visible = true; _bError = true; } else { lblZiPError.Visible = false; } } else { if (!CommonHelper.IsValidZipCodeCanadian(txtZipCode.Text)) { lblZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg"); lblZiPError.Visible = true; _bError = true; } else { lblZiPError.Visible = false; } } } //if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty) //{ // lblZiPError.Text = ResourceHelper.GetResoureValue("ZipCodeErrorMsg"); // lblZiPError.Visible = true; // _bError = true; //} //else //{ // if (!CommonHelper.IsValidZipCode(txtZipCode.Text)) // { // lblZiPError.Text = ResourceHelper.GetResoureValue("ZipCodeValidationErrorMsg"); // lblZiPError.Visible = true; // _bError = true; // } // else // lblZiPError.Visible = false; //} } //if (!CheckBoxAgree.Checked) //{ // lblAgreeError.Text = "Please Agree to the terms and conditions"; // lblAgreeError.Visible = true; // _bError = true; //} //else // lblAgreeError.Visible = false; if (ddlCCType.SelectedIndex < 0) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeErrorMsg"); lblCCType.Visible = true; _bError = true; } else { lblCCType.Visible = false; } DateTime expire = new DateTime(); if (ddlExpYear.SelectedIndex > -1 && ddlExpMonth.SelectedIndex > -1) { expire = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1); } DateTime today = DateTime.Today; if (expire.Year <= today.Year && expire.Month <= today.Month) { lblExpDate.Text = ResourceHelper.GetResoureValue("ExpDateErrorMsg"); lblExpDate.Visible = true; _bError = true; } else { lblExpDate.Visible = false; } string c = txtCCNumber1.Text; if (c.Equals("")) { lblCCNumberError.Text = ResourceHelper.GetResoureValue("CCErrorMsg"); lblCCNumberError.Visible = true; _bError = true; } else { if ((c.ToString() != "4444333322221111") && (txtCvv.Text.IndexOf("147114711471") == -1)) { if (!CommonHelper.ValidateCardNumber(c)) { lblCCNumberError.Text = ResourceHelper.GetResoureValue("CCErrorMsg"); lblCCNumberError.Visible = true; _bError = true; } else { lblCCNumberError.Visible = false; } } else { lblCCNumberError.Visible = false; } } if ((c[0].ToString() == "5") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.MasterCard.ToString())) { ddlCCType.SelectedValue = ((int)CreditCardTypeEnum.MasterCard).ToString(); } else if ((c[0].ToString() == "4") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.VISA.ToString())) { ddlCCType.SelectedValue = ((int)CreditCardTypeEnum.VISA).ToString(); } else if ((c[0].ToString() == "6") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.Discover.ToString())) { ddlCCType.SelectedValue = ((int)CreditCardTypeEnum.Discover).ToString(); } else if ((c[0].ToString() == "3") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.AmericanExpress.ToString())) { ddlCCType.SelectedValue = ((int)CreditCardTypeEnum.AmericanExpress).ToString(); } else { } if (ddlCCType.SelectedIndex < 0) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeErrorMsg"); lblCCType.Visible = true; _bError = true; } else { lblCCType.Visible = false; } if ((c[0].ToString() == "5") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.MasterCard.ToString())) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); lblCCType.Visible = true; _bError = true; } else if ((c[0].ToString() == "4") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.VISA.ToString())) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); lblCCType.Visible = true; _bError = true; } else if ((c[0].ToString() == "6") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.Discover.ToString())) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); lblCCType.Visible = true; _bError = true; } else if ((c[0].ToString() == "3") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.AmericanExpress.ToString())) { lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); lblCCType.Visible = true; _bError = true; } else { lblCCType.Visible = false; } SitePreference sitePrefCache = CSFactory.GetCacheSitePref(); if (!sitePrefCache.AttributeValuesLoaded) { sitePrefCache.LoadAttributeValues(); } if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true)) { ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"]; if (DuplicateOrderDAL.IsDuplicateOrder(clientData.CustomerInfo.Email)) { lblEmailError.Text = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />"; lblEmailError.Visible = true; _bError = true; } else { lblEmailError.Visible = false; } } if (CommonHelper.EnsureNotNull(txtCvv.Text) == String.Empty) { lblCvvError.Text = ResourceHelper.GetResoureValue("CVVErrorMsg"); lblCvvError.Visible = true; _bError = true; } else { if (CommonHelper.onlynums(txtCvv.Text) == false) { lblCvvError.Text = ResourceHelper.GetResoureValue("CVVErrorMsg"); lblCvvError.Visible = true; _bError = true; } if ((CommonHelper.CountNums(txtCvv.Text) != 3) && (CommonHelper.CountNums(txtCvv.Text) != 4)) { lblCvvError.Text = ResourceHelper.GetResoureValue("CVVErrorMsg"); lblCvvError.Visible = true; _bError = true; } else { lblCvvError.Visible = false; } //if ((c[0].ToString() == "5") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.MasterCard.ToString())) //{ // lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); // lblCCType.Visible = true; // _bError = true; //} //else if ((c[0].ToString() == "4") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.VISA.ToString())) //{ // lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); // lblCCType.Visible = true; // _bError = true; //} //else if ((c[0].ToString() == "6") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.Discover.ToString())) //{ // lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); // lblCCType.Visible = true; // _bError = true; //} //else if ((c[0].ToString() == "3") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.AmericanExpress.ToString())) //{ // lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg"); // lblCCType.Visible = true; // _bError = true; //} //else //{ // lblCCType.Visible = false; //} } if (_bError) { lblValidation.Visible = true; lblValidation.Text = "Please fix above errors"; } else { lblValidation.Visible = false; } return(_bError); }
public void ReloadCartData() { ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"]; if (OrderHelper.IsMainKit() && OrderHelper.IsOnePay()) { int orderId = 0; if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess || CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder) { //Save Order information before upsale process orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData); if (orderId > 1) { clientData.OrderId = orderId; Session["ClientOrderData"] = clientData; Response.Redirect("PostSale.aspx"); } } } try { ddlCountry.ClearSelection(); ddlState.ClearSelection(); ddlCountry.Items.FindByValue(clientData.CustomerInfo.BillingAddress.CountryId.ToString()).Selected = true; ddlCountry.SelectedValue = clientData.CustomerInfo.BillingAddress.CountryId.ToString(); BindRegions(); ddlState.Items.FindByValue(clientData.CustomerInfo.BillingAddress.StateProvinceId.ToString()).Selected = true; //Payment information ddlCCType.SelectedValue = clientData.PaymentInfo.CreditCardType.ToString(); string ccNumber = CommonHelper.Decrypt(clientData.PaymentInfo.CreditCardNumber); txtCCNumber.Text = ccNumber; txtCvv.Text = clientData.PaymentInfo.CreditCardCSC; DateTime expireDate = DateTime.MinValue; DateTime.TryParse(clientData.PaymentInfo.CreditCardExpired.ToString(), out expireDate); ddlExpMonth.Items.FindByValue(expireDate.Month.ToString()).Selected = true; ddlExpYear.Items.FindByValue(expireDate.Year.ToString()).Selected = true; //Billing informarion txtFirstName.Text = clientData.CustomerInfo.BillingAddress.FirstName; txtLastName.Text = clientData.CustomerInfo.BillingAddress.LastName; txtAddress1.Text = clientData.CustomerInfo.BillingAddress.Address1; txtAddress2.Text = clientData.CustomerInfo.BillingAddress.Address2; txtCity.Text = clientData.CustomerInfo.BillingAddress.City; txtZipCode.Text = clientData.CustomerInfo.BillingAddress.ZipPostalCode; } catch { } }
private void BindVersion() { dlVersionList.DataSource = CSFactory.GetAllVersion(); dlVersionList.DataKeyField = "VersionId"; dlVersionList.DataBind(); }
public void SaveData() { ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"]; // attribute save example //clientData.OrderAttributeValues = new Dictionary<string, CSBusiness.Attributes.AttributeValue>(); //clientData.OrderAttributeValues.Add("ref_url", new CSBusiness.Attributes.AttributeValue("http://www.google.com")); if (clientData.OrderAttributeValues == null) { clientData.OrderAttributeValues = new Dictionary <string, CSBusiness.Attributes.AttributeValue>(); } clientData.OrderAttributeValues.AddOrUpdateAttributeValue("CustomOrderId", new CSBusiness.Attributes.AttributeValue("CS" + CommonHelper.GetRandonOrderNumber(DateTime.Now))); //Recapture billing information if the user modified the information if (rId == 0) { if (cbBillingDifferent.Checked) //override if the user select yes button { 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; clientData.CustomerInfo.FirstName = CommonHelper.fixquotesAccents(txtFirstName.Text); clientData.CustomerInfo.LastName = CommonHelper.fixquotesAccents(txtLastName.Text); clientData.CustomerInfo.BillingAddress = billingAddress; } } SetBillingAddress(); PaymentInformation paymentDataInfo = new PaymentInformation(); string CardNumber = txtCCNumber.Text; 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 = txtCvv.Text; CartContext.PaymentInfo = paymentDataInfo; Session["ClientOrderData"] = clientData; ////// Prepaid Card OverLay ////// int cardNo = Convert.ToInt32(CardNumber.Substring(0, 6)); bool isPrepaid = CSWebBase.PrepaidCardDAL.IsPrepaidCard(cardNo); if (isPrepaid && OrderHelper.IsMainKit() && !OrderHelper.IsOnePay()) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "open_expire_soon();", true); } else { int orderId = 0; if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess || CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder || CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableUpsellReviewOrder) { //Save Order information before upsale process if (rId == 1) { orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData); } else { //update order with modified customer shipping and billing and credit card information orderId = clientData.OrderId; CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData); } if (orderId > 1) { clientData.OrderId = orderId; Session["ClientOrderData"] = clientData; if (rId == 1) { Response.Redirect("PostSale.aspx"); } else { Response.Redirect("CardDecline.aspx"); } } } } }
private void BindTaxRegion() { dlStateList.DataSource = CSFactory.GetTaxByCountry(countryId); dlStateList.DataKeyField = "RegionId"; dlStateList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.Params["PId"] != null) { skuId = Convert.ToInt32(Request.Params["PId"]); } if (Request.Params["CId"] != null) { cId = Convert.ToInt32(Request.Params["CId"]); } if (Request.Params["DId"] != null) { dId = Convert.ToInt32(Request.Params["DId"]); } if (Request.Params["QId"] != null) { qId = Convert.ToInt32(Request.Params["QId"]); } if (skuId > 0) { if (cId == (int)ShoppingCartType.SingleCheckout) { clientData = (ClientCartContext)Session["ClientOrderData"]; cartObject = clientData.CartInfo; cartObject.AddItem(skuId, qId, true, false); if (dId > 0) { bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false")); cartObject.AddItem(dId, qId, settingVal, false); } //CSWebBase.SiteBasePage.AddAdditionalItems(clientData.CartInfo); cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress; cartObject.Compute(); cartObject.ShowQuantity = false; clientData.CartInfo = cartObject; if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess) { int orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData); clientData.OrderId = orderId; //clientData.ResetData(); Session["ClientOrderData"] = clientData; } Response.Redirect("PostSale.aspx"); //Response.Redirect("AuthorizeOrder.aspx?card_check=1", true); // When we hit this page, we need to do a $1 test charge only to see if card is valid before going to postsale (upsells). } else if (cId == (int)ShoppingCartType.ShippingCreditCheckout) { clientData = (ClientCartContext)Session["ClientOrderData"]; cartObject = new Cart(); cartObject.AddItem(skuId, qId, true, false); if (dId > 0) { bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false")); cartObject.AddItem(dId, qId, settingVal, false); } cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress; cartObject.Compute(); cartObject.ShowQuantity = false; clientData.CartInfo = cartObject; Session["ClientOrderData"] = clientData; Response.Redirect("cart.aspx"); } else { //we may set this object in index page to capture request information if (Session["ClientOrderData"] == null) { clientData = new ClientCartContext(); clientData.CartInfo = new Cart(); } else { clientData = (ClientCartContext)Session["ClientOrderData"]; if (clientData.CartInfo == null) { clientData.CartInfo = new Cart(); } } clientData.CartInfo.AddItem(skuId, qId, true, false); if (dId > 0) { bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false")); cartObject.AddItem(dId, qId, settingVal, false); } clientData.CartInfo.Compute(); clientData.CartInfo.ShowQuantity = false; Session["ClientOrderData"] = clientData; Response.Redirect("ShoppingCartV4.aspx"); } } } }