Exemplo n.º 1
0
        public new void SaveData()
        {
            if (!(Demo.IsDemoEnabled || TrialService.IsTrialEnabled))
            {
                SettingsLic.LicKey = txtKey.Text;
            }

            if (!TemplateService.IsExistTemplate(SettingsDesign.Template))
            {
                SettingsDesign.ChangeTemplate(TemplateService.DefaultTemplateId);
            }

            SettingsMain.ShopName     = txtShopName.Text;
            SettingsMain.SiteUrl      = txtUrl.Text;
            SettingsMain.LogoImageAlt = txtShopName.Text;
            if (fuLogo.HasFile)
            {
                FileHelpers.CreateDirectory(FoldersHelper.GetPathAbsolut(FolderType.Pictures));
                FileHelpers.DeleteFile(FoldersHelper.GetPathAbsolut(FolderType.Pictures, SettingsMain.LogoImageName));
                SettingsMain.LogoImageName = fuLogo.FileName;
                fuLogo.SaveAs(FoldersHelper.GetPathAbsolut(FolderType.Pictures, fuLogo.FileName));
            }

            if (fuFavicon.HasFile)
            {
                FileHelpers.CreateDirectory(FoldersHelper.GetPathAbsolut(FolderType.Pictures));
                FileHelpers.DeleteFile(FoldersHelper.GetPathAbsolut(FolderType.Pictures,
                                                                    SettingsMain.FaviconImageName));
                SettingsMain.FaviconImageName = fuFavicon.FileName;
                fuLogo.SaveAs(FoldersHelper.GetPathAbsolut(FolderType.Pictures, fuFavicon.FileName));
            }

            //SettingsSEO.DefaultMetaTitle = txtTitle.Text;
            //SettingsSEO.DefaultMetaDescription = txtMetadescription.Text;
            //SettingsSEO.DefaultMetaKeywords = txtMetakeywords.Text;
            var countryId = 0;

            int.TryParse(ddlCountry.SelectedValue, out countryId);
            SettingsMain.SellerCountryId = countryId;

            var regionId = RegionService.GetRegionIdByName(txtRegion.Text);

            SettingsMain.SellerRegionId = regionId;

            SettingsMain.City       = txtCity.Text;
            SettingsMain.Phone      = txtPhone.Text;
            SettingsBank.Director   = txtDirector.Text;
            SettingsBank.Accountant = txtAccountant.Text;
            SettingsBank.Manager    = txtManager.Text;
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (EmptyCheck || Order == null)
            {
                return;
            }
            _currency = (Order.OrderCurrency ?? CurrencyService.Currency("USD")) ?? new Currency
            {
                IsCodeBefore = true,
                Iso3         = "USD",
                Name         = "USD",
                PriceFormat  = CurrencyService.DefaultPriceFormat,
                Symbol       = "$",
                Value        = 1
            };

            //var check = new Check_PaymentModule();

            lCompanyName.Text = _Check.CompanyName;
            lAddress.Text     = _Check.Adress;
            lCountry.Text     = _Check.Country;
            lState.Text       = _Check.State;
            lCity.Text        = _Check.City;

            lCompanyPhone.Text = _Check.Phone;
            lInterPhone.Text   = _Check.IntPhone;
            lCompanyFax.Text   = _Check.Fax;

            lOrderDate.Text = AdvantShop.Localization.Culture.ConvertDate(Order.OrderDate);
            // AdvantShop.Localization.Culture.ConvertDate((DateTime)reader["OrderDate"]);
            lOrderId.Text        = @"#" + Order.OrderID;
            lShippingMethod.Text = Order.ShippingMethodName; // reader["ShippingMethod"].ToString();

            lName.Text  = Order.BillingContact.Name;
            lPhone.Text = Order.OrderCustomer.MobilePhone;
            //lFax.Text = Order.BillingContact.Fax;
            //lEmail.Text = Order.BillingContact.Email;
            lEmail.Text = Order.OrderCustomer.Email;

            lBillingAddress.Text = Order.BillingContact.Address;
            lBillingCity.Text    = Order.BillingContact.City;
            lBillingState.Text   = Order.BillingContact.Zone;
            lBillingCountry.Text = Order.BillingContact.Country;
            lBillingZip.Text     = Order.BillingContact.Zip;

            lShippingAddress.Text = Order.ShippingContact.Address;
            lShippingCity.Text    = Order.ShippingContact.City;
            lShippingState.Text   = Order.ShippingContact.Zone;
            lShippingCountry.Text = Order.ShippingContact.Country;
            lShippingZip.Text     = Order.ShippingContact.Zip;



            lSubTotal.Text =
                EvalPrice((Order.Sum - Order.ShippingCost) * 100.0F / (100 - Order.OrderDiscount));
            lShippingCost.Text = EvalPrice(Order.ShippingCost);
            lDiscount.Text     =
                EvalPrice(Order.OrderDiscount * (Order.Sum - Order.ShippingCost / (100 - Order.OrderDiscount)));


            var shippingContact = new AdvantShop.Customers.CustomerContact
            {
                CountryId = CountryService.GetCountryIdByName(lShippingCountry.Text),
                RegionId  = RegionService.GetRegionIdByName(lShippingState.Text)
            };
            var billingContact = new AdvantShop.Customers.CustomerContact
            {
                CountryId = CountryService.GetCountryIdByName(lBillingCountry.Text),
                RegionId  = RegionService.GetRegionIdByName(lBillingState.Text)
            };

            rptOrderItems.DataBind();
            IList <OrderItem> dtOrder = Order.OrderItems;
            var taxedItems            = new List <OrderTax>();

            //foreach (OrderItem item in dtOrder)
            //{
            //    if (item.ProductID != null)
            //    {
            //        ICollection<TaxElement> t = TaxServices.GetTaxesForProduct((int) item.ProductID, billingContact,
            //                                                                   shippingContact);
            //        foreach (TaxElement tax in t)
            //        {
            //            TaxValue taxedItem = taxedItems.Find(tv => tv.TaxID == tax.TaxId);
            //            if (taxedItem != null)
            //            {
            //                taxedItem.TaxSum += TaxServices.CalculateTax(item, tax, Order.OrderDiscount);
            //            }
            //            else
            //            {
            //                taxedItems.Add(new TaxValue
            //                    {
            //                        TaxID = tax.TaxId,
            //                        TaxName = tax.Name,
            //                        TaxShowInPrice = tax.ShowInPrice,
            //                        TaxSum = TaxServices.CalculateTax(item, tax, Order.OrderDiscount)
            //                    });
            //            }
            //        }
            //    }
            //}


            literalTaxCost.Text = BuildTaxTable(taxedItems, _currency.Value, _currency.Iso3,
                                                Resource.Admin_ViewOrder_Taxes);
            lTotal.Text = EvalPrice(Order.Sum);
        }