예제 #1
0
        public frmDanhMucQuocGia()
        {
            InitializeComponent();

            //Create Manager which will use in form
            countryManager = new CountryManager();
        }
예제 #2
0
        public FrmProvider()
        {
            InitializeComponent();

            //
            manufacturerManager = new ProviderManager();
            countryManager = new CountryManager();
        }
예제 #3
0
        public FrmCustomer()
        {
            InitializeComponent();

            //
            customerManager = new CustomerManager();
            countryManager = new CountryManager();
        }
예제 #4
0
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     CountryManager mgr = new CountryManager();
     Country obj = new Country();
     obj.Country_ID = (GridView1.SelectedDataKey).Value.ToString();
     obj = mgr.selectCountry(obj);
     AddEditCountryControl1.populateControls(obj);
     MultiView1.ActiveViewIndex = 1;
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     CountryManager manager = new CountryManager();
     Country country = new Country();
     country.CountryName = TextBox1.Text;
     country.About = TextBox2.Text;
     statusLabel.Text = manager.SaveCountry(country);
        // string saveCountry = manager.SaveCountry(country);
        // Label1.Text = saveCountry;
     Clear();
 }
예제 #6
0
        public FrmSearchProduct(FrmDanhMucSanPham frmParent)
        {
            InitializeComponent();

            productManager = new ProductManager();
            productNameManager = new ProductNameManager();
            categoryManager = new CategoryManager();
            unitManager = new UnitManager();
            countryManager = new CountryManager();
            manufacturerManager = new ManufacturerManager();
            productStatusManager = new ProductStatusManager();

            this.frmParent = frmParent;
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     CityManager cityManager = new CityManager();
     GridView1.DataSource = cityManager.ShowCountryCity();
     GridView1.DataBind();
     CountryManager countryManager = new CountryManager();
     if (!IsPostBack)
     {
         countryDropDownList.DataTextField = "CountryName";
         countryDropDownList.DataValueField = "CountryId";
         countryDropDownList.DataSource = countryManager.ShowCountry();
         countryDropDownList.DataBind();
     }
 }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         CountryManager mgr = new CountryManager();
         Country obj = new Country();
         obj.Country_ID = txtID.Text.Trim();
         lblError.Text = CustomErrors.CHANGES_ACCEDTED_STATUS + mgr.deleteCountry(obj);
         ClearControls();
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
예제 #9
0
        public FrmDanhMucSanPham()
        {
            InitializeComponent();

            //Create Manager which will use in form
            productManager = new ProductManager();
            productNameManager = new ProductNameManager();
            productStatusManager = new ProductStatusManager();
            unitManager = new UnitManager();

            categoryManager = new CategoryManager();
            manufacturerManager = new ManufacturerManager();
            countryManager = new CountryManager();
            providerManager = new ProviderManager();

            //
            MODE = Constants.MODE.ADD;
        }
    protected void btnOpt_Click(object sender, EventArgs e)
    {
        try
        {
            Country obj = CaptureData();

            CountryManager mgr = new CountryManager();

            if ((string)Session["Flag"] == "New")
            {
                lblError.Text = CustomErrors.CHANGES_ACCEDTED_STATUS + mgr.insertCountry(obj);
                ClearControls();
            }
            else
            {
                lblError.Text = CustomErrors.CHANGES_ACCEDTED_STATUS + mgr.updateCountry(obj);
            }
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
예제 #11
0
        public ActionResult Index()
        {
            this.FillSeoInformation("Where To Buy");

            ViewBag.Scripts = new List <string>()
            {
                "where_to_buy.js"
            };

            var model = new WhereToBuyModel();

            model.Countries = CountryManager.GetCountries();

            model.AllRetailList = RetailManager.GetByBrand(this.CurrentBrand);
            if (model.AllRetailList.Retailers != null)
            {
                //sort random
                model.AllRetailList.Retailers = model.AllRetailList.Retailers.OrderBy(x => Guid.NewGuid()).Take(12).ToList();
            }

            ViewBag.HasGoogleMaps = true;
            return(View(PathFromView("WhereToBuy"), model));
        }
예제 #12
0
        protected void btnSave_OnClick(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Save")
            {
                if (this.dlCountryList.Items.Count > 0)
                {
                    Dictionary <int, decimal> itemList = new Dictionary <int, decimal>();
                    foreach (DataListItem lst in dlCountryList.Items)
                    {
                        if ((lst.ItemType == ListItemType.Item) || (lst.ItemType == ListItemType.AlternatingItem))
                        {
                            int     regionId   = (int)dlCountryList.DataKeys[lst.ItemIndex];
                            TextBox txtOrderNo = (TextBox)lst.FindControl("txtOrderNo");

                            decimal percentage = Convert.ToDecimal(txtOrderNo.Text);
                            itemList.Add(regionId, percentage);
                        }
                    }

                    AdminDAL.SaveCountryTax(itemList);
                }
                lblSuccess.Visible = true;
                lblCancel.Visible  = false;
            }
            else
            {
                ddlProducts.DataSource     = CountryManager.GetActiveCountry();
                ddlProducts.DataTextField  = "Name";
                ddlProducts.DataValueField = "CountryId";
                ddlProducts.DataBind();
                BindTaxRegion();
                lblCancel.Visible  = true;
                lblSuccess.Visible = false;
            }
            //redirect
            //Response.Redirect("Main.aspx");
        }
예제 #13
0
        public ActionResult <SampleRiver> Put(int id, [FromBody] SampleRiver river)
        {
            try
            {
                var temp = RiverManager.Get(id);
                if (temp == null)
                {
                    return(NotFound("River is not found"));
                }
                else
                {
                    List <Country> tempList = new List <Country>();
                    foreach (var country in CountryManager.GetAll())
                    {
                        if (river.Countries.Contains(country.ID.ToString()))
                        {
                            tempList.Add(country);
                        }
                    }
                    if (tempList.Count == river.Countries.Count)
                    {
                        logger.LogInformation("RiverController : Put => " + DateTime.Now);

                        RiverManager.Update(temp, river.Name, river.Lenght, tempList);
                        return(Ok());
                    }
                    else
                    {
                        return(NotFound("Country input not found"));
                    }
                }
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
        private void BindCountries(List <string> restrictedShippingCountries = null)
        {
            List <ListItem> listItemList1 = new List <ListItem>();
            List <ListItem> listItemList2 = new List <ListItem>();

            foreach (DataRow row in (InternalDataCollectionBase)CountryManager.GetCountries(true).Country.Rows)
            {
                bool flag = false;
                if (restrictedShippingCountries != null && restrictedShippingCountries.Count > 0)
                {
                    foreach (string country in restrictedShippingCountries)
                    {
                        if (country.Equals(row["Code"].ToString()))
                        {
                            flag = true;
                            break;
                        }
                    }
                }

                ListItem listItem = new ListItem(row["Name"].ToString(), row["Code"].ToString());

                if (flag)
                {
                    listItemList2.Add(listItem);
                }
                else
                {
                    listItemList1.Add(listItem);
                }
            }

            this.CountryList.LeftDataSource  = (object)listItemList1;
            this.CountryList.RightDataSource = (object)listItemList2;
            this.CountryList.DataBind();
        }
        public void After_Edit_ValidObject_Get_Should_Changed()
        {
            // Arrange
            DbContextOptions <RepositoryContext> options = new MockDBHandler().CountryWithThreeMember().build();

            using (var context = new RepositoryContext(options))
            {
                IDataRepository <Country> mockRepository = new CountryManager(context);
                CountryController         countryCont    = new CountryController(mockRepository);
                FilterModel fm = new FilterModel();
                //Act
                Country newCountry = new Country()
                {
                    IsValid = false, Name = "Changed"
                };
                var putResult = countryCont.Put(2, newCountry) as OkObjectResult;
                var okResult  = countryCont.Get(fm);
                // Assert
                var retObj = Assert.IsType <ActionResult <PagedCollectionResponse <Country> > >(okResult);
                Assert.Equal(3, retObj.Value.Items.ToList().Count);
                Assert.False(retObj.Value.Items.ToList()[1].IsValid);
                Assert.Equal("Changed", retObj.Value.Items.ToList()[1].Name);
            }
        }
예제 #16
0
    private void BindDataCountriesToDDL()
    {
        var dictlist = GeolocationUtils.GetCountriesData();

        if (PageRequest == RequestType.Edit)
        {
            var geolocated = new Dictionary <string, string>();

            var ad = new PtcAdvert(Convert.ToInt32(ViewState["editid"]));
            if (ad.IsGeolocatedByCountry)
            {
                var countries = ad.GeolocatedCC.Split(',');
                foreach (var country in countries)
                {
                    if (string.IsNullOrEmpty(country))
                    {
                        continue;
                    }

                    var countryName = CountryManager.GetCountryName(country);
                    dictlist.Remove(countryName);

                    var geolocatedCountry = GeolocationUtils.GetCountryData(countryName);
                    geolocated.Add(geolocatedCountry.Item1, geolocatedCountry.Item2);
                }
                GeoCountries.DataSource     = geolocated;
                GeoCountries.DataTextField  = "Value";
                GeoCountries.DataValueField = "Key";
                GeoCountries.DataBind();
            }
        }
        AllCountries.DataSource     = dictlist;
        AllCountries.DataTextField  = "Value";
        AllCountries.DataValueField = "Key";
        AllCountries.DataBind();
    }
예제 #17
0
    protected void WithdrawViaRepresentativeView_Activate(object sender, EventArgs e)
    {
        var representativesList = Representative.GetAllActiveFromCountry(User.Country);

        if (representativesList.Count > 0)
        {
            SetFeeText();
            NoRepresentativeInfoPlaceHolder.Visible      = false;
            RepresentativeInfoContentPlaceHolder.Visible = true;
            AvaibleRepresentativeList.Items.Clear();

            String RadioButtonStyles = "style=\"float: left; padding-left: 5px; padding-right: 5px; \"";
            foreach (var representative in representativesList)
            {
                var item = new ListItem(String.Format("<p {0}>{1}</p> {2}", RadioButtonStyles, representative.Name, HtmlRatingGenerator.GenerateHtmlRating(RatingType.Representative, representative.UserId)), representative.Id.ToString());
                AvaibleRepresentativeList.Items.Add(item);
            }

            flagImage.ImageUrl = string.Format("~/Images/Flags/{0}.png", CountryManager.GetCountryCode(User.Country).ToLower());

            AvaibleRepresentativeList.SelectedIndex = 0;
            AvaibleRepresentativeList_SelectedIndexChanged(null, null);
        }
    }
예제 #18
0
        public Country SaveInfo()
        {
            Country country = CountryManager.GetCountryById(this.CountryId);

            if (country != null)
            {
                country = CountryManager.UpdateCountry(country.CountryId,
                                                       txtName.Text, cbAllowsRegistration.Checked,
                                                       cbAllowsBilling.Checked, cbAllowsShipping.Checked,
                                                       txtTwoLetterISOCode.Text, txtThreeLetterISOCode.Text,
                                                       txtNumericISOCode.Value, cbPublished.Checked,
                                                       txtDisplayOrder.Value);
            }
            else
            {
                country = CountryManager.InsertCountry(txtName.Text,
                                                       cbAllowsRegistration.Checked, cbAllowsBilling.Checked,
                                                       cbAllowsShipping.Checked, txtTwoLetterISOCode.Text,
                                                       txtThreeLetterISOCode.Text, txtNumericISOCode.Value,
                                                       cbPublished.Checked, txtDisplayOrder.Value);
            }

            return(country);
        }
        private void processNewOrderNotification(string xmlData)
        {
            try
            {
                NewOrderNotification newOrderNotification = (NewOrderNotification)EncodeHelper.Deserialize(xmlData, typeof(NewOrderNotification));
                string googleOrderNumber = newOrderNotification.googleordernumber;

                XmlNode  CustomerInfo       = newOrderNotification.shoppingcart.merchantprivatedata.Any[0];
                int      CustomerID         = Convert.ToInt32(CustomerInfo.Attributes["CustomerID"].Value);
                int      CustomerLanguageID = Convert.ToInt32(CustomerInfo.Attributes["CustomerLanguageID"].Value);
                int      CustomerCurrencyID = Convert.ToInt32(CustomerInfo.Attributes["CustomerCurrencyID"].Value);
                Customer customer           = CustomerManager.GetCustomerById(CustomerID);

                NopSolutions.NopCommerce.BusinessLogic.Orders.ShoppingCart Cart = ShoppingCartManager.GetCustomerShoppingCart(customer.CustomerId, ShoppingCartTypeEnum.ShoppingCart);

                if (customer == null)
                {
                    logMessage("Could not load a customer");
                    return;
                }

                NopContext.Current.User = customer;

                if (Cart.Count == 0)
                {
                    logMessage("Cart is empty");
                    return;
                }

                //validate cart
                foreach (NopSolutions.NopCommerce.BusinessLogic.Orders.ShoppingCartItem sci in Cart)
                {
                    bool ok = false;
                    foreach (Item item in newOrderNotification.shoppingcart.items)
                    {
                        if (!String.IsNullOrEmpty(item.merchantitemid))
                        {
                            if ((Convert.ToInt32(item.merchantitemid) == sci.ShoppingCartItemId) && (item.quantity == sci.Quantity))
                            {
                                ok = true;
                                break;
                            }
                        }
                    }

                    if (!ok)
                    {
                        logMessage(string.Format("Shopping Cart item has been changed. {0}. {1}", sci.ShoppingCartItemId, sci.Quantity));
                        return;
                    }
                }


                string[] billingFullname  = newOrderNotification.buyerbillingaddress.contactname.Trim().Split(new char[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries);
                string   billingFirstName = billingFullname[0];
                string   billingLastName  = string.Empty;
                if (billingFullname.Length > 1)
                {
                    billingLastName = billingFullname[1];
                }
                string        billingEmail           = newOrderNotification.buyerbillingaddress.email.Trim();
                string        billingAddress1        = newOrderNotification.buyerbillingaddress.address1.Trim();
                string        billingAddress2        = newOrderNotification.buyerbillingaddress.address2.Trim();
                string        billingPhoneNumber     = newOrderNotification.buyerbillingaddress.phone.Trim();
                string        billingCity            = newOrderNotification.buyerbillingaddress.city.Trim();
                int           billingStateProvinceID = 0;
                StateProvince billingStateProvince   = StateProvinceManager.GetStateProvinceByAbbreviation(newOrderNotification.buyerbillingaddress.region.Trim());
                if (billingStateProvince != null)
                {
                    billingStateProvinceID = billingStateProvince.StateProvinceId;
                }
                string  billingZipPostalCode = newOrderNotification.buyerbillingaddress.postalcode.Trim();
                int     billingCountryID     = 0;
                Country billingCountry       = CountryManager.GetCountryByTwoLetterIsoCode(newOrderNotification.buyerbillingaddress.countrycode.Trim());
                if (billingCountry != null)
                {
                    billingCountryID = billingCountry.CountryId;
                }

                NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.Address BillingAddress = customer.BillingAddresses.FindAddress(
                    billingFirstName, billingLastName, billingPhoneNumber,
                    billingEmail, string.Empty, string.Empty, billingAddress1, billingAddress2, billingCity,
                    billingStateProvinceID, billingZipPostalCode, billingCountryID);

                if (BillingAddress == null)
                {
                    BillingAddress = CustomerManager.InsertAddress(CustomerID, true,
                                                                   billingFirstName, billingLastName, billingPhoneNumber, billingEmail,
                                                                   string.Empty, string.Empty, billingAddress1,
                                                                   billingAddress2, billingCity,
                                                                   billingStateProvinceID, billingZipPostalCode,
                                                                   billingCountryID, DateTime.Now, DateTime.Now);
                }
                customer = CustomerManager.SetDefaultBillingAddress(customer.CustomerId, BillingAddress.AddressId);

                NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.Address ShippingAddress = null;
                customer.LastShippingOption = null;
                bool shoppingCartRequiresShipping = ShippingManager.ShoppingCartRequiresShipping(Cart);
                if (shoppingCartRequiresShipping)
                {
                    string[] shippingFullname  = newOrderNotification.buyershippingaddress.contactname.Trim().Split(new char[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries);
                    string   shippingFirstName = shippingFullname[0];
                    string   shippingLastName  = string.Empty;
                    if (shippingFullname.Length > 1)
                    {
                        shippingLastName = shippingFullname[1];
                    }
                    string        shippingEmail           = newOrderNotification.buyershippingaddress.email.Trim();
                    string        shippingAddress1        = newOrderNotification.buyershippingaddress.address1.Trim();
                    string        shippingAddress2        = newOrderNotification.buyershippingaddress.address2.Trim();
                    string        shippingPhoneNumber     = newOrderNotification.buyershippingaddress.phone.Trim();
                    string        shippingCity            = newOrderNotification.buyershippingaddress.city.Trim();
                    int           shippingStateProvinceID = 0;
                    StateProvince shippingStateProvince   = StateProvinceManager.GetStateProvinceByAbbreviation(newOrderNotification.buyershippingaddress.region.Trim());
                    if (shippingStateProvince != null)
                    {
                        shippingStateProvinceID = shippingStateProvince.StateProvinceId;
                    }
                    int     shippingCountryID     = 0;
                    string  shippingZipPostalCode = newOrderNotification.buyershippingaddress.postalcode.Trim();
                    Country shippingCountry       = CountryManager.GetCountryByTwoLetterIsoCode(newOrderNotification.buyershippingaddress.countrycode.Trim());
                    if (shippingCountry != null)
                    {
                        shippingCountryID = shippingCountry.CountryId;
                    }

                    ShippingAddress = customer.ShippingAddresses.FindAddress(
                        shippingFirstName, shippingLastName, shippingPhoneNumber,
                        shippingEmail, string.Empty, string.Empty,
                        shippingAddress1, shippingAddress2, shippingCity,
                        shippingStateProvinceID, shippingZipPostalCode, shippingCountryID);
                    if (ShippingAddress == null)
                    {
                        ShippingAddress = CustomerManager.InsertAddress(CustomerID, false,
                                                                        shippingFirstName, shippingLastName, shippingPhoneNumber, shippingEmail,
                                                                        string.Empty, string.Empty, shippingAddress1,
                                                                        shippingAddress2, shippingCity, shippingStateProvinceID,
                                                                        shippingZipPostalCode, shippingCountryID,
                                                                        DateTime.Now, DateTime.Now);
                    }

                    customer = CustomerManager.SetDefaultShippingAddress(customer.CustomerId, ShippingAddress.AddressId);

                    string  shippingMethod = string.Empty;
                    decimal shippingCost   = decimal.Zero;
                    if (newOrderNotification.orderadjustment != null &&
                        newOrderNotification.orderadjustment.shipping != null &&
                        newOrderNotification.orderadjustment.shipping.Item != null)
                    {
                        FlatRateShippingAdjustment ShippingMethod = (FlatRateShippingAdjustment)newOrderNotification.orderadjustment.shipping.Item;
                        shippingMethod = ShippingMethod.shippingname;
                        shippingCost   = ShippingMethod.shippingcost.Value;


                        ShippingOption shippingOption = new ShippingOption();
                        shippingOption.Name         = shippingMethod;
                        shippingOption.Rate         = shippingCost;
                        customer.LastShippingOption = shippingOption;
                    }
                }

                //customer.LastCalculatedTax = decimal.Zero;

                PaymentMethod googleCheckoutPaymentMethod = PaymentMethodManager.GetPaymentMethodBySystemKeyword("GoogleCheckout");

                PaymentInfo paymentInfo = new PaymentInfo();
                paymentInfo.PaymentMethodId   = googleCheckoutPaymentMethod.PaymentMethodId;
                paymentInfo.BillingAddress    = BillingAddress;
                paymentInfo.ShippingAddress   = ShippingAddress;
                paymentInfo.CustomerLanguage  = LanguageManager.GetLanguageById(CustomerLanguageID);
                paymentInfo.CustomerCurrency  = CurrencyManager.GetCurrencyById(CustomerCurrencyID);
                paymentInfo.GoogleOrderNumber = googleOrderNumber;
                int    orderID = 0;
                string result  = OrderManager.PlaceOrder(paymentInfo, customer, out orderID);
                if (!String.IsNullOrEmpty(result))
                {
                    logMessage("new-order-notification received. CreateOrder() error: Order Number " + orderID + ". " + result);
                    return;
                }

                Order order = OrderManager.GetOrderById(orderID);
                logMessage("new-order-notification received and saved: Order Number " + orderID);
            }
            catch (Exception exc)
            {
                logMessage("processNewOrderNotification Exception: " + exc.Message + ": " + exc.StackTrace);
            }
        }
예제 #20
0
        protected void LoadOrderDetails()
        {
            Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true);

            dlordersList.DataSource = orderData.SkuItems;
            dlordersList.DataBind();

            LiteralSubTotal.Text = Math.Round(orderData.SubTotal, 2).ToString();
            LiteralShipping.Text = Math.Round(orderData.ShippingCost, 2).ToString();
            LiteralTax.Text      = Math.Round(orderData.Tax, 2).ToString();
            LiteralTotal.Text    = Math.Round(orderData.Total, 2).ToString();

            // shipping literals
            LiteralName.Text     = String.Format("{0} {1}", orderData.CustomerInfo.ShippingAddress.FirstName, orderData.CustomerInfo.ShippingAddress.LastName);
            LiteralEmail.Text    = orderData.CustomerInfo.Email;
            LiteralAddress.Text  = orderData.CustomerInfo.ShippingAddress.Address1;
            LiteralAddress2.Text = orderData.CustomerInfo.ShippingAddress.Address2;
            LiteralCity.Text     = orderData.CustomerInfo.ShippingAddress.City;
            LiteralZip.Text      = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
            LiteralState.Text    = StateManager.GetStateName(orderData.CustomerInfo.ShippingAddress.StateProvinceId);
            LiteralCountry.Text  = CountryManager.CountryName(orderData.CustomerInfo.ShippingAddress.CountryId);

            // shipping edit controls
            txtShippingFirstName.Text = orderData.CustomerInfo.ShippingAddress.FirstName;
            txtShippingLastName.Text  = orderData.CustomerInfo.ShippingAddress.LastName;
            txtShippingAddress.Text   = orderData.CustomerInfo.ShippingAddress.Address1;
            txtShippingAddress2.Text  = orderData.CustomerInfo.ShippingAddress.Address2;
            txtShippingCity.Text      = orderData.CustomerInfo.ShippingAddress.City;
            txtShippingZipCode.Text   = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
            SetCountryAndStateDropDown(ddlShippingCountry, ddlShippingState, orderData.CustomerInfo.ShippingAddress.CountryId, Convert.ToString(orderData.CustomerInfo.ShippingAddress.StateProvinceId));

            // billing literals
            LiteralName_b.Text     = String.Format("{0} {1}", orderData.CustomerInfo.BillingAddress.FirstName, orderData.CustomerInfo.BillingAddress.LastName);
            LiteralAddress_b.Text  = orderData.CustomerInfo.BillingAddress.Address1;
            LiteralAddress2_b.Text = orderData.CustomerInfo.BillingAddress.Address2;
            LiteralCity_b.Text     = orderData.CustomerInfo.BillingAddress.City;
            LiteralZip_b.Text      = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
            LiteralState_b.Text    = StateManager.GetStateName(orderData.CustomerInfo.BillingAddress.StateProvinceId);
            LiteralCountry_b.Text  = CountryManager.CountryName(orderData.CustomerInfo.BillingAddress.CountryId);

            // billing edit controls
            txtBillingFirstName.Text = orderData.CustomerInfo.BillingAddress.FirstName;
            txtBillingLastName.Text  = orderData.CustomerInfo.BillingAddress.LastName;
            txtBillingAddress.Text   = orderData.CustomerInfo.BillingAddress.Address1;
            txtBillingAddress2.Text  = orderData.CustomerInfo.BillingAddress.Address2;
            txtBillingCity.Text      = orderData.CustomerInfo.BillingAddress.City;
            txtBillingZipCode.Text   = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
            SetCountryAndStateDropDown(ddlBillingCountry, ddlBillingState, orderData.CustomerInfo.BillingAddress.CountryId, Convert.ToString(orderData.CustomerInfo.BillingAddress.StateProvinceId));

            txtEmail.Text = orderData.CustomerInfo.Email;

            // payment info
            AuthorizationCode    = orderData.CreditInfo.AuthorizationCode;
            TransactionCode      = orderData.CreditInfo.TransactionCode;
            Version              = orderData.VersionName;
            CreditCardName       = orderData.CreditInfo.CreditCardName;
            CreditCardExpireDate = orderData.CreditInfo.CreditCardExpired.ToString("MM/yyyy");
            CreditCardCSC        = orderData.CreditInfo.CreditCardCSC;
            CreditCardLast4      = orderData.CreditInfo.CreditCardNumber.Length > 4 ? orderData.CreditInfo.CreditCardNumber.Substring(orderData.CreditInfo.CreditCardNumber.Length - 4, 4)
                : orderData.CreditInfo.CreditCardNumber;

            ucAttributes.Populate(orderData);
        }
예제 #21
0
 // DELETE api/<controller>/5
 /// <summary>
 /// Deletes the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 public void Delete(Int32 id)
 {
     CountryManager.DeleteItem(id);
 }
예제 #22
0
 public virtual CountryDto GetCountries()
 {
     return(CountryManager.GetCountries());
 }
예제 #23
0
 public CountryController()
 {
     CountryManager   = new CountryManager(new UnitOfWork(new DataContext()));
     ContinentManager = new ContinentManager(new UnitOfWork(new DataContext()));
 }
예제 #24
0
 // PUT api/<controller>/5
 /// <summary>
 /// Puts the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 /// <exception cref="HttpResponseException"></exception>
 public Country Put(string id, [FromBody] Country value)
 {
     return(CountryManager.UpdateItem(value));
 }
예제 #25
0
 // GET api/<controller>
 /// <summary>
 /// Gets this instance.
 /// </summary>
 /// <returns></returns>
 public CountryCollection Get()
 {
     return(CountryManager.GetAllItem());
 }
예제 #26
0
        public string GetShipRateRequest(ClientCartContext cart)
        {
            String strXml = String.Empty;

            using (StringWriter str = new StringWriter())
            {
                using (XmlTextWriter xml = new XmlTextWriter(str))
                {
                    //root node

                    List <StateProvince> states = StateManager.GetAllStates(0);
                    xml.WriteStartDocument();
                    xml.WriteWhitespace("\n");
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    xml.WriteStartElement("RateRequest");
                    xml.WriteWhitespace("\n");

                    xml.WriteElementString("Username", "*****@*****.**");
                    xml.WriteWhitespace("\n");
                    xml.WriteElementString("Password", "5922d4678819620d");
                    xml.WriteWhitespace("\n");
                    //xml.WriteElementString("Server", "Test");
                    //xml.WriteWhitespace("\n");
                    //xml.WriteElementString("Referer", "Test");
                    //xml.WriteWhitespace("\n");
                    xml.WriteStartElement("Order");
                    xml.WriteAttributeString("id", "TESTTSE" + cart.CustomerInfo.CustomerId);
                    xml.WriteWhitespace("\n");

                    xml.WriteElementString("Warehouse", "0");
                    xml.WriteWhitespace("\n");
                    xml.WriteStartElement("AddressInfo");
                    xml.WriteAttributeString("type", "ship");
                    xml.WriteWhitespace("\n");

                    xml.WriteElementString("Address1", cart.CustomerInfo.ShippingAddress.Address1);
                    xml.WriteWhitespace("\n");
                    xml.WriteElementString("Address2", cart.CustomerInfo.ShippingAddress.Address2);
                    xml.WriteWhitespace("\n");
                    xml.WriteElementString("City", cart.CustomerInfo.ShippingAddress.City);
                    xml.WriteWhitespace("\n");
                    StateProvince itemShippingStateProvince = states.FirstOrDefault(x => x.StateProvinceId == Convert.ToInt32(cart.CustomerInfo.ShippingAddress.StateProvinceId));
                    if (itemShippingStateProvince != null)
                    {
                        xml.WriteElementString("State", itemShippingStateProvince.Abbreviation.Trim());
                        xml.WriteWhitespace("\n");
                    }
                    else
                    {
                        xml.WriteElementString("State", string.Empty);
                        xml.WriteWhitespace("\n");
                    }

                    string country1 = CountryManager.CountryCode(cart.CustomerInfo.ShippingAddress.CountryId);

                    xml.WriteElementString("Country", country1.Trim());
                    xml.WriteWhitespace("\n");
                    xml.WriteElementString("ZIP", cart.CustomerInfo.ShippingAddress.ZipPostalCode);
                    xml.WriteWhitespace("\n");


                    xml.WriteEndElement();


                    xml.WriteStartElement("Item");
                    xml.WriteAttributeString("num", "0");
                    xml.WriteWhitespace("\n");

                    xml.WriteElementString("Code", "1000001");
                    xml.WriteWhitespace("\n");
                    xml.WriteElementString("Quantity", "1");
                    xml.WriteWhitespace("\n");

                    xml.WriteEndElement();
                    xml.WriteWhitespace("\n");

                    xml.WriteEndElement();
                    xml.WriteWhitespace("\n");

                    xml.WriteEndElement();



                    strXml = str.ToString();
                }
            }
            return(strXml);
        }
예제 #27
0
 public CountriesController(IRepository <Country> countryRepo)
 {
     countryManager = new CountryManager(countryRepo);
 }
        private void BindData()
        {
            if (orderId > 0)
            {
                Order orderData = CSWebBase.CustomOrderManager.GetOrderDetails(orderId);

                dlordersList.DataSource = orderData.SkuItems;
                dlordersList.DataBind();
                LiteralSubTotal.Text = Math.Round(orderData.SubTotal, 2).ToString();
                LiteralShipping.Text = Math.Round(orderData.ShippingCost, 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);
                }



                LiteralName.Text     = String.Format("{0} {1}", orderData.CustomerInfo.ShippingAddress.FirstName, orderData.CustomerInfo.ShippingAddress.LastName);
                LiteralEmail.Text    = orderData.CustomerInfo.Email;
                LiteralAddress.Text  = orderData.CustomerInfo.ShippingAddress.Address1;
                LiteralAddress2.Text = orderData.CustomerInfo.ShippingAddress.Address2;
                if (LiteralAddress2.Text.Equals(""))
                {
                    pnlSAddress2.Visible = false;
                }
                else
                {
                    pnlSAddress2.Visible = true;
                }
                LiteralCity.Text    = orderData.CustomerInfo.ShippingAddress.City;
                LiteralZip.Text     = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
                LiteralState.Text   = StateManager.GetStateName(orderData.CustomerInfo.ShippingAddress.StateProvinceId);
                LiteralCountry.Text = CountryManager.CountryName(orderData.CustomerInfo.ShippingAddress.CountryId);

                LiteralName_b.Text     = String.Format("{0} {1}", orderData.CustomerInfo.BillingAddress.FirstName, orderData.CustomerInfo.BillingAddress.LastName);
                LiteralAddress_b.Text  = orderData.CustomerInfo.BillingAddress.Address1;
                LiteralAddress2_b.Text = orderData.CustomerInfo.BillingAddress.Address2;
                if (LiteralAddress2_b.Text.Equals(""))
                {
                    pnlBAddress2.Visible = false;
                }
                else
                {
                    pnlBAddress2.Visible = true;
                }
                LiteralCity_b.Text    = orderData.CustomerInfo.BillingAddress.City;
                LiteralZip_b.Text     = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
                LiteralState_b.Text   = StateManager.GetStateName(orderData.CustomerInfo.BillingAddress.StateProvinceId);
                LiteralCountry_b.Text = CountryManager.CountryName(orderData.CustomerInfo.BillingAddress.CountryId);
                LiteralPhone.Text     = orderData.CustomerInfo.BillingAddress.PhoneNumber;
                //Google Analutics E-Commerce Pixel
                //LoadGoogleAnalytics(orderData);
            }
        }
예제 #29
0
        /// <summary>
        /// Post process payment (payment gateways that require redirecting)
        /// </summary>
        /// <param name="order">Order</param>
        /// <returns>The error status, or String.Empty if no errors</returns>
        public string PostProcessPayment(Order order)
        {
            string returnURL = CommonHelper.GetStoreLocation(false) + "WorldpayReturn.aspx";

            RemotePost remotePostHelper = new RemotePost();

            remotePostHelper.FormName = "WorldpayForm";
            remotePostHelper.Url      = GetWorldpayUrl();

            remotePostHelper.Add("instId", instanceID);
            remotePostHelper.Add("cartId", order.OrderId.ToString());

            if (!string.IsNullOrEmpty(SettingManager.GetSettingValue(WorldpayConstants.SETTING_CREDITCARD_CODE_PROPERTY)))
            {
                remotePostHelper.Add("paymentType", SettingManager.GetSettingValue(WorldpayConstants.SETTING_CREDITCARD_CODE_PROPERTY));
            }

            if (!string.IsNullOrEmpty(SettingManager.GetSettingValue(WorldpayConstants.SETTING_WorldPayCSSName)))
            {
                remotePostHelper.Add("MC_WorldPayCSSName", SettingManager.GetSettingValue(WorldpayConstants.SETTING_WorldPayCSSName));
            }

            remotePostHelper.Add("currency", CurrencyManager.PrimaryStoreCurrency.CurrencyCode);
            remotePostHelper.Add("email", order.BillingEmail);
            remotePostHelper.Add("hideContact", "true");
            remotePostHelper.Add("noLanguageMenu", "true");
            remotePostHelper.Add("withDelivery", "true");
            remotePostHelper.Add("fixContact", "false");
            remotePostHelper.Add("amount", order.OrderTotal.ToString(new CultureInfo("en-US", false).NumberFormat));
            remotePostHelper.Add("desc", SettingManager.StoreName);
            remotePostHelper.Add("M_UserID", order.CustomerId.ToString());
            remotePostHelper.Add("M_FirstName", order.BillingFirstName);
            remotePostHelper.Add("M_LastName", order.BillingLastName);
            remotePostHelper.Add("M_Addr1", order.BillingAddress1);
            remotePostHelper.Add("tel", order.BillingPhoneNumber);
            remotePostHelper.Add("M_Addr2", order.BillingAddress2);
            remotePostHelper.Add("M_Business", order.BillingCompany);

            CultureInfo cultureInfo = new CultureInfo(NopContext.Current.WorkingLanguage.LanguageCulture);

            remotePostHelper.Add("lang", cultureInfo.TwoLetterISOLanguageName);

            StateProvince billingStateProvince = StateProvinceManager.GetStateProvinceById(order.BillingStateProvinceId);

            if (billingStateProvince != null)
            {
                remotePostHelper.Add("M_StateCounty", billingStateProvince.Abbreviation);
            }
            else
            {
                remotePostHelper.Add("M_StateCounty", order.BillingStateProvince);
            }
            if (!useSandBox)
            {
                remotePostHelper.Add("testMode", "0");
            }
            else
            {
                remotePostHelper.Add("testMode", "100");
            }
            remotePostHelper.Add("postcode", order.BillingZipPostalCode);
            Country billingCountry = CountryManager.GetCountryById(order.BillingCountryId);

            if (billingCountry != null)
            {
                remotePostHelper.Add("country", billingCountry.TwoLetterIsoCode);
            }
            else
            {
                remotePostHelper.Add("country", order.BillingCountry);
            }

            remotePostHelper.Add("address", order.BillingAddress1 + "," + order.BillingCountry);
            remotePostHelper.Add("MC_callback", returnURL);
            remotePostHelper.Add("name", order.BillingFirstName + " " + order.BillingLastName);

            if (order.ShippingStatus != ShippingStatusEnum.ShippingNotRequired)
            {
                remotePostHelper.Add("delvName", order.ShippingFullName);
                string delvAddress = order.ShippingAddress1;
                delvAddress += (!string.IsNullOrEmpty(order.ShippingAddress2)) ? " " + order.ShippingAddress2 : string.Empty;
                remotePostHelper.Add("delvAddress", delvAddress);
                remotePostHelper.Add("delvPostcode", order.ShippingZipPostalCode);
                Country shippingCountry = CountryManager.GetCountryById(order.ShippingCountryId);
                remotePostHelper.Add("delvCountry", shippingCountry.TwoLetterIsoCode);
            }

            remotePostHelper.Post();
            return(string.Empty);
        }
        public void SaveData()
        {
            ClientCartContext clientData = ClientOrderData;

            if (Page.IsValid)
            {
                Customer CustData = new Customer();

                //Set Customer Information
                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       = CountryManager.CountryId("United States");
                shippingAddress.ZipPostalCode   = CommonHelper.fixquotesAccents(txtShippingZipCode.Text);

                CustData.ShippingAddress = shippingAddress;



                CustData.FirstName   = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                CustData.LastName    = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                CustData.PhoneNumber = txtPhoneNumber1.Text;// +txtPhoneNumber2.Text + txtPhoneNumber3.Text;
                CustData.Email       = CommonHelper.fixquotesAccents(txtEmail.Text);
                CustData.Username    = CommonHelper.fixquotesAccents(txtEmail.Text);

                //CustData.ShippingAddress = billingAddress;

                if (!pnlShippingAddress.Visible)
                {
                    CustData.BillingAddress = shippingAddress;
                }
                else
                {
                    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       = CountryManager.CountryId("United States");
                    billingAddress.ZipPostalCode   = CommonHelper.fixquotesAccents(txtZipCode.Text);
                    CustData.BillingAddress        = billingAddress;
                }



                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;

                // add rush shipping level to cart object
                if (!string.IsNullOrEmpty(ddlAdditionShippingCharge.SelectedValue))
                {
                    clientData.CartInfo.ShippingChargeKey = ddlAdditionShippingCharge.SelectedValue;
                }

                //Save opt-in value in order
                clientData.OrderAttributeValues.AddOrUpdateAttributeValue("SpecialOffersOptIn", new CSBusiness.Attributes.AttributeValue(chkOptIn.Checked));

                ClientOrderData = clientData;

                //Set the Client Order objects
                ClientCartContext contextData = (ClientCartContext)Session["ClientOrderData"];
                contextData.CustomerInfo = CustData;
                ////////contextData.CartAbandonmentId = CSResolve.Resolve<ICustomerService>().InsertCartAbandonment(CustData, contextData);
                Session["ClientOrderData"] = contextData;
                //Save Order information before upsale process
                int orderId = 0;

                //if (rId == 1)
                contextData.CartAbandonmentId = CSResolve.Resolve <ICustomerService>().InsertCartAbandonment(CustData, contextData);
                orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);
                UserSessions.InsertSessionEntry(Context, true, clientData.CartInfo.Total, clientData.CustomerInfo.CustomerId, orderId);

                //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("Postsale.aspx");
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     CountryManager manager = new CountryManager();
         GridView1.DataSource = manager.ShowCountry();
         GridView1.DataBind();
 }
예제 #32
0
 public VATManager()
 {
     participantValidator = new ParticipantValidator();
     countryManager       = CountryManager.GetInstance();
 }
예제 #33
0
 // GET api/<controller>/5
 /// <summary>
 /// Gets the specified COM group identifier.
 /// </summary>
 /// <param name="CountryId">The COM group identifier.</param>
 /// <returns></returns>
 public Country Get(Int32 CountryID)
 {
     return(CountryManager.GetItemByID(CountryID));
 }
예제 #34
0
 public VATManager(IParticipantValidator participantValidator)
 {
     this.participantValidator = participantValidator;
     countryManager            = CountryManager.GetInstance();
 }
예제 #35
0
 // POST api/<controller>
 /// <summary>
 /// Posts the specified value.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public Country Post([FromBody] Country value)
 {
     return(CountryManager.AddItem(value));
 }
예제 #36
0
        private void BindData()
        {
            var customer = CustomerManager.GetCustomerById(this.CustomerId);

            if (customer == null)
            {
                this.Visible = false;
                return;
            }

            if (CustomerManager.AllowCustomersToUploadAvatars)
            {
                phAvatar.Visible = true;
                var customerAvatar = customer.Avatar;
                int avatarSize     = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                if (customerAvatar != null)
                {
                    string pictureUrl = PictureManager.GetPictureUrl(customerAvatar, avatarSize, false);
                    this.imgAvatar.ImageUrl = pictureUrl;
                }
                else
                {
                    if (CustomerManager.DefaultAvatarEnabled)
                    {
                        string pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                        this.imgAvatar.ImageUrl = pictureUrl;
                    }
                    else
                    {
                        phAvatar.Visible = false;
                    }
                }
            }
            else
            {
                phAvatar.Visible = false;
            }

            phFullName.Visible = false;

            if (CustomerManager.ShowCustomersLocation)
            {
                phLocation.Visible = true;
                var country = CountryManager.GetCountryById(customer.CountryId);
                if (country != null)
                {
                    lblCountry.Text = Server.HtmlEncode(country.Name);
                }
                else
                {
                    phLocation.Visible = false;
                }
            }
            else
            {
                phLocation.Visible = false;
            }

            if (ForumManager.AllowPrivateMessages)
            {
                if (customer != null && !customer.IsGuest)
                {
                    btnSendPM.CustomerId = customer.CustomerId;
                    phPM.Visible         = true;
                }
                else
                {
                    phPM.Visible = false;
                }
            }
            else
            {
                phPM.Visible = false;
            }

            if (ForumManager.ForumsEnabled && ForumManager.ShowCustomersPostCount)
            {
                phTotalPosts.Visible = true;
                lblTotalPosts.Text   = customer.TotalForumPosts.ToString();
            }
            else
            {
                phTotalPosts.Visible = false;
            }

            if (CustomerManager.ShowCustomersJoinDate)
            {
                phJoinDate.Visible = true;
                lblJoinDate.Text   = DateTimeHelper.ConvertToUserTime(customer.RegistrationDate).ToString("f");
            }
            else
            {
                phJoinDate.Visible = false;
            }


            if (customer.DateOfBirth.HasValue)
            {
                lblDateOfBirth.Text = customer.DateOfBirth.Value.ToString("D");
            }
            else
            {
                phDateOfBirth.Visible = false;
            }

            if (ForumManager.ForumsEnabled)
            {
                int totaRecords = 0;
                int pageSize    = 5;
                if (ForumManager.LatestUserPostsPageSize > 0)
                {
                    pageSize = ForumManager.LatestUserPostsPageSize;
                }
                var forumPosts = ForumManager.GetAllPosts(0,
                                                          customer.CustomerId, string.Empty, false, pageSize, 0, out totaRecords);
                if (forumPosts.Count > 0)
                {
                    rptrLatestPosts.DataSource = forumPosts;
                    rptrLatestPosts.DataBind();
                }
                else
                {
                    phLatestPosts.Visible = false;
                }
            }
            else
            {
                phLatestPosts.Visible = false;
            }
        }
예제 #37
0
        public void LoadGoogleAnalytics(Order Order)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("<script>");
                sb.AppendLine("var pageTracker = _gat._getTracker('UA-10581943-59');");
                sb.AppendLine("pageTracker._trackPageview();");
                sb.AppendFormat("pageTracker._addTrans('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}' );\n", Order.OrderId, "", Order.Total, Math.Round(Order.Tax, 2), Math.Round(Order.ShippingCost, 2), Order.CustomerInfo.BillingAddress.City, Order.CustomerInfo.BillingAddress.StateProvinceId, CountryManager.CountryName(Order.CustomerInfo.BillingAddress.CountryId));


                foreach (Sku sku in Order.SkuItems)
                {
                    sb.AppendFormat("pageTracker._addItem('{0}','{1}','{2}','{3}','{4}','{5}');\n", Order.OrderId, sku.SkuCode, sku.Title, "", Math.Round(Convert.ToDouble(sku.InitialPrice), 2), sku.Quantity);
                }
                sb.AppendLine("pageTracker._trackTrans();");
                sb.AppendLine("</script>");
                LiteralGoogleAnalytics.Text = sb.ToString();
            }
            catch (Exception) { }
        }
예제 #38
0
        private void BindData()
        {
            if (orderId > 0)
            {
                Order orderData = CSWebBase.CustomOrderManager.GetOrderDetails(orderId);

                List <Sku> skus = orderData.SkuItems.FindAll(x => !CSWebBase.SiteBasePage.IsKitBundleItem(x.SkuId));

                foreach (Sku sku in skus)
                {
                    if (CSWebBase.SiteBasePage.IsMainSku(sku.SkuId))
                    {
                        decimal totalPrice = sku.TotalPrice;

                        // add up all initial prices of all kit bundle items
                        foreach (Sku bundleSku in orderData.SkuItems.FindAll(x => CSWebBase.SiteBasePage.IsKitBundleItem(x.SkuId)))
                        {
                            totalPrice += bundleSku.TotalPrice;
                        }

                        sku.TotalPrice = totalPrice;
                    }
                }

                skus.Sort(new CSWebBase.SkuSortComparer());

                dlordersList.DataSource = skus;
                dlordersList.DataBind();
                LiteralSubTotal.Text = Math.Round(orderData.SubTotal, 2).ToString();
                LiteralShipping.Text = Math.Round(CSWebBase.SiteBasePage.GetShippingCost(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 && (CSWebBase.SiteBasePage.FreeShipDiscountCodeMainSku ?? string.Empty).ToUpper() != orderData.DiscountCode.ToUpper())
                {
                    if (orderData.DiscountAmount > 0)
                    {
                        pnlPromotionLabel.Visible    = true;
                        pnlPromotionalAmount.Visible = true;

                        lblPromotionPrice.Text = String.Format("(${0:0.00})", orderData.DiscountAmount);
                    }
                }



                LiteralName.Text     = String.Format("{0} {1}", orderData.CustomerInfo.ShippingAddress.FirstName, orderData.CustomerInfo.ShippingAddress.LastName);
                LiteralEmail.Text    = orderData.CustomerInfo.Email;
                LiteralAddress.Text  = orderData.CustomerInfo.ShippingAddress.Address1;
                LiteralAddress2.Text = orderData.CustomerInfo.ShippingAddress.Address2;
                LiteralCity.Text     = orderData.CustomerInfo.ShippingAddress.City;
                LiteralZip.Text      = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
                LiteralState.Text    = StateManager.GetStateName(orderData.CustomerInfo.ShippingAddress.StateProvinceId);
                LiteralCountry.Text  = CountryManager.CountryName(orderData.CustomerInfo.ShippingAddress.CountryId);

                LiteralName_b.Text     = String.Format("{0} {1}", orderData.CustomerInfo.BillingAddress.FirstName, orderData.CustomerInfo.BillingAddress.LastName);
                LiteralAddress_b.Text  = orderData.CustomerInfo.BillingAddress.Address1;
                LiteralAddress2_b.Text = orderData.CustomerInfo.BillingAddress.Address2;
                LiteralCity_b.Text     = orderData.CustomerInfo.BillingAddress.City;
                LiteralZip_b.Text      = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
                LiteralState_b.Text    = StateManager.GetStateName(orderData.CustomerInfo.BillingAddress.StateProvinceId);
                LiteralCountry_b.Text  = CountryManager.CountryName(orderData.CustomerInfo.BillingAddress.CountryId);

                //Google Analutics E-Commerce Pixel
                //LoadGoogleAnalytics(orderData);
            }
        }
예제 #39
0
        public IEnumerable <string> GetRegionsByCountryCode(string countryCode)
        {
            var country = CountryManager.GetCountry(countryCode, false)?.Country?.FirstOrDefault();

            return(country != null?GetRegionsForCountry(country) : Enumerable.Empty <string>());
        }
예제 #40
0
        public static GetTaxRequest GetTax_Request(int orderId, bool UpdateOrderTax, bool CartTax, ClientCartContext clientData)
        {
            string ShippingStateProvinceAbbreviation = "";
            // string BillingStateProvinceAbbreviation = "";
            List <StateProvince> states = StateManager.GetAllStates(0);

            XmlNode config = null;

            config = GetTax_AvalaraConfig();

            GetTaxRequest getTaxRequest = new GetTaxRequest();
            List <Sku>    OrderSkuItems = null;

            CSWeb.AvaTax.Address address1 = new CSWeb.AvaTax.Address();
            address1.AddressCode = "01";
            address1.Line1       = config.Attributes["address1Line1"].Value;
            address1.City        = config.Attributes["City"].Value;
            address1.Region      = config.Attributes["Region"].Value;

            CSWeb.AvaTax.Address address2 = new CSWeb.AvaTax.Address();
            address2.AddressCode = "02";

            if (orderId > 0 && CartTax == false)
            {
                CSBusiness.OrderManagement.Order orderItem = new OrderManager().GetBatchProcessOrder(orderId);
                getTaxRequest.CustomerCode = orderItem.CustomerId.ToString();            // "ABC4335";
                //getTaxRequest.CompanyCode = config.Attributes["companyCode"].Value;
                getTaxRequest.DocDate = orderItem.CreatedDate.ToString("yyyy-MM-dd");    // "2014-07-23";
                address2.Line1        = orderItem.CustomerInfo.ShippingAddress.Address1; // "1999 Avenue of Stars"; // "118 N Clark St";
                address2.Line2        = orderItem.CustomerInfo.ShippingAddress.Address2; // "Suite 1830"; // "Suite 100";
                // address2.Line3 = "ATTN Accounts Payable";
                address2.City = orderItem.CustomerInfo.ShippingAddress.City;             // "Los Angeles"; // "Chicago";

                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();
                //}
                address2.Region     = ShippingStateProvinceAbbreviation;                         // "IL";
                address2.Country    = orderItem.CustomerInfo.ShippingAddress.CountryCode.Trim(); // "US";
                address2.PostalCode = orderItem.CustomerInfo.ShippingAddress.ZipPostalCode;      //  "90067"; //  "60602";
                OrderSkuItems       = orderItem.SkuItems;
            }
            else if (CartTax)
            {
                StateProvince itemShippingStateProvince = states.FirstOrDefault(x => x.StateProvinceId == Convert.ToInt32(clientData.CustomerInfo.ShippingAddress.StateProvinceId));
                if (itemShippingStateProvince != null)
                {
                    ShippingStateProvinceAbbreviation = itemShippingStateProvince.Abbreviation.Trim();
                }
                getTaxRequest.CustomerCode = "1";                                         // "ABC4335";
                //getTaxRequest.CompanyCode = config.Attributes["companyCode"].Value;
                getTaxRequest.DocDate = DateTime.Now.ToString("yyyy-MM-dd");              // "2014-07-23";
                address2.Line1        = clientData.CustomerInfo.ShippingAddress.Address1; // "1999 Avenue of Stars"; // "118 N Clark St";
                address2.Line2        = clientData.CustomerInfo.ShippingAddress.Address2; // "Suite 1830"; // "Suite 100";
                // address2.Line3 = "ATTN Accounts Payable";
                address2.City   = clientData.CustomerInfo.ShippingAddress.City;           // "Los Angeles"; // "Chicago";
                address2.Region = ShippingStateProvinceAbbreviation;                      // "IL";
                List <Country> countries   = CountryManager.GetActiveCountry();
                Country        ShipCountry = countries.First(x => x.CountryId == clientData.CustomerInfo.ShippingAddress.CountryId);
                // address2.Country = "US"; // clientData.CustomerInfo.ShippingAddress.CountryCode.Trim(); // "US";
                if (itemShippingStateProvince != null)
                {
                    address2.Country = ShipCountry.Code.Trim();
                }
                else
                {
                    address2.Country = "US";
                }
                address2.PostalCode = clientData.CustomerInfo.ShippingAddress.ZipPostalCode; //  "90067"; //  "60602";
                OrderSkuItems       = clientData.CartInfo.CartItems;
            }

            CSWeb.AvaTax.Address[] addresses = { address1, address2 };
            getTaxRequest.Addresses = addresses;
            CSWeb.AvaTax.Line[] lines = new CSWeb.AvaTax.Line[OrderSkuItems.Count]; // orderItem.SkuItems.Count];
            int LineNo = 1;

            foreach (Sku Item in OrderSkuItems) // orderItem.SkuItems)
            {
                Item.LoadAttributeValues();
                CSWeb.AvaTax.Line line1 = new CSWeb.AvaTax.Line();
                if (LineNo < 10)
                {
                    line1.LineNo = "0" + LineNo.ToString();
                }
                else
                {
                    line1.LineNo = LineNo.ToString();
                }
                line1.ItemCode = Item.SkuCode;
                line1.Qty      = Item.Quantity;
                decimal SKUCost = Item.FullPrice * Item.Quantity; // 249.95M;

                //if (Item.AttributeValues.ContainsKey("isrushshipsku"))
                //{
                //    if (Item.AttributeValues["isrushshipsku"].Value.ToString().Equals("1"))
                //    {
                //        if (Item.AttributeValues.ContainsKey("shippingcost_display"))
                //        {
                //            SKUCost = Convert.ToDecimal(Item.AttributeValues["shippingcost_display"].Value.ToString().Trim());
                //        }
                //    }
                //}

                line1.Amount          = SKUCost;
                line1.OriginCode      = "01";
                line1.DestinationCode = "02";
                lines[LineNo - 1]     = line1; //  Add it Array of Lines
                LineNo = LineNo + 1;
            }
            getTaxRequest.Lines       = lines;
            getTaxRequest.CompanyCode = config.Attributes["companyCode"].Value;

            return(getTaxRequest);
        }
예제 #41
0
 private CountryDto GetCountries() => CountryManager.GetCountries();