示例#1
0
        private void ShowMiniCart()
        {
            _controller = new BBStoreController();

            CartInfo myCart = _controller.GetCart(PortalSettings.PortalId, CartId);

            if (myCart != null)
            {
                List <CartProductInfo> myProducts = _controller.GetCartProducts(CartId);

                ModuleController objModules = new ModuleController();
                ModuleInfo       cartModule = objModules.GetModuleByDefinition(PortalSettings.PortalId, "BBStore Cart");

                Hashtable storeSettings = _controller.GetStoreSettings(PortalSettings.PortalId);

                string template = _itemTemplate;

                if (!String.IsNullOrEmpty((string)storeSettings["MiniCartTemplate"]))
                {
                    template = (string)storeSettings["MiniCartTemplate"];
                }

                bool hideIfEmpty = Convert.ToBoolean(storeSettings["HideMiniCartIfEmpty"] ?? "false");

                bool    showNetPrice = (storeSettings["ShowNetpriceInCart"].ToString() == "0");
                decimal total        = myCart.OrderTotal + myCart.AdditionalTotal;

                if (showNetPrice == false)
                {
                    total += myCart.OrderTax + myCart.AdditionalTax;
                }

                decimal productCount = 0;
                foreach (CartProductInfo cp in myProducts)
                {
                    productCount += cp.Quantity;
                }

                if (hideIfEmpty && total <= 0)
                {
                    template = "";
                }
                else
                {
                    template = template.Replace("[PRODUCTS]", productCount.ToString("f0"));
                    template = template.Replace("[TOTAL]", total.ToString("f2"));
                    template = template.Replace("[CURRENCY]", myCart.Currency);
                    template = template.Replace("[CARTLINK]", (cartModule == null ? "" : Globals.NavigateURL(cartModule.TabID)));
                    template = template.Replace("[CHECKOUTLINK]", (cartModule == null ? "" : Globals.NavigateURL(cartModule.TabID, "", "action=checkout")));
                }
                ltrMiniCart.Text = template;
            }
        }
示例#2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                Controller = new BBStoreController();

                Hashtable storeSettings = Controller.GetStoreSettings(PortalId);
                if (storeSettings != null)
                {
                    _imageDir = (string)(storeSettings["ProductGroupImageDir"] ?? "");
                    _iconDir  = (string)(storeSettings["ProductGroupIconDir"] ?? "");
                }

                if (Request["adminmode"] != null)
                {
                    pnlBack.Visible = false;
                }

                ctlFeatureLists.AddButtonClick       += ctlFeatureLists_AddButtonClick;
                ctlFeatureLists.AddAllButtonClick    += ctlFeatureLists_AddAllButtonClick;
                ctlFeatureLists.RemoveButtonClick    += ctlFeatureLists_RemoveButtonClick;
                ctlFeatureLists.RemoveAllButtonClick += ctlFeatureLists_RemoveAllButtonClick;

                if (!IsPostBack)
                {
                    // styling treeview
                    treeProductGroup.SelectedNodeStyle.BackColor = System.Drawing.Color.Red;
                    treeProductGroup.SelectedNodeStyle.ForeColor = System.Drawing.Color.White;

                    if (Request["productgroup"] != null)
                    {
                        ProductGroupId = Convert.ToInt32(Request["productgroup"]);
                    }

                    // Treeview Basenode
                    TreeNode newNode = new TreeNode(Localization.GetString("treeProductGroups.Text", this.LocalResourceFile), "_-1");
                    newNode.SelectAction     = TreeNodeSelectAction.Select;
                    newNode.PopulateOnDemand = true;
                    newNode.ImageUrl         = @"~\images\category.gif";
                    newNode.ShowCheckBox     = false;
                    treeProductGroup.Nodes.Add(newNode);

                    cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteConfirm.Text", this.LocalResourceFile) + "');");
                }
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
示例#3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                CartInfo myCart = Controller.GetCart(PortalSettings.PortalId, CartId);
                if (myCart != null)
                {
                    List <CartProductInfo> myProducts = _controller.GetCartProducts(CartId);

                    TemplateControl tp = LoadControl("controls/TemplateControl.ascx") as TemplateControl;
                    tp.Key = "MiniCart";
                    string template = tp.GetTemplate((string)Settings["Template"]);

                    ModuleController objModules = new ModuleController();
                    ModuleInfo       cartModule = objModules.GetModuleByDefinition(PortalSettings.PortalId, "BBStore Cart");

                    Hashtable storeSettings = _controller.GetStoreSettings(PortalSettings.PortalId);
                    bool      showNetPrice  = (storeSettings["ShowNetpriceInCart"].ToString() == "0");
                    decimal   total         = myCart.OrderTotal + myCart.AdditionalTotal;

                    if (showNetPrice == false)
                    {
                        total += myCart.OrderTax + myCart.AdditionalTax;
                    }

                    decimal productCount = 0;
                    foreach (CartProductInfo cp in myProducts)
                    {
                        productCount += cp.Quantity;
                    }
                    template = template.Replace("[PRODUCTS]", productCount.ToString("f0"));
                    template = template.Replace("[TOTAL]", total.ToString("f2"));
                    template = template.Replace("[CURRENCY]", myCart.Currency);
                    template = template.Replace("[CARTLINK]", (cartModule == null ? "" : Globals.NavigateURL(cartModule.TabID)));
                    template = template.Replace("[CHECKOUTLINK]", (cartModule == null ? "" : Globals.NavigateURL(cartModule.TabID, "", "action=checkout")));

                    ltrMiniCart.Text = template;
                }
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        protected void FillCountry()
        {
            ddlCountry.Items.Add(new ListItem("Andorra", "AD"));
            ddlCountry.Items.Add(new ListItem("Albania", "AL"));
            ddlCountry.Items.Add(new ListItem("Austria", "AT"));
            ddlCountry.Items.Add(new ListItem("Bosnia and Herzegovina", "BA"));
            ddlCountry.Items.Add(new ListItem("Belgium", "BE"));
            ddlCountry.Items.Add(new ListItem("Bulgaria", "BG"));
            ddlCountry.Items.Add(new ListItem("Switzerland", "CH"));
            ddlCountry.Items.Add(new ListItem("Cyprus", "CY"));
            ddlCountry.Items.Add(new ListItem("Czech Republic", "CZ"));
            ddlCountry.Items.Add(new ListItem("Germany", "DE"));
            ddlCountry.Items.Add(new ListItem("Denmark", "DK"));
            ddlCountry.Items.Add(new ListItem("Estonia", "EE"));
            ddlCountry.Items.Add(new ListItem("Spain", "ES"));
            ddlCountry.Items.Add(new ListItem("Finland", "FI"));
            ddlCountry.Items.Add(new ListItem("Faroe Islands", "FO"));
            ddlCountry.Items.Add(new ListItem("France", "FR"));
            ddlCountry.Items.Add(new ListItem("United Kingdom", "GB"));
            ddlCountry.Items.Add(new ListItem("Georgia", "GE"));
            ddlCountry.Items.Add(new ListItem("Gibraltar", "GI"));
            ddlCountry.Items.Add(new ListItem("Greenland", "GL"));
            ddlCountry.Items.Add(new ListItem("Greece", "GR"));
            ddlCountry.Items.Add(new ListItem("Croatia", "HR"));
            ddlCountry.Items.Add(new ListItem("Hungary", "HU"));
            ddlCountry.Items.Add(new ListItem("Ireland", "IE"));
            ddlCountry.Items.Add(new ListItem("Israel", "IL"));
            ddlCountry.Items.Add(new ListItem("Iceland", "IS"));
            ddlCountry.Items.Add(new ListItem("Italy", "IT"));
            ddlCountry.Items.Add(new ListItem("Kuwait", "KW"));
            ddlCountry.Items.Add(new ListItem("Kazakhstan", "KZ"));
            ddlCountry.Items.Add(new ListItem("Lebanon", "LB"));
            ddlCountry.Items.Add(new ListItem("Liechtenstein", "LI"));
            ddlCountry.Items.Add(new ListItem("Lithuania", "LT"));
            ddlCountry.Items.Add(new ListItem("Luxembourg", "LU"));
            ddlCountry.Items.Add(new ListItem("Latvia", "LV"));
            ddlCountry.Items.Add(new ListItem("Monaco", "MC"));
            ddlCountry.Items.Add(new ListItem("Montenegro", "ME"));
            ddlCountry.Items.Add(new ListItem("Macedonia, Former Yugoslav Republic of", "MK"));
            ddlCountry.Items.Add(new ListItem("Mauritania", "MR"));
            ddlCountry.Items.Add(new ListItem("Malta", "MT"));
            ddlCountry.Items.Add(new ListItem("Mauritius", "MU"));
            ddlCountry.Items.Add(new ListItem("Netherlands", "NL"));
            ddlCountry.Items.Add(new ListItem("Norway", "NO"));
            ddlCountry.Items.Add(new ListItem("Poland", "PL"));
            ddlCountry.Items.Add(new ListItem("Portugal", "PT"));
            ddlCountry.Items.Add(new ListItem("Romania", "RO"));
            ddlCountry.Items.Add(new ListItem("Serbia", "RS"));
            ddlCountry.Items.Add(new ListItem("Saudi Arabia", "SA"));
            ddlCountry.Items.Add(new ListItem("Sweden", "SE"));
            ddlCountry.Items.Add(new ListItem("Slovenia", "SI"));
            ddlCountry.Items.Add(new ListItem("Slovak Republic", "SK"));
            ddlCountry.Items.Add(new ListItem("San Marino", "SM"));
            ddlCountry.Items.Add(new ListItem("Tunisia", "TN"));
            ddlCountry.Items.Add(new ListItem("Turkey", "TR"));

            BBStoreController controller = new BBStoreController();

            Hashtable storeSettings = controller.GetStoreSettings(PortalId);
            string    countryCode   = (string)storeSettings["VendorCountry"];

            try
            {
                ddlCountry.SelectedValue = countryCode;
            }
            catch (Exception)
            {
            }
        }
示例#5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                Controller = new BBStoreController();

                taxUnitCost.PercentControl         = txtTaxPercent;
                taxOriginalUnitCost.PercentControl = txtTaxPercent;

                taxPriceUnitCost.PercentControl         = txtPriceTaxPercent;
                taxPriceOriginalUnitCost.PercentControl = txtPriceTaxPercent;

                LocaleController            lc  = new LocaleController();
                Dictionary <string, Locale> loc = lc.GetLocales(PortalId);

                //TODO: Panels ausblenden wenn kein Modul verwendet

                ModuleController objModules = new ModuleController();
                if (objModules.GetModuleByDefinition(PortalId, "BBStore Product Groups") == null)
                {
                    HasProductGroupModule = false;
                }

                if (objModules.GetModuleByDefinition(PortalId, "BBStore Product Features") == null)
                {
                    HasProductFeatureModule = false;
                }

                Hashtable storeSettings = Controller.GetStoreSettings(PortalId);
                if (storeSettings != null)
                {
                    _imageDir = (string)(storeSettings["ProductImageDir"] ?? "");
                }

                // If this is the first visit to the page
                if (Page.IsPostBack == false)
                {
                    // Show Supplier ?
                    if (storeSettings != null && storeSettings["SupplierRole"] != null && (string)storeSettings["SupplierRole"] != "-1")
                    {
                        pnlSupplier.Visible = true;
                        RoleController roleController = new RoleController();
                        //RoleInfo role = roleController.GetRole(Convert.ToInt32(storeSettings["SupplierRole"]), PortalId);
                        ArrayList          aUsers = roleController.GetUsersByRoleName(PortalId, (string)storeSettings["SupplierRole"]);
                        ListItemCollection users  = new ListItemCollection();
                        foreach (UserInfo user in aUsers)
                        {
                            users.Add(new ListItem(user.DisplayName, user.UserID.ToString()));
                        }
                        string selText = Localization.GetString("SelectSupplier.Text", this.LocalResourceFile);
                        users.Insert(0, new ListItem(selText, "-1"));
                        cboSupplier.DataSource     = users;
                        cboSupplier.DataValueField = "Value";
                        cboSupplier.DataTextField  = "Text";
                        cboSupplier.DataBind();
                    }

                    // Shipping Models
                    List <ShippingModelInfo> shippingModels = Controller.GetShippingModels(PortalId);

                    cboShippingModel.DataSource     = shippingModels;
                    cboShippingModel.DataValueField = "ShippingModelId";
                    cboShippingModel.DataTextField  = "Name";
                    cboShippingModel.DataBind();

                    string selUnitText = Localization.GetString("SelectUnit.Text", this.LocalResourceFile);
                    ddlUnit.Items.Add(new ListItem(selUnitText, "-1"));
                    foreach (UnitInfo unit in Controller.GetUnits(PortalId, CurrentLanguage, "Unit"))
                    {
                        ddlUnit.Items.Add(new ListItem(unit.Unit, unit.UnitId.ToString()));
                    }
                    ddlUnit.DataValueField = "Value";
                    ddlUnit.DataTextField  = "Text";
                    ddlUnit.DataBind();


                    // Set ProductGroups Visible / not Visible
                    //pnlProductGroup.Visible = HasProductGroupModule;

                    SimpleProductInfo SimpleProduct = null;

                    if (Request["productid"] != null)
                    {
                        ProductId = Convert.ToInt32(Request["productid"]);
                    }

                    // if product exists
                    if (ProductId > 0)
                    {
                        SimpleProduct = Controller.GetSimpleProductByProductId(PortalId, ProductId);
                    }

                    List <ILanguageEditorInfo> dbLangs = new List <ILanguageEditorInfo>();

                    if (SimpleProduct == null)
                    {
                        taxUnitCost.Value         = 0.00m;
                        taxUnitCost.Mode          = "gross";
                        txtTaxPercent.Text        = 0.0m.ToString();
                        taxOriginalUnitCost.Value = 0.00m;
                        taxOriginalUnitCost.Mode  = "gross";
                        ImageSelector.Url         = _imageDir + "This_fileName-Should_not_3xist";
                        cboSupplier.SelectedValue = "-1";
                        dbLangs.Add(new SimpleProductLangInfo()
                        {
                            Language = CurrentLanguage
                        });
                        lngSimpleProducts.Langs = dbLangs;
                        txtWeight.Text          = 0.000m.ToString();
                    }
                    else
                    {
                        // Fill in the Language information
                        foreach (SimpleProductLangInfo simpleProductLang in Controller.GetSimpleProductLangs(SimpleProduct.SimpleProductId))
                        {
                            dbLangs.Add(simpleProductLang);
                        }
                        lngSimpleProducts.Langs = dbLangs;


                        // Set Image Info
                        int fileId = -1;
                        if (!String.IsNullOrEmpty(SimpleProduct.Image))
                        {
                            try
                            {
                                IFileInfo file = FileManager.Instance.GetFile(PortalId, SimpleProduct.Image);
                                if (file != null)
                                {
                                    fileId = file.FileId;
                                }
                            }
                            catch (Exception)
                            {
                                fileId = -1;
                            }
                        }
                        string imageUrl = "";
                        if (fileId > -1)
                        {
                            imageUrl = "FileID=" + fileId.ToString();
                        }
                        else
                        {
                            imageUrl = _imageDir + "This_fileName-Should_not_3xist";
                        }

                        // Set other fields
                        txtItemNo.Text            = SimpleProduct.ItemNo;
                        txtTaxPercent.Text        = SimpleProduct.TaxPercent.ToString();
                        taxUnitCost.Mode          = "gross";
                        taxUnitCost.Value         = SimpleProduct.UnitCost;
                        taxOriginalUnitCost.Mode  = "gross";
                        taxOriginalUnitCost.Value = SimpleProduct.OriginalUnitCost;
                        chkDisabled.Checked       = SimpleProduct.Disabled;
                        chkHideCost.Checked       = SimpleProduct.HideCost;
                        chkNoCart.Checked         = SimpleProduct.NoCart;
                        cboSupplier.SelectedValue = SimpleProduct.SupplierId.ToString();
                        ddlUnit.SelectedValue     = SimpleProduct.UnitId.ToString();
                        ImageSelector.Url         = imageUrl;
                        imgImage.ImageUrl         = BBStoreHelper.FileNameToImgSrc(imageUrl, PortalSettings);
                        txtWeight.Text            = SimpleProduct.Weight.ToString();

                        // Set ShippingModel
                        List <ProductShippingModelInfo> productshippingModels = Controller.GetProductShippingModelsByProduct(SimpleProduct.SimpleProductId);
                        if (productshippingModels.Count > 0)
                        {
                            cboShippingModel.SelectedValue = productshippingModels[0].ShippingModelId.ToString();
                        }
                    }

                    // Treeview Basenode
                    TreeNode newNode = new TreeNode(Localization.GetString("treeProductGroups.Text", this.LocalResourceFile), "_-1");
                    newNode.SelectAction     = TreeNodeSelectAction.Expand;
                    newNode.PopulateOnDemand = true;
                    newNode.ImageUrl         = @"~\images\category.gif";
                    newNode.ShowCheckBox     = false;
                    treeProductGroup.Nodes.Add(newNode);
                    //newNode.Expanded = false;


                    // Product Price
                    Localization.LocalizeGridView(ref grdPriceList, LocalResourceFile);
                    grdPriceList.DataSource = ProductPrices;
                    grdPriceList.DataBind();

                    RoleController roleController1 = new RoleController();
                    //RoleInfo role = roleController.GetRole(Convert.ToInt32(storeSettings["SupplierRole"]), PortalId);
                    ArrayList          aRoles = roleController1.GetPortalRoles(PortalId);
                    ListItemCollection roles  = new ListItemCollection();
                    foreach (RoleInfo role in aRoles)
                    {
                        roles.Add(new ListItem(role.RoleName, role.RoleID.ToString()));
                    }
                    string selText1 = Localization.GetString("SelectRole.Text", this.LocalResourceFile);
                    roles.Insert(0, new ListItem(selText1, "-1"));
                    ddlPriceRoleId.DataSource     = roles;
                    ddlPriceRoleId.DataValueField = "Value";
                    ddlPriceRoleId.DataTextField  = "Text";
                    ddlPriceRoleId.DataBind();
                }
                if (HasProductFeatureModule)
                {
                    FeatureGrid.ProductId = ProductId;
                }
            }

            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }