Exemplo n.º 1
0
        protected void treeProductGroup_TreeNodePopulate(object sender, TreeNodeEventArgs e)
        {
            // http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/navigation/treeview.aspx
            TreeNode parent = e.Node;

            if (ShowLevels > 0)
            {
                string[] valPath = parent.ValuePath.Split('/');
                if (valPath.Length >= ShowLevels)
                {
                    return;
                }
            }
            ProductGroupId = Convert.ToInt32(parent.Value.Substring(1));

            String CurrentLanguage           = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
            List <ProductGroupInfo> products = Controller.GetProductSubGroupsByNode(PortalId, CurrentLanguage, ProductGroupId, ShowProductCount, IncludeChilds, IncludeDisabled);

            foreach (ProductGroupInfo p in products)
            {
                string nodeName = p.ProductGroupName +
                                  (ShowProductCount && p.ProductCount > 0 ? " (" + p.ProductCount + ")" : "");
                TreeNode newNode = new TreeNode(nodeName, "_" + p.ProductGroupId.ToString());
                newNode.SelectAction     = TreeNodeSelectAction.SelectExpand;
                newNode.PopulateOnDemand = true;
                if (ShowIcons)
                {
                    newNode.ImageUrl = BBStoreHelper.FileNameToImgSrc(p.Icon, PortalSettings);
                }

                parent.ChildNodes.Add(newNode);
            }
        }
Exemplo n.º 2
0
        public override void UpdateSettings()
        {
            try
            {
                ModuleController objModules = new ModuleController();

                objModules.UpdateModuleSetting(ModuleId, "ProductGroupsInRow", txtProductGroupsInRow.Text.Trim());
                objModules.UpdateModuleSetting(ModuleId, "Template", tplTemplate.Value);
                objModules.UpdateModuleSetting(ModuleId, "DynamicPage", urlSelectDynamicPage.Url);
                objModules.UpdateModuleSetting(ModuleId, "IncludeChilds", chkIncludeChilds.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowProductCount", chkShowProductCount.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "SetTitle", chkSetTitle.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowBreadcrumb", chkShowBreadcrumb.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowExpandCollapse", chkShowExpandCollapse.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "WrapNode", chkWrapNode.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ViewMode", rblViewMode.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, "ShowIcons", chkShowIcons.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "RootLevel", cboRootLevel.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, "RootLevelFixed", chkRootLevelFixed.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "DefaultProductGroup", cboDefaultProductGroup.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, "ShowLevels", txtShowLevels.Text.Trim());
                objModules.UpdateModuleSetting(ModuleId, "AllGroupsImage", BBStoreHelper.GetRelativeFilePath(AllGroupsImageSelector.Url));
                objModules.UpdateModuleSetting(ModuleId, "ShowUpNavigation", chkShowUpNavigation.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowThisNode", chkShowThisNode.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowSubNodes", chkShowSubNodes.Checked.ToString());
            }

            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemplo n.º 3
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            lngProductGroups.UpdateLangs();
            switch (EditState)
            {
            case "new":
                ProductGroupInfo pgNew = new ProductGroupInfo();
                pgNew.ParentId         = ProductGroupId;
                pgNew.PortalId         = PortalId;
                pgNew.Image            = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                pgNew.Icon             = BBStoreHelper.GetRelativeFilePath(IconSelector.Url);
                pgNew.ProductListTabId = Convert.ToInt32(urlTarget.Url);
                pgNew.Disabled         = chkDisabled.Checked;
                pgNew.ViewOrder        = Convert.ToInt32(txtViewOrder.Text);
                int productGroupId = Controller.NewProductGroup(pgNew);
                foreach (ProductGroupLangInfo pgl in lngProductGroups.Langs)
                {
                    pgl.ProductGroupId = productGroupId;
                    Controller.NewProductGroupLang(pgl);
                }
                ProductGroupId = productGroupId;
                EditState      = "update";
                break;

            case "update":
                ProductGroupInfo pgUpdate = Controller.GetProductGroup(PortalId, ProductGroupId);
                pgUpdate.Image            = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                pgUpdate.Icon             = BBStoreHelper.GetRelativeFilePath(IconSelector.Url);
                pgUpdate.ProductListTabId = Convert.ToInt32(urlTarget.Url);
                pgUpdate.Disabled         = chkDisabled.Checked;
                pgUpdate.ViewOrder        = Convert.ToInt32(txtViewOrder.Text);
                Controller.UpdateProductGroup(pgUpdate);
                Controller.DeleteProductGroupLangs(ProductGroupId);
                foreach (ProductGroupLangInfo pgl in lngProductGroups.Langs)
                {
                    pgl.ProductGroupId = ProductGroupId;
                    Controller.NewProductGroupLang(pgl);
                }
                break;

            default:
                break;
            }
            if (Request.QueryString["adminmode"] != null)
            {
                Response.Redirect(Globals.NavigateURL(TabId, "", "adminmode=productgroup"), true);
            }
            else
            {
                Response.Redirect(EditUrl(), true);
            }
        }
Exemplo n.º 4
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            lngFeatureListItems.UpdateLangs();
            switch (EditState)
            {
            case "new":
                FeatureListItemInfo fliNew = new FeatureListItemInfo();
                fliNew.FeatureListId = FeatureListId;
                fliNew.Image         = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                fliNew.ViewOrder     = Convert.ToInt32(txtViewOrder.Text);
                int featureListItemId = Controller.NewFeatureListItem(fliNew);
                foreach (FeatureListItemLangInfo featureListItemLang in lngFeatureListItems.Langs)
                {
                    featureListItemLang.FeatureListItemId = featureListItemId;
                    Controller.NewFeatureListItemLang(featureListItemLang);
                }
                FeatureListItemId = featureListItemId;
                EditState         = "update";
                break;

            case "update":
                FeatureListItemInfo fliUpdate = Controller.GetFeatureListItemById(FeatureListItemId);
                fliUpdate.Image     = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                fliUpdate.ViewOrder = Convert.ToInt32(txtViewOrder.Text);
                Controller.UpdateFeatureListItem(fliUpdate);

                Controller.DeleteFeatureListItemLangs(FeatureListItemId);
                foreach (FeatureListItemLangInfo featureListItemLang in lngFeatureListItems.Langs)
                {
                    featureListItemLang.FeatureListItemId = FeatureListItemId;
                    Controller.NewFeatureListItemLang(featureListItemLang);
                }
                break;

            default:
                break;
            }
            if (Request.QueryString["adminmode"] != null)
            {
                Response.Redirect(Globals.NavigateURL(TabId, "", "adminmode=featurelistitem", "featurelist=" + FeatureListId.ToString()), true);
            }
            else
            {
                Response.Redirect(EditUrl(), true);
            }
        }
Exemplo n.º 5
0
        protected void treeProductGroup_TreeNodePopulate(object sender, TreeNodeEventArgs e)
        {
            // http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/navigation/treeview.aspx
            TreeNode parent = e.Node;
            int      productGroupId;

            productGroupId = Convert.ToInt32(parent.Value.Substring(1));

            Controller = new BBStoreController();

            List <ProductGroupInfo> products = Controller.GetProductSubGroupsByNode(PortalId, CurrentLanguage, productGroupId, false, false, true);

            foreach (ProductGroupInfo p in products)
            {
                TreeNode newNode = new TreeNode(p.ProductGroupName, "_" + p.ProductGroupId.ToString());
                newNode.SelectAction     = TreeNodeSelectAction.Select;
                newNode.PopulateOnDemand = true;
                newNode.ImageUrl         = BBStoreHelper.FileNameToImgSrc(p.Icon, PortalSettings);
                parent.ChildNodes.Add(newNode);
            }
        }
Exemplo n.º 6
0
 protected void imgRefreshImg_Click(object sender, EventArgs e)
 {
     imgImage.ImageUrl = BBStoreHelper.FileNameToImgSrc(ImageSelector.Url, PortalSettings);
 }
Exemplo n.º 7
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // First lets save the product
                SimpleProductInfo SimpleProduct = null;
                bool isNew = false;

                if (ProductId >= 0)
                {
                    SimpleProduct = Controller.GetSimpleProductByProductId(PortalId, ProductId);
                }
                else
                {
                    isNew = true;
                }

                if (SimpleProduct != null)
                {
                    SimpleProduct.Image                = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                    SimpleProduct.ItemNo               = txtItemNo.Text.Trim();
                    SimpleProduct.UnitCost             = taxUnitCost.NetPrice;
                    SimpleProduct.OriginalUnitCost     = taxOriginalUnitCost.NetPrice;
                    SimpleProduct.TaxPercent           = Convert.ToDecimal(txtTaxPercent.Text.Trim());
                    SimpleProduct.LastModifiedByUserId = UserId;
                    SimpleProduct.LastModifiedOnDate   = DateTime.Now;
                    SimpleProduct.Disabled             = chkDisabled.Checked;
                    SimpleProduct.HideCost             = chkHideCost.Checked;
                    SimpleProduct.NoCart               = chkNoCart.Checked;
                    SimpleProduct.SupplierId           = String.IsNullOrEmpty(cboSupplier.SelectedValue) ? -1 : Convert.ToInt32(cboSupplier.SelectedValue);
                    SimpleProduct.UnitId               = String.IsNullOrEmpty(ddlUnit.SelectedValue) ? -1 : Convert.ToInt32(ddlUnit.SelectedValue);
                    SimpleProduct.Weight               = Convert.ToDecimal(txtWeight.Text.Trim());
                    Controller.UpdateSimpleProduct(SimpleProduct);
                }
                else
                {
                    SimpleProduct                      = new SimpleProductInfo();
                    SimpleProduct.PortalId             = PortalId;
                    SimpleProduct.Image                = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                    SimpleProduct.ItemNo               = txtItemNo.Text.Trim();
                    SimpleProduct.UnitCost             = taxUnitCost.NetPrice;
                    SimpleProduct.OriginalUnitCost     = taxOriginalUnitCost.NetPrice;
                    SimpleProduct.TaxPercent           = Convert.ToDecimal(txtTaxPercent.Text.Trim());
                    SimpleProduct.CreatedOnDate        = DateTime.Now;
                    SimpleProduct.LastModifiedOnDate   = DateTime.Now;
                    SimpleProduct.CreatedByUserId      = UserId;
                    SimpleProduct.LastModifiedByUserId = UserId;
                    SimpleProduct.Disabled             = chkDisabled.Checked;
                    SimpleProduct.HideCost             = chkHideCost.Checked;
                    SimpleProduct.NoCart               = chkNoCart.Checked;
                    SimpleProduct.SupplierId           = String.IsNullOrEmpty(cboSupplier.SelectedValue) ? -1 : Convert.ToInt32(cboSupplier.SelectedValue);
                    SimpleProduct.UnitId               = String.IsNullOrEmpty(ddlUnit.SelectedValue) ? -1 : Convert.ToInt32(ddlUnit.SelectedValue);
                    SimpleProduct.Weight               = Convert.ToDecimal(txtWeight.Text.Trim());
                    ProductId = Controller.NewSimpleProduct(SimpleProduct);
                }

                // Lets update the ShippingModel
                Controller.DeleteProductShippingModelByProduct(ProductId);
                int shippingModelId = -1;
                if (cboShippingModel.SelectedValue != null && Int32.TryParse(cboShippingModel.SelectedValue, out shippingModelId))
                {
                    Controller.InsertProductShippingModel(new ProductShippingModelInfo()
                    {
                        ShippingModelId = shippingModelId, SimpleProductId = ProductId
                    });
                }


                // Now lets update Language information
                lngSimpleProducts.UpdateLangs();
                Controller.DeleteSimpleProductLangs(ProductId);
                foreach (SimpleProductLangInfo si in lngSimpleProducts.Langs)
                {
                    si.SimpleProductId = ProductId;
                    Controller.NewSimpleProductLang(si);
                }

                // Lets handle the Product Groups
                int redirProductGroupId = 0;
                if (HasProductGroupModule)
                {
                    if (Request.QueryString["productgroup"] != null)
                    {
                        redirProductGroupId = Convert.ToInt32(Request.QueryString["productgroup"]);
                    }


                    Controller.DeleteProductInGroups(ProductId);
                    foreach (TreeNode node in treeProductGroup.CheckedNodes)
                    {
                        int ProductGroupId = Convert.ToInt32(node.Value.Substring(1));
                        Controller.NewProductInGroup(ProductId, ProductGroupId);
                        if (redirProductGroupId == 0)
                        {
                            redirProductGroupId = ProductGroupId;
                        }
                    }
                }

                // If we created a new product, we bound this as a fixed product to the module
                if (isNew && this.Parent.NamingContainer.ID != "ViewAdmin")
                {
                    ModuleController module = new ModuleController();
                    module.UpdateModuleSetting(ModuleId, "ProductId", ProductId.ToString());
                }
                FeatureGrid.SaveFeatures();

                List <string> addParams = new List <string>();

                if (Request["adminmode"] != null)
                {
                    addParams.Add("adminmode=productlist");
                }
                if (redirProductGroupId > 0)
                {
                    addParams.Add("productgroup=" + redirProductGroupId.ToString());
                }
                addParams.Add("productId=" + ProductId.ToString());

                Response.Redirect(Globals.NavigateURL(TabId, "", addParams.ToArray()), true);
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemplo n.º 8
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);
            }
        }
Exemplo n.º 9
0
        protected void treeProductGroup_SelectedNodeChanged(object sender, EventArgs e)
        {
            // Determine new ProductId
            string productGroupId = treeProductGroup.SelectedNode.Value;

            if (productGroupId.StartsWith("_"))
            {
                ProductGroupId = Convert.ToInt32(productGroupId.Substring(1));
            }

            // Enabling / Disabling Edit Controls
            pnlProductGroupTree.Visible    = false;
            pnlProductGroupDetails.Visible = true;

            cmdCancel.Visible = true;

            if (ProductGroupId > -1 || EditState == "new")
            {
                pnlProductGroupEditDetails.Visible = true;
                cmdUpdate.Visible = true;
                BindFeatureListsData();
            }
            else
            {
                pnlProductGroupEditDetails.Visible = false;
                cmdUpdate.Visible = false;
            }
            cmdAdd.Visible = (EditState != "new");

            // if product exists

            if (ProductGroupId > 0)
            {
                ProductGroup = Controller.GetProductGroup(PortalId, CurrentLanguage, ProductGroupId);
            }

            if (ProductGroup != null)
            {
                // Fill in the Language information
                List <ILanguageEditorInfo> dbLangs = new List <ILanguageEditorInfo>();
                foreach (ProductGroupLangInfo productGroupLang in Controller.GetProductGroupLangs(ProductGroup.ProductGroupId))
                {
                    dbLangs.Add(productGroupLang);
                }
                lngProductGroups.Langs = dbLangs;

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

                // Set Icon Info
                int    iconFileId = -1;
                string iconUrl    = "";
                if (!String.IsNullOrEmpty(ProductGroup.Icon))
                {
                    IFileInfo iconFile = FileManager.Instance.GetFile(PortalId, ProductGroup.Icon);
                    if (iconFile != null)
                    {
                        iconFileId = iconFile.FileId;
                    }
                }

                if (iconFileId > -1)
                {
                    iconUrl = "FileID=" + iconFileId.ToString();
                }
                else
                {
                    iconUrl = _iconDir + "This_fileName-Should_not_3xist";
                }

                ImageSelector.Url   = imageUrl;
                IconSelector.Url    = iconUrl;
                imgImage.ImageUrl   = BBStoreHelper.FileNameToImgSrc(imageUrl, PortalSettings);
                imgIcon.ImageUrl    = BBStoreHelper.FileNameToImgSrc(iconUrl, PortalSettings);
                urlTarget.Url       = ProductGroup.ProductListTabId.ToString();
                chkDisabled.Checked = ProductGroup.Disabled;
                txtViewOrder.Text   = ProductGroup.ViewOrder.ToString();
            }
            else
            {
                ImageSelector.Url   = "";
                IconSelector.Url    = "";
                imgImage.ImageUrl   = "";
                imgIcon.ImageUrl    = "";
                urlTarget.Url       = "";
                chkDisabled.Checked = false;
                txtViewOrder.Text   = "0";
            }

            // If collapsed we have to expand first to see if there are childs
            if (treeProductGroup.SelectedNode.Expanded == false)
            {
                treeProductGroup.SelectedNode.Expand();
                treeProductGroup.SelectedNode.Collapse();
            }
            int childCount = treeProductGroup.SelectedNode.ChildNodes.Count;

            // We are only allowed to delete if no childs
            cmdDelete.Visible    = (childCount == 0);
            lblPGDetails.Text    = treeProductGroup.SelectedNode.Text + (ProductGroup == null ? "" : " (ID:" + ProductGroup.ProductGroupId.ToString() + ")");
            lblPGDetails.Visible = true;
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (IsConfigured)
                {
                    switch (MultiView1.ActiveViewIndex)
                    {
                    case 0:
                        //if (!Page.IsPostBack)
                    {
                        List <ProductGroupInfo> productGroups = new List <ProductGroupInfo>();
                        ProductGroupInfo        thisgroup     = Controller.GetProductGroup(PortalId, CurrentLanguage, ProductGroupId);

                        if (Settings["ShowUpNavigation"] != null && Convert.ToBoolean(Settings["ShowUpNavigation"]))
                        {
                            if (thisgroup != null)
                            {
                                if (thisgroup.ParentId != -1)
                                {
                                    ProductGroupInfo parentGroup = Controller.GetProductGroup(PortalId, CurrentLanguage, thisgroup.ParentId);
                                    if (parentGroup != null)
                                    {
                                        //parentGroup.Image = (string) Settings["Image"] ?? "";
                                        productGroups.Add(parentGroup);
                                    }
                                }
                                else
                                {
                                    ProductGroupInfo dummyParent = new ProductGroupInfo();
                                    dummyParent.ParentId         = -1;
                                    dummyParent.PortalId         = PortalId;
                                    dummyParent.Image            = (string)Settings["AllGroupsImage"] ?? "";
                                    dummyParent.ProductCount     = 0;
                                    dummyParent.ProductGroupId   = -1;
                                    dummyParent.ProductGroupName = Localization.GetString("AllGroups.Text", this.LocalResourceFile);
                                    dummyParent.ViewOrder        = 0;

                                    productGroups.Add(dummyParent);
                                }
                            }
                        }

                        if (thisgroup != null && Settings["ShowThisNode"] != null && Convert.ToBoolean(Settings["ShowThisNode"]))
                        {
                            productGroups.Add(thisgroup);
                        }

                        if (Settings["ShowSubNodes"] == null || (Settings["ShowSubNodes"] != null && Convert.ToBoolean(Settings["ShowSubNodes"])))
                        {
                            productGroups.AddRange(Controller.GetProductSubGroupsByNode(PortalId, CurrentLanguage, ProductGroupId, ShowProductCount, IncludeChilds, IncludeDisabled));
                        }
                        ProductGroups = productGroups;
                        if (ProductGroups.Count > 0)
                        {
                            lstProductGroups.DataSource = ProductGroups;
                            lstProductGroups.DataBind();
                        }
                        else
                        {
                            IsVisible = false;
                        }
                    }
                    break;

                    case 1:
                        if (!Page.IsPostBack)
                        {
                            if (Settings["ShowExpandCollapse"] != null)
                            {
                                treeProductGroup.ShowExpandCollapse = Convert.ToBoolean(Settings["ShowExpandCollapse"]);
                            }

                            // Treeview Basenodes
                            List <ProductGroupInfo> lpg = Controller.GetProductSubGroupsByNode(PortalId, CurrentLanguage, -1, ShowProductCount, IncludeChilds, IncludeDisabled);
                            foreach (ProductGroupInfo pg in lpg)
                            {
                                string nodeName = pg.ProductGroupName +
                                                  (ShowProductCount && pg.ProductCount > 0 ? " (" + pg.ProductCount + ")" : "");
                                TreeNode newNode = new TreeNode(nodeName, "_" + pg.ProductGroupId.ToString());
                                newNode.SelectAction     = TreeNodeSelectAction.SelectExpand;
                                newNode.PopulateOnDemand = true;
                                if (ShowIcons)
                                {
                                    newNode.ImageUrl = BBStoreHelper.FileNameToImgSrc(pg.Icon, PortalSettings);
                                }
                                treeProductGroup.Nodes.Add(newNode);
                            }

                            // And now we need to expand all nodes to the selected node
                            string   treePath  = Controller.GetProductGroupPath(PortalId, ProductGroupId);
                            string[] bread     = treePath.Split('/');
                            string   valuePath = "";
                            for (int i = 0; i < bread.Length; i++)
                            {
                                if (i > 0)
                                {
                                    valuePath += "/";
                                }
                                valuePath += bread[i];
                                TreeNode node = treeProductGroup.FindNode(valuePath);
                                if (node != null)
                                {
                                    node.Expand();
                                    //if (ProductGroupId != -1 && node.Value == "_" + ProductGroupId.ToString())
                                    //    node.Select();
                                }
                            }
                        }
                        break;

                    case 2:
                        string pgPath = Controller.GetProductGroupPath(PortalId, ProductGroupId);
                        if (pgPath == string.Empty)
                        {
                            pgPath = "_-1";
                        }
                        else
                        {
                            pgPath = "_-1/" + pgPath;
                        }
                        string[] pgArr = pgPath.Split('/');

                        for (int Level = 0; Level < pgArr.Length; Level++)
                        {
                            int Value = -1;
                            if (Level < pgArr.Length - 1)
                            {
                                Value = Convert.ToInt32(pgArr[Level + 1].Substring(1));
                            }
                            int          productGroup = Convert.ToInt32(pgArr[Level].Substring(1));
                            DropDownList ddl          = ProductGroupCombo(productGroup, Value, Level);
                            if (ddl != null)
                            {
                                phDropDown.Controls.Add(ddl);
                                phDropDown.Controls.Add(new LiteralControl("<br />"));
                            }
                        }

                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    MultiView1.Visible = false;
                }
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemplo n.º 11
0
        protected void lstFeatureListItems_SelectedIndexChanged(object sender, EventArgs e)
        {
            lstFeatureListItems.Attributes.Add("onClick", "javascript:alert('" + Localization.GetString("LstDisabled.Text", this.LocalResourceFile) + "');");

            // Determine new ProductId
            FeatureListItemId = Convert.ToInt32(lstFeatureListItems.SelectedValue);
            if (FeatureListItemId == -1)
            {
                EditState = "new";
                lngFeatureListItems.Langs         = new List <ILanguageEditorInfo>();
                pnlFeatureListItemDetails.Visible = true;
                lblFLIDetails.Text = Localization.GetString("NewFeatureListItem.Text", this.LocalResourceFile);
            }


            // Enabling / Disabling Edit Controls
            pnlFeatureListsItems.Visible = false;

            bool pnlVisible = (FeatureListItemId > -1 || EditState == "new");

            pnlFeatureListItemDetails.Visible = pnlVisible;
            cmdUpdate.Visible = pnlVisible;
            cmdCancel.Visible = true;
            cmdDelete.Visible = (EditState != "new");

            if (FeatureListItemId > 0)
            {
                FeatureListItem = Controller.GetFeatureListItemById(FeatureListItemId, CurrentLanguage);
            }

            if (FeatureListItem != null)
            {
                // Set Image Info

                int imageFileId = -1;
                if (!String.IsNullOrEmpty(FeatureListItem.Image))
                {
                    IFileInfo file = FileManager.Instance.GetFile(PortalId, FeatureListItem.Image);
                    if (file != null)
                    {
                        imageFileId = file.FileId;
                    }
                }

                string imageUrl = "";
                if (imageFileId > -1)
                {
                    imageUrl = "FileID=" + imageFileId.ToString();
                }
                else
                {
                    imageUrl = _imageDir + "This_fileName-Should_not_3xist";
                }

                ImageSelector.Url = imageUrl;
                imgImage.ImageUrl = BBStoreHelper.FileNameToImgSrc(imageUrl, PortalSettings);
                txtViewOrder.Text = FeatureListItem.ViewOrder.ToString();

                // Fill in the Language information
                List <ILanguageEditorInfo> dbLangs = new List <ILanguageEditorInfo>();
                foreach (FeatureListItemLangInfo featureListItemLang in Controller.GetFeatureListItemLangs(FeatureListItem.FeatureListItemId))
                {
                    dbLangs.Add(featureListItemLang);
                }
                lngFeatureListItems.Langs = dbLangs;
            }

            lblFLIDetails.Text           = String.Format("{0} (ID:{1})", lstFeatureListItems.SelectedItem.Text, FeatureListItemId);
            lblFLIDetails.Visible        = true;
            lblFLIDetailsCaption.Visible = true;
        }