Ejemplo n.º 1
0
        protected void lbDeleteSelected_Click(object sender, EventArgs e)
        {
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                var currency = CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3);

                if (!_inverseSelection)
                {
                    foreach (var id in _selectionFilter.Values)
                    {
                        if (currency != null && currency.CurrencyID != SQLDataHelper.GetInt(id))
                        {
                            CurrencyService.DeleteCurrency(SQLDataHelper.GetInt(id));
                        }
                    }
                }
                else
                {
                    var itemsIds = _paging.ItemsIds <int>("CurrencyID as ID");
                    foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString(CultureInfo.InvariantCulture))))
                    {
                        if (currency != null && currency.CurrencyID != id)
                        {
                            CurrencyService.DeleteCurrency(id);
                        }
                    }
                }
                CurrencyService.RefreshCurrency();
            }
        }
Ejemplo n.º 2
0
        public static string GetStringPrice(decimal price, int qty, string currencyCode, decimal currencyRate)
        {
            Currency cur = CurrencyService.Currency(currencyCode);

            if (cur == null)
            {
                return(GetStringPrice(price, currencyRate, currencyCode, 0, qty, false, CurrencyService.DefaultPriceFormat, null, false));
            }
            return(GetStringPrice(price, currencyRate, cur.Symbol, 0, qty, cur.IsCodeBefore, cur.PriceFormat, null, false));
        }
Ejemplo n.º 3
0
    private void UpdateCurrency()
    {
        var cur = CurrencyService.Currency(ddlCurrs.SelectedValue);

        CurrencyValue            = cur.Value;
        CurrencyCode             = cur.Iso3;
        CurrencySymbol           = cur.Symbol;
        CurrencyNumCode          = cur.NumIso3;
        IsCodeBefore             = cur.IsCodeBefore;
        Currency                 = cur;
        OldCurrencyValue         = !string.IsNullOrEmpty(hfOldCurrencyValue.Value) ? Convert.ToDecimal(hfOldCurrencyValue.Value) : CurrencyValue;
        hfOldCurrencyValue.Value = cur.Value.ToString();
    }
Ejemplo n.º 4
0
 public void SetCurrency(string currencyCode, float currencyValue, int currencyNumCode, string currencySymbol, bool isCodeBefore)
 {
     ddlCurrs.DataBind();
     ddlCurrs.SelectedValue   = currencyCode;
     lcurrency.Text           = ddlCurrs.SelectedItem.Text;
     hfOldCurrencyValue.Value = currencyValue.ToString();
     OldCurrencyValue         = currencyValue;
     CurrencyCode             = currencyCode;
     CurrencyNumCode          = currencyNumCode;
     CurrencySymbol           = currencySymbol;
     Currency      = CurrencyService.Currency(currencyCode);
     CurrencyValue = currencyValue;
     IsCodeBefore  = isCodeBefore;
 }
Ejemplo n.º 5
0
 protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteCurrency")
     {
         var currency = CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3);
         if (currency.CurrencyID != SQLDataHelper.GetInt(e.CommandArgument))
         {
             CurrencyService.DeleteCurrency(SQLDataHelper.GetInt(e.CommandArgument));
             CurrencyService.RefreshCurrency();
         }
     }
     if (e.CommandName == "AddCurrency")
     {
         GridViewRow footer = grid.FooterRow;
         float       temp;
         float.TryParse(((TextBox)footer.FindControl("txtNewCurrencyValue")).Text, out temp);
         if (
             temp == 0 || string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewName")).Text) ||
             string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewCode")).Text) ||
             string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewCurrencyISO3")).Text) ||
             string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewPriceFormat")).Text)
             )
         {
             grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ffcccc");
             return;
         }
         var cur = new Currency
         {
             Name         = ((TextBox)footer.FindControl("txtNewName")).Text,
             Symbol       = ((TextBox)footer.FindControl("txtNewCode")).Text,
             Value        = temp,
             Iso3         = ((TextBox)footer.FindControl("txtNewCurrencyISO3")).Text,
             IsCodeBefore = ((CheckBox)footer.FindControl("checkNewIsCodeBefore")).Checked,
             PriceFormat  = ((TextBox)footer.FindControl("txtNewPriceFormat")).Text
         };
         CurrencyService.InsertCurrency(cur);
         CurrencyService.RefreshCurrency();
         grid.ShowFooter = false;
     }
     if (e.CommandName == "CancelAdd")
     {
         grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ccffcc");
         grid.ShowFooter            = false;
     }
 }
Ejemplo n.º 6
0
        private void UpdateCurrency()
        {
            var cur = CurrencyService.Currency(ddlCurrs.SelectedValue);

            if (cur == null)
            {
                return;
            }

            CurrencyValue            = cur.Value;
            CurrencyCode             = cur.Iso3;
            CurrencySymbol           = cur.Symbol;
            CurrencyNumCode          = cur.NumIso3;
            IsCodeBefore             = cur.IsCodeBefore;
            Currency                 = cur;
            OldCurrencyValue         = !string.IsNullOrEmpty(hfOldCurrencyValue.Value) ? SQLDataHelper.GetFloat(hfOldCurrencyValue.Value) : CurrencyValue;
            hfOldCurrencyValue.Value = cur.Value.ToString();
        }
Ejemplo n.º 7
0
        public static void InitBaseSessionSettings()
        {
            HttpContext.Current.Session.Add("IsAdmin", false);

            //Desing

            if (CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3) == null)
            {
                CurrencyService.RefreshCurrency();
            }

            CurrencyService.CurrentCurrency = CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3) ?? CurrencyService.GetAllCurrencies().First();

            // Internal Settings

            HttpContext.Current.Session.Add("isDebug", false);
            HttpContext.Current.Session.Add("isAuthorize", false);
            HttpContext.Current.Session.Add("errOnAsax", false);
            HttpContext.Current.Session.Add("errMessage", "");
        }
Ejemplo n.º 8
0
        public static void InitBaseSessionSettings()
        {
            //Setting null values for the global variables (decalring)

            HttpContext.Current.Session.Add("IsAdmin", false);

            //Desing

            if (CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3) == null)
            {
                CurrencyService.RefreshCurrency();
            }

            CurrencyService.CurrentCurrency = CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3);

            // Internal Settings

            HttpContext.Current.Session.Add("isDebug", false);
            HttpContext.Current.Session.Add("isAuthorize", false);
            HttpContext.Current.Session.Add("errOnAsax", false);
            HttpContext.Current.Session.Add("errMessage", "");
        }
Ejemplo n.º 9
0
        public bool SaveData()
        {
            if (!ValidateData())
            {
                return(false);
            }

            var iso3 = SettingsCatalog.DefaultCurrencyIso3;

            SettingsCatalog.DefaultCurrencyIso3 = ddlDefaultCurrency.SelectedValue;

            if (SettingsCatalog.DefaultCurrencyIso3 != iso3)
            {
                CurrencyService.CurrentCurrency = CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3);
            }

            SettingsCatalog.AllowToChangeCurrency = cbAllowToChangeCurrency.Checked;

            SettingsCatalog.ProductsPerPage               = SQLDataHelper.GetInt(txtProdPerPage.Text);
            SettingsCatalog.EnableProductRating           = cbEnableProductRating.Checked;
            SettingsCatalog.EnablePhotoPreviews           = cbEnablePhotoPreviews.Checked;
            SettingsCatalog.EnableCompareProducts         = cbEnableCompareProducts.Checked;
            SettingsCatalog.EnabledCatalogViewChange      = cbEnableCatalogViewChange.Checked;
            SettingsCatalog.EnabledSearchViewChange       = cbEnableSearchViewChange.Checked;
            SettingsCatalog.DefaultCatalogView            = (SettingsCatalog.ProductViewMode)SQLDataHelper.GetInt(ddlCatalogView.SelectedValue);
            SettingsCatalog.DefaultSearchView             = (SettingsCatalog.ProductViewMode)SQLDataHelper.GetInt(ddlSearchView.SelectedValue);
            SettingsCatalog.DisplayCategoriesInBottomMenu = ckbShowCategoriesInBottomMenu.Checked;

            SettingsCatalog.ExluderingFilters = cbExluderingFilters.Checked;

            SettingsCatalog.ShowPriceFilter    = chkShowPriceFilter.Checked;
            SettingsCatalog.ShowProducerFilter = chkShowProducerFilter.Checked;
            SettingsCatalog.ShowSizeFilter     = chkShowSizeFilter.Checked;
            SettingsCatalog.ShowColorFilter    = chkShowColorFilter.Checked;
            SettingsCatalog.ComplexFilter      = cbComplexFilter.Checked;

            SettingsCatalog.SizesHeader  = txtSizesHeader.Text;
            SettingsCatalog.ColorsHeader = txtColorsHeader.Text;

            SettingsPictureSize.ColorIconWidthCatalog  = txtColorPictureWidthCatalog.Text.TryParseInt();
            SettingsPictureSize.ColorIconHeightCatalog = txtColorPictureHeightCatalog.Text.TryParseInt();
            SettingsPictureSize.ColorIconWidthDetails  = txtColorPictureWidthDetails.Text.TryParseInt();
            SettingsPictureSize.ColorIconHeightDetails = txtColorPictureHeightDetails.Text.TryParseInt();

            SettingsCatalog.RelatedProductName     = txtBlockOne.Text;
            SettingsCatalog.AlternativeProductName = txtBlockTwo.Text;

            SettingsCatalog.BuyButtonText      = txtBuyButtonText.Text;
            SettingsCatalog.MoreButtonText     = txtMoreButtonText.Text;
            SettingsCatalog.PreOrderButtonText = txtPreOrderButtonText.Text;

            SettingsCatalog.DisplayBuyButton      = cbDisplayBuyButton.Checked;
            SettingsCatalog.DisplayMoreButton     = cbDisplayMoreButton.Checked;
            SettingsCatalog.DisplayPreOrderButton = cbDisplayPreOrderButton.Checked;

            SettingsCatalog.AvaliableFilterEnabled  = cbAvaliableFilterEnabled.Checked;
            SettingsCatalog.AvaliableFilterSelected = cbAvaliableFilterSelected.Checked;
            SettingsCatalog.PreorderFilterEnabled   = cbPreorderFilterEnabled.Checked;
            SettingsCatalog.PreorderFilterSelected  = cbPreorderFilterSelected.Checked;


            SettingsCatalog.ShowProductsCount = cbShowProductsCount.Checked;

            LoadData();
            return(true);
        }
Ejemplo n.º 10
0
        private void GenerateWorksheetSheet1(WorksheetCollection sheets, Order order)
        {
            Culture.InitializeCulture();
            Worksheet sheet = sheets.Add(Resource.Admin_ViewOrder_ItemNum + order.OrderID);

            sheet.Table.DefaultRowHeight    = 15F;
            sheet.Table.ExpandedColumnCount = 5;
            List <TaxValue> taxedItems = TaxServices.GetOrderTaxes(order.OrderID);

            sheet.Table.ExpandedRowCount = 40 + order.OrderItems.Count * 2 + taxedItems.Count;
            sheet.Table.FullColumns      = 1;
            sheet.Table.FullRows         = 1;
            WorksheetColumn column0 = sheet.Table.Columns.Add();

            //column0.Width = 186; Commented By Evgeni to enlarge column width
            column0.Width = 250;
            column0.Span  = 1;
            WorksheetColumn column1 = sheet.Table.Columns.Add();

            column1.Index = 3;
            column1.Width = 156;
            sheet.Table.Columns.Add(120);
            sheet.Table.Columns.Add(89);
            // Order ID-----------------------------------------------
            WorksheetRow Row0 = sheet.Table.Rows.Add();

            Row0.Height = 22;
            WorksheetCell cell;

            cell             = Row0.Cells.Add();
            cell.StyleID     = "s132";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = Resource.Admin_ViewOrder_ItemNum + order.OrderID;
            cell.MergeAcross = 4;
            // Status -----------------------------------------------
            WorksheetRow Row1 = sheet.Table.Rows.Add();

            cell             = Row1.Cells.Add();
            cell.StyleID     = "s133";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = "(" + order.OrderStatus.StatusName + ")";
            cell.MergeAcross = 4;
            //  -----------------------------------------------
            WorksheetRow Row2 = sheet.Table.Rows.Add();

            cell             = Row2.Cells.Add();
            cell.StyleID     = "s134";
            cell.MergeAcross = 4;
            // Date -----------------------------------------------
            WorksheetRow Row3 = sheet.Table.Rows.Add();

            cell             = Row3.Cells.Add();
            cell.StyleID     = "s135";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = Resource.Admin_ViewOrder_Date;
            cell             = Row3.Cells.Add();
            cell.StyleID     = "s70";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = Culture.ConvertDate(order.OrderDate);
            cell.MergeAcross = 3;
            // NUmber to status check -----------------------------------------------
            WorksheetRow Row4 = sheet.Table.Rows.Add();

            cell             = Row4.Cells.Add();
            cell.StyleID     = "s135";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = Resource.Admin_ViewOrder_Number;
            cell             = Row4.Cells.Add();
            cell.StyleID     = "s70";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = order.Number;
            cell.MergeAcross = 3;
            // Status comment -----------------------------------------------
            WorksheetRow Row5 = sheet.Table.Rows.Add();

            cell             = Row5.Cells.Add();
            cell.StyleID     = "s135";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = Resource.Admin_ViewOrder_StatusComment;
            cell             = Row5.Cells.Add();
            cell.StyleID     = "s70";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = order.StatusComment;
            cell.MergeAcross = 3;
            // -----------------------------------------------
            WorksheetRow Row6 = sheet.Table.Rows.Add();

            cell             = Row6.Cells.Add();
            cell.StyleID     = "s136";
            cell.MergeAcross = 4;
            // Headers -----------------------------------------------
            WorksheetRow Row7 = sheet.Table.Rows.Add();

            Row7.Cells.Add(Resource.Admin_ViewOrder_Billing, DataType.String, "s70");
            Row7.Cells.Add(Resource.Admin_ViewOrder_Shipping, DataType.String, "s70");
            Row7.Cells.Add(Resource.Admin_ViewOrder_ShippingMethod, DataType.String, "s70");
            // Names -----------------------------------------------
            WorksheetRow Row8 = sheet.Table.Rows.Add();

            Row8.Cells.Add("     " + Resource.Admin_ViewOrder_Name + order.BillingContact.Name, DataType.String, "s70");

            Row8.Cells.Add("     " + Resource.Admin_ViewOrder_Name + order.ShippingContact.Name, DataType.String, "s70");
            var shippingMethodName = order.ArchivedShippingName;

            if (order.OrderPickPoint != null)
            {
                shippingMethodName += order.OrderPickPoint.PickPointAddress.Replace("<br/>", " ");
            }

            Row8.Cells.Add("     " + shippingMethodName, DataType.String, "s70");
            // Countries -----------------------------------------------
            WorksheetRow Row9 = sheet.Table.Rows.Add();

            Row9.Cells.Add("     " + Resource.Admin_ViewOrder_Country + order.BillingContact.Country, DataType.String,
                           "s70");
            Row9.Cells.Add("     " + Resource.Admin_ViewOrder_Country + order.ShippingContact.Country, DataType.String,
                           "s70");
            Row9.Cells.Add(Resource.Admin_ViewOrder_PaymentType, DataType.String, "s70");
            // Cities -----------------------------------------------
            WorksheetRow Row10 = sheet.Table.Rows.Add();

            Row10.Cells.Add("     " + Resource.Admin_ViewOrder_City + order.BillingContact.City, DataType.String, "s70");
            Row10.Cells.Add("     " + Resource.Admin_ViewOrder_City + order.ShippingContact.City, DataType.String, "s70");
            Row10.Cells.Add("     " + order.PaymentMethodName, DataType.String, "s70");
            // Zones -----------------------------------------------
            WorksheetRow Row11 = sheet.Table.Rows.Add();

            Row11.Cells.Add("     " + Resource.Admin_ViewOrder_Zone + order.BillingContact.Zone, DataType.String, "s70");
            Row11.Cells.Add("     " + Resource.Admin_ViewOrder_Zone + order.ShippingContact.Zone, DataType.String, "s70");
            cell         = Row11.Cells.Add();
            cell.StyleID = "s70";
            // Zips -----------------------------------------------
            WorksheetRow Row12 = sheet.Table.Rows.Add();

            Row12.Cells.Add("     " + Resource.Admin_ViewOrder_Zip + order.BillingContact.Zip, DataType.String, "s70");
            Row12.Cells.Add("     " + Resource.Admin_ViewOrder_Zip + order.ShippingContact.Zip, DataType.String, "s70");
            cell         = Row12.Cells.Add();
            cell.StyleID = "s70";
            // Adresses -----------------------------------------------
            WorksheetRow Row13 = sheet.Table.Rows.Add();

            Row13.Cells.Add("     " + Resource.Admin_ViewOrder_Address + order.BillingContact.Address, DataType.String,
                            "s70");
            Row13.Cells.Add("     " + Resource.Admin_ViewOrder_Address + order.ShippingContact.Address, DataType.String,
                            "s70");
            cell         = Row13.Cells.Add();
            cell.StyleID = "s70";

            // Added by Evgeni
            //Tel
            WorksheetRow Row14 = sheet.Table.Rows.Add();

            Row14.Cells.Add("     " + Resource.Client_OrderConfirmation_MobilePhone + " :" + order.OrderCustomer.MobilePhone, DataType.String,
                            "s70");
            Row14.Cells.Add("     " + Resource.Client_OrderConfirmation_MobilePhone + " :" + order.OrderCustomer.MobilePhone, DataType.String,
                            "s70");
            cell         = Row14.Cells.Add();
            cell.StyleID = "s70";

            //
            // -----------------------------------------------
            WorksheetRow Row17 = sheet.Table.Rows.Add();

            cell             = Row17.Cells.Add();
            cell.StyleID     = "s134";
            cell.MergeAcross = 4;
            // Orders -----------------------------------------------
            WorksheetRow Row18 = sheet.Table.Rows.Add();

            cell             = Row18.Cells.Add();
            cell.StyleID     = "s136";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = Resource.Admin_ViewOrder_OrderItem;
            cell.MergeAcross = 4;
            // -----------------------------------------------
            WorksheetRow Row19 = sheet.Table.Rows.Add();

            Row19.Height     = 15;
            cell             = Row19.Cells.Add();
            cell.StyleID     = "s137";
            cell.MergeAcross = 4;
            // Order items table header -----------------------------------------------
            WorksheetRow Row20 = sheet.Table.Rows.Add();

            Row20.Height = 16;
            Row20.Cells.Add(Resource.Admin_ViewOrder_ItemName, DataType.String, "s89");
            Row20.Cells.Add(Resource.Admin_ViewOrder_CustomOptions, DataType.String, "s90");
            Row20.Cells.Add(Resource.Admin_ViewOrder_Price, DataType.String, "s90");
            Row20.Cells.Add(Resource.Admin_ViewOrder_ItemAmount, DataType.String, "s90");
            Row20.Cells.Add(Resource.Admin_ViewOrder_ItemCost, DataType.String, "s91");
            // Order items -----------------------------------------------
            foreach (OrderItem item in order.OrderItems)
            {
                WorksheetRow Row = sheet.Table.Rows.Add();
                cell           = Row.Cells.Add();
                cell.StyleID   = "m51494176";
                cell.Data.Type = DataType.String;
                //Changed by Evgeni to isert ArtNo in order print
                cell.Data.Text = item.Name + " [" + item.ArtNo + "]";
                //
                cell.MergeDown = 1;
                cell           = Row.Cells.Add();
                cell.StyleID   = "m51494196";
                var html = new StringBuilder();
                foreach (EvaluatedCustomOptions ev in item.SelectedOptions)
                {
                    html.Append(string.Format("- {0}: {1} \n", ev.CustomOptionTitle, ev.OptionTitle));
                }

                //Changed by Evgeni to isert ArtNo in order print
                cell.Data.Text = " " + item.ArtNo + " " + html.ToString();
                //
                cell.MergeDown = 1;
                cell           = Row.Cells.Add();
                cell.StyleID   = "m51494216";
                cell.Data.Type = DataType.String;

                bool     ciscodebefore;
                string   cpriceformat = null;
                string   csign        = null;
                Currency cur          = CurrencyService.Currency(order.OrderCurrency.CurrencyCode);
                ciscodebefore = cur.IsCodeBefore;
                cpriceformat  = cur.PriceFormat;
                csign         = cur.Symbol;

                cell.Data.Text = CatalogService.GetStringPrice(item.Price, order.OrderCurrency.CurrencyValue,
                                                               order.OrderCurrency.CurrencyCode);
                cell.MergeDown = 1;
                cell           = Row.Cells.Add();
                cell.StyleID   = "m51494236";
                cell.Data.Type = DataType.Number;
                cell.Data.Text = item.Amount.ToString();
                cell.MergeDown = 1;
                cell           = Row.Cells.Add();
                cell.StyleID   = "m51494256";
                cell.Data.Type = DataType.String;

                cell.Data.Text = CatalogService.GetStringPrice(item.Price * item.Amount,
                                                               order.OrderCurrency.CurrencyValue,
                                                               order.OrderCurrency.CurrencyCode);
                cell.MergeDown = 1;
                // -----------------------------------------------
                WorksheetRow RowSep = sheet.Table.Rows.Add();
                RowSep.Height = 15;
            }
            // -----------------------------------------------
            WorksheetRow Row27 = sheet.Table.Rows.Add();

            Row27.Height   = 15;
            cell           = Row27.Cells.Add();
            cell.StyleID   = "s70";
            cell           = Row27.Cells.Add();
            cell.StyleID   = "s70";
            cell.Data.Type = DataType.String;
            cell.Data.Text = Resource.Admin_ViewOrder_ItemCost2;
            cell.Index     = 4;
            decimal orderPrice = ((order.Sum - order.ShippingCost) * 100) / (100 - order.OrderDiscount);

            Row27.Cells.Add(
                CatalogService.GetStringPrice(order.Sum, order.OrderCurrency.CurrencyValue,
                                              order.OrderCurrency.CurrencyCode), DataType.String, "s70");
            // -----------------------------------------------
            WorksheetRow Row28 = sheet.Table.Rows.Add();

            cell           = Row28.Cells.Add();
            cell.StyleID   = "s70";
            cell           = Row28.Cells.Add();
            cell.StyleID   = "s70";
            cell.Data.Type = DataType.String;
            cell.Data.Text = Resource.Admin_ViewOrder_ItemDiscount;
            cell.Index     = 4;


            decimal discount = orderPrice * (order.OrderDiscount / 100);

            Row28.Cells.Add(
                "-" +
                CatalogService.GetStringPrice(discount, order.OrderCurrency.CurrencyValue,
                                              order.OrderCurrency.CurrencyCode), DataType.String, "s70");
            // -----------------------------------------------
            WorksheetRow Row29 = sheet.Table.Rows.Add();

            cell           = Row29.Cells.Add();
            cell.StyleID   = "s70";
            cell           = Row29.Cells.Add();
            cell.StyleID   = "s70";
            cell.Data.Type = DataType.String;
            cell.Data.Text = Resource.Admin_ViewOrder_ShippingPrice;
            cell.Index     = 4;

            Row29.Cells.Add(
                "+" +
                CatalogService.GetStringPrice(order.ShippingCost, order.OrderCurrency.CurrencyValue,
                                              order.OrderCurrency.CurrencyCode), DataType.String, "s70");
            // -----------------------------------------------

            if (taxedItems.Count > 0)
            {
                foreach (TaxValue tax in taxedItems)
                {
                    WorksheetRow Row = sheet.Table.Rows.Add();
                    cell           = Row.Cells.Add();
                    cell.StyleID   = "s70";
                    cell           = Row.Cells.Add();
                    cell.StyleID   = "s70";
                    cell.Data.Type = DataType.String;
                    cell.Data.Text = (tax.TaxShowInPrice ? Resource.Core_TaxServices_Include_Tax + " " : "") +
                                     tax.TaxName + ":";
                    cell.Index = 4;
                    Row.Cells.Add(
                        (tax.TaxShowInPrice ? "" : "+") +
                        CatalogService.GetStringPrice(tax.TaxSum, order.OrderCurrency.CurrencyValue,
                                                      order.OrderCurrency.CurrencyCode), DataType.String, "s70");
                }
            }
            else
            {
                WorksheetRow Row30a = sheet.Table.Rows.Add();
                cell           = Row30a.Cells.Add();
                cell.StyleID   = "s70";
                cell           = Row30a.Cells.Add();
                cell.StyleID   = "s70";
                cell.Data.Type = DataType.String;
                cell.Data.Text = Resource.Admin_ViewOrder_Taxes;
                cell.Index     = 4;

                Row30a.Cells.Add(
                    "+" +
                    CatalogService.GetStringPrice(0, order.OrderCurrency.CurrencyValue, order.OrderCurrency.CurrencyCode),
                    DataType.String, "s70");
            }
            // -----------------------------------------------
            WorksheetRow Row30 = sheet.Table.Rows.Add();

            cell           = Row30.Cells.Add();
            cell.StyleID   = "s70";
            cell           = Row30.Cells.Add();
            cell.StyleID   = "s135";
            cell.Data.Type = DataType.String;
            cell.Data.Text = Resource.Admin_ViewOrder_TotalPrice;
            cell.Index     = 4;

            cell =
                Row30.Cells.Add(
                    CatalogService.GetStringPrice(order.Sum, order.OrderCurrency.CurrencyValue,
                                                  order.OrderCurrency.CurrencyCode), DataType.String, "s135");

            // -----------------------------------------------
            WorksheetRow Row31 = sheet.Table.Rows.Add();

            cell             = Row31.Cells.Add();
            cell.StyleID     = "s135";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = Resource.Client_PrintOrder_YourComment;
            cell.MergeAcross = 4;
            // -----------------------------------------------
            WorksheetRow Row32 = sheet.Table.Rows.Add();

            cell             = Row32.Cells.Add();
            cell.StyleID     = "s141";
            cell.Data.Type   = DataType.String;
            cell.Data.Text   = order.CustomerComment;
            cell.MergeAcross = 4;
            cell.MergeDown   = 1;
            // -----------------------------------------------
            //  Options
            // -----------------------------------------------
            sheet.Options.Selected                     = true;
            sheet.Options.ProtectObjects               = false;
            sheet.Options.ProtectScenarios             = false;
            sheet.Options.PageSetup.Header.Margin      = 0.3F;
            sheet.Options.PageSetup.Footer.Margin      = 0.3F;
            sheet.Options.PageSetup.PageMargins.Bottom = 0.75F;
            sheet.Options.PageSetup.PageMargins.Left   = 0.7F;
            sheet.Options.PageSetup.PageMargins.Right  = 0.7F;
            sheet.Options.PageSetup.PageMargins.Top    = 0.75F;
            sheet.Options.Print.PaperSizeIndex         = 9;
            sheet.Options.Print.VerticalResolution     = 0;
            sheet.Options.Print.ValidPrinterInfo       = true;
        }
Ejemplo n.º 11
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);
        }