示例#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);
            }
        }
示例#2
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);
            }
        }
示例#3
0
 protected void imgRefreshImg_Click(object sender, EventArgs e)
 {
     imgImage.ImageUrl = BBStoreHelper.FileNameToImgSrc(ImageSelector.Url, PortalSettings);
 }
示例#4
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);
            }
        }
示例#5
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;
        }
示例#6
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);
            }
        }
        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;
        }