Esempio n. 1
0
        protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl = sender as DropDownList;

            ProductGroupId = Convert.ToInt32(ddl.SelectedValue);

            int dynamicTab = Convert.ToInt32(Settings["DynamicPage"] ?? TabId.ToString());

            if (ProductGroupId == -1)
            {
                Controller.DeleteProductFilter(PortalId, FilterSessionId, "ProductGroup");
                Response.Redirect(Globals.NavigateURL(dynamicTab));
            }

            SetFilter(ProductGroupId, IncludeChilds);

            ProductGroupInfo pgi = Controller.GetProductGroup(PortalId, CurrentLanguage, ProductGroupId);

            if (pgi != null && pgi.ProductListTabId != -1)
            {
                Response.Redirect(Globals.NavigateURL(pgi.ProductListTabId, "", "productgroup=" + ProductGroupId.ToString()));
            }
            else
            {
                Response.Redirect(Globals.NavigateURL(dynamicTab, "", "productgroup=" + ProductGroupId.ToString()));
            }
        }
Esempio n. 2
0
        protected void Page_PreRender(object sender, System.EventArgs e)
        {
            try
            {
                // We can set the Title of our Module
                if (SetTitle)
                {
                    bool breadcrumb = (Settings["ShowBreadcrumb"] != null ? Convert.ToBoolean((string)Settings["ShowBreadcrumb"]) : false);

                    string           productGroupPath = "";
                    string           root             = Localization.GetString("MainProductGroup.Text", this.LocalResourceFile);
                    ProductGroupInfo pg = Controller.GetProductGroup(PortalId, CurrentLanguage, ProductGroupId);

                    if (pg != null)
                    {
                        int productGroupId = pg.ProductGroupId;
                        if (breadcrumb)
                        {
                            string link         = Globals.NavigateURL(TabId, "", "productgroup={1}");
                            string linkTemplate = "<a href=\"" + link + "\">{0}</a>";
                            productGroupPath = Controller.GetProductGroupPath(PortalId, pg.ProductGroupId, CurrentLanguage, false, " > ", linkTemplate, root);
                        }
                        else if (productGroupId > -1)
                        {
                            productGroupPath = pg.ProductGroupName;
                        }
                    }


                    string  titleLabelName = DotNetNukeContext.Current.Application.Version.Major < 6 ? "lblTitle" : "titleLabel";
                    Control ctl            = Globals.FindControlRecursiveDown(this.ContainerControl, titleLabelName);
                    if (ctl != null)
                    {
                        ((Label)ctl).Text = productGroupPath != string.Empty ? productGroupPath : root;
                    }
                }

                if (!IsVisible && !IsEditable)
                {
                    this.ContainerControl.Visible = false;
                }
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }

            // Check licensing
            LicenseDataInfo license = Controller.GetLicense(PortalId, false);

            Controller.CheckLicense(license, this, ModuleKind);
        }
Esempio 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);
            }
        }
Esempio n. 4
0
        protected void treeProductGroup_SelectedNodeChanged(object sender, EventArgs e)
        {
            ProductGroupId = Convert.ToInt32(treeProductGroup.SelectedNode.Value.Substring(1));

            SetFilter(ProductGroupId, IncludeChilds);

            ProductGroupInfo pgi = Controller.GetProductGroup(PortalId, CurrentLanguage, ProductGroupId);

            if (pgi != null && pgi.ProductListTabId != -1)
            {
                Response.Redirect(Globals.NavigateURL(pgi.ProductListTabId, "", "productgroup=" + ProductGroupId.ToString()));
            }
            else
            {
                int dynamicTab = Convert.ToInt32(Settings["DynamicPage"] ?? TabId.ToString());
                Response.Redirect(Globals.NavigateURL(dynamicTab, "", "productgroup=" + ProductGroupId.ToString()));
            }
        }
Esempio n. 5
0
        protected void lstProductGroups_SelectedIndexChanging(object sender, ListViewSelectEventArgs e)
        {
            ProductGroupId = (int)lstProductGroups.DataKeys[e.NewSelectedIndex].Value;

            SetFilter(ProductGroupId, IncludeChilds);

            ProductGroupInfo pgi = Controller.GetProductGroup(PortalId, CurrentLanguage, ProductGroupId);

            if (pgi != null && pgi.ProductListTabId != -1)
            {
                Response.Redirect(Globals.NavigateURL(pgi.ProductListTabId, "", "productgroup=" + ProductGroupId.ToString()));
            }
            else
            {
                int dynamicTab = Convert.ToInt32(Settings["DynamicPage"] ?? TabId.ToString());
                Response.Redirect(Globals.NavigateURL(dynamicTab, "", "productgroup=" + ProductGroupId.ToString()));
            }
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //TODO: Beim Aufruf der Seite ohne ProductGroupParameter wird der Breadcrumb nicht angezeigt (Info aus Filter)
            BBStoreController Controller = new BBStoreController();
            int ParentNode;

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

                // We retrieve the treepath of the ParentNode
                string treePath = Controller.GetProductGroupPath(PortalSettings.PortalId, ParentNode);

                Label lbl = new Label();
                lbl.Text = Separator;
                phBreadCrumb.Controls.Add(lbl);

                // Now lets build the breadcrumb
                string[]   bread = treePath.Split('/');
                LinkButton cmdBread;

                for (int i = 0; i < bread.Length; i++)
                {
                    cmdBread = new LinkButton();
                    int productGroupId = Convert.ToInt32(bread[i].Substring(1));
                    cmdBread.Attributes.Add("productgroup", productGroupId.ToString());
                    ProductGroupInfo pgi = Controller.GetProductGroup(PortalSettings.PortalId, System.Threading.Thread.CurrentThread.CurrentCulture.Name, productGroupId);
                    cmdBread.Text     = pgi.ProductGroupName;
                    cmdBread.Click   += new EventHandler(cmdBread_Click);
                    cmdBread.CssClass = "SkinObject";
                    phBreadCrumb.Controls.Add(cmdBread);

                    if (i + 1 < bread.Length)
                    {
                        lbl      = new Label();
                        lbl.Text = Separator;
                        phBreadCrumb.Controls.Add(lbl);
                    }
                }
            }
        }
Esempio n. 7
0
        public void SaveProductGroup(string PortalId, string strStoreGuid, ProductGroupInfo productGroup, string Token)
        {
            int portalId = -1;

            Int32.TryParse(PortalId, out portalId);
            if (portalId < 0)
            {
                throw new Exception("PortalId must be zero or greater");
            }

            if (productGroup == null)
            {
                throw new Exception("ProductGroup must not be null");
            }

            Guid storeGuid = new Guid(strStoreGuid);

            if (storeGuid == Guid.Empty)
            {
                throw new Exception("StoreGuid must be valid!");
            }

            ImportController.SaveProductGroup(portalId, productGroup, storeGuid);
        }
Esempio n. 8
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;
        }
Esempio n. 9
0
        protected void lstProductGroups_ItemCreated(object sender, ListViewItemEventArgs e)
        {
            if (IsConfigured)
            {
                int              imageWidth = 200;
                ListView         lv         = sender as ListView;
                ListViewDataItem item       = e.Item as ListViewDataItem;
                productGroup = item.DataItem as ProductGroupInfo;
                if (productGroup != null)
                {
                    string template = Template;
                    template = template.Replace("[PRODUCTGROUPNAME]", "<asp:Label ID=\"lblProductGroupName\" runat=\"server\" />");
                    template = template.Replace("[PRODUCTGROUPSHORTDESCRIPTION]", "<asp:Label ID=\"lblProductGroupShortDescription\" runat=\"server\" />");
                    template = template.Replace("[PRODUCTGROUPDESCRIPTION]", "<asp:Label ID=\"lblProductGroupDescription\" runat=\"server\" />");
                    if (template.IndexOf("[IMAGE") > -1)
                    {
                        if (template.IndexOf("[IMAGE:") > -1)
                        {
                            string width;
                            width = template.Substring(template.IndexOf("[IMAGE:") + 7);
                            width = width.Substring(0, width.IndexOf("]"));
                            if (Int32.TryParse(width, out imageWidth) == false)
                            {
                                imageWidth = 200;
                            }
                            template = template.Replace("[IMAGE:" + width + "]", "<asp:PlaceHolder ID=\"phimgProductGroup\" runat=\"server\" />");
                        }
                        else
                        {
                            template = template.Replace("[IMAGE]", "<asp:PlaceHolder ID=\"phimgProductGroupOri\" runat=\"server\" />");
                        }
                    }
                    while (template.IndexOf("[RESOURCE:") > -1)
                    {
                        string resKey = template.Substring(template.IndexOf("[RESOURCE:") + 10);
                        resKey   = resKey.Substring(0, resKey.IndexOf("]"));
                        template = template.Replace("[RESOURCE:" + resKey + "]",
                                                    Localization.GetString(resKey, this.LocalResourceFile));
                    }
                    template = template.Replace("[ICON]", "<asp:Image ID=\"imgIcon\" runat=\"server\" />");
                    template = template.Replace("[PRODUCTCOUNT]", "<asp:Label ID=\"lblProductCount\" runat=\"server\" />");

                    int linkCnt = 0;
                    while (template.Contains("[LINK]"))
                    {
                        linkCnt++;
                        template = template.ReplaceFirst("[LINK]", "<asp:Literal ID=\"ltrLink" + linkCnt.ToString() + "\" runat=\"server\" />");
                    }

                    Control ctrl = ParseControl(template);
                    lblProductGroupName = FindControlRecursive(ctrl, "lblProductGroupName") as Label;
                    if (lblProductGroupName != null)
                    {
                        lblProductGroupName.Text = productGroup.ProductGroupName;
                    }

                    Label lblProductGroupShortDescription = FindControlRecursive(ctrl, "lblProductGroupShortDescription") as Label;
                    if (lblProductGroupShortDescription != null)
                    {
                        lblProductGroupShortDescription.Text = productGroup.ProductGroupShortDescription;
                    }

                    Label lblProductGroupDescription = FindControlRecursive(ctrl, "lblProductGroupDescription") as Label;
                    if (lblProductGroupDescription != null)
                    {
                        lblProductGroupDescription.Text = productGroup.ProductGroupDescription;
                    }

                    PlaceHolder phimgProductGroup = FindControlRecursive(ctrl, "phimgProductGroup") as PlaceHolder;
                    if (phimgProductGroup != null && productGroup.Image != null)
                    {
                        string fileName =
                            PortalSettings.HomeDirectoryMapPath.Replace(HttpContext.Current.Request.PhysicalApplicationPath, "") +
                            productGroup.Image.Replace('/', '\\');

                        imgProductGroup = new GeneratedImage();
                        imgProductGroup.ImageHandlerUrl = "~/BBImageHandler.ashx";
                        if (imageWidth > 0)
                        {
                            imgProductGroup.Parameters.Add(new ImageParameter()
                            {
                                Name = "Width", Value = imageWidth.ToString()
                            });
                        }
                        imgProductGroup.Parameters.Add(new ImageParameter()
                        {
                            Name = "File", Value = fileName
                        });
                        // TODO: Watermark
                        //if (false)
                        //{
                        //    imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkText", Value = Localization.GetString("Sold.Text", this.LocalResourceFile) });
                        //    imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkFontFamily", Value = "Verdana" });
                        //    imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkFontColor", Value = "Red" });
                        //    imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkFontSize", Value = "20" });
                        //}
                        phimgProductGroup.Controls.Add(imgProductGroup);
                    }

                    PlaceHolder phimgProductGroupOri = FindControlRecursive(ctrl, "phimgProductGroupOri") as PlaceHolder;
                    if (phimgProductGroupOri != null && productGroup.Image != null)
                    {
                        Image imgProductGroupOri = new Image();
                        imgProductGroupOri.ImageUrl = PortalSettings.HomeDirectory + productGroup.Image;
                        phimgProductGroupOri.Controls.Add(imgProductGroupOri);
                    }

                    imgIcon = FindControlRecursive(ctrl, "imgIcon") as Image;
                    if (imgIcon != null)
                    {
                        imgIcon.ImageUrl = productGroup.Icon;
                    }
                    lblProductCount = FindControlRecursive(ctrl, "lblProductCount") as Label;
                    if (lblProductCount != null)
                    {
                        lblProductCount.Text = productGroup.ProductCount.ToString();
                    }

                    for (int i = 1; i < linkCnt + 1; i++)
                    {
                        Literal ltrLink = FindControlRecursive(ctrl, "ltrLink" + i.ToString()) as Literal;
                        if (ltrLink != null)
                        {
                            if (productGroup.ProductListTabId != -1)
                            {
                                ltrLink.Text = Globals.NavigateURL(productGroup.ProductListTabId, "", "productgroup=" + productGroup.ProductGroupId.ToString());
                            }
                            else
                            {
                                int dynamicTab = Convert.ToInt32(Settings["DynamicPage"] ?? TabId.ToString());
                                ltrLink.Text = Globals.NavigateURL(dynamicTab, "", "productgroup=" + productGroup.ProductGroupId.ToString());
                            }
                        }
                    }

                    PlaceHolder ph = e.Item.FindControl("productGroupPlaceholder") as PlaceHolder;
                    ph.Controls.Add(ctrl);
                }
            }
            else
            {
                lstProductGroups.Visible = false;
            }
        }
Esempio 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);
            }
        }
Esempio n. 11
0
 public abstract void UpdateProductGroup(ProductGroupInfo ProductGroup);
Esempio n. 12
0
 public abstract int NewProductGroup(ProductGroupInfo ProductGroup);
Esempio n. 13
0
        protected void Page_Prerender(object sender, System.EventArgs e)
        {
            if (IsConfigured)
            {
                bool setTitle = (Settings["SetTitle"] != null ? Convert.ToBoolean((string)Settings["SetTitle"]) : false);

                if (setTitle)
                {
                    bool breadcrumb = (Settings["TitleBreadcrumb"] != null ? Convert.ToBoolean((string)Settings["TitleBreadcrumb"]) : false);

                    string productGroupPath     = "";
                    string rootText             = Localization.GetString("MainProductGroup.Text", this.LocalResourceFile);
                    List <ProductFilterInfo> fi = Controller.GetProductFilter(PortalId, FilterSessionId, "ProductGroup");
                    if (fi.Count > 0)
                    {
                        string[] values         = fi[0].FilterValue.Split('|');
                        int      productGroupId = Convert.ToInt32(values[0]);
                        if (breadcrumb)
                        {
                            string link         = Globals.NavigateURL(TabId, "", "productgroup={1}");
                            string linkTemplate = "<a href=\"" + link + "\">{0}</a>";
                            productGroupPath = Controller.GetProductGroupPath(PortalId, productGroupId, CurrentLanguage, false, " > ", linkTemplate, rootText);
                        }
                        else if (productGroupId > -1)
                        {
                            ProductGroupInfo pg = Controller.GetProductGroup(PortalId, CurrentLanguage, productGroupId);
                            productGroupPath = pg.ProductGroupName;
                        }
                    }

                    string  titleLabelName = DotNetNukeContext.Current.Application.Version.Major < 6 ? "lblTitle" : "titleLabel";
                    Control ctl            = Globals.FindControlRecursiveDown(this.ContainerControl, titleLabelName);
                    if (ctl != null)
                    {
                        ((Label)ctl).Text = productGroupPath != string.Empty ? productGroupPath : rootText;
                    }
                }

                // Header and Footer area
                pnlListHead.Visible   = (Settings["ShowListHead"] == null || Convert.ToBoolean(Settings["ShowListHead"]) == true);
                pnlListFooter.Visible = (Products.Count > Pager.PageSize);
                if (Settings["ShowPaging"] != null && Convert.ToBoolean(Settings["ShowPaging"]) == false)
                {
                    pnlListFooter.Visible = false;
                }

                // Header and Footer text
                LocalResourceLangInfo localResourceLang = Controller.GetLocalResourceLang(PortalId, "PRODUCTLISTHEADER", CurrentLanguage);
                if (localResourceLang != null && localResourceLang.TextValue != String.Empty)
                {
                    ltrHead.Text = localResourceLang.TextValue;
                }

                localResourceLang = Controller.GetLocalResourceLang(PortalId, "PRODUCTLISTFOOTER", CurrentLanguage);
                if (localResourceLang != null && localResourceLang.TextValue != String.Empty)
                {
                    ltrFoot.Text = localResourceLang.TextValue;
                }

                // No Products found Display
                if (Products.Count == 0)
                {
                    localResourceLang = Controller.GetLocalResourceLang(PortalId, "PRODUCTLISTEMPTY", CurrentLanguage);
                    if (localResourceLang != null && localResourceLang.TextValue != String.Empty)
                    {
                        ltrEmpty.Text    = localResourceLang.TextValue;
                        ltrEmpty.Visible = true;
                    }
                }


                LinkButton lnkShowAll = lnkShowAllTop;

                if (Settings["ShowAllLinkPos"] != null && Convert.ToInt32(Settings["ShowAllLinkPos"]) > 0 &&
                    _products.Count > 0 && _products.Count > ProductsPerPage)
                {
                    int pos = Convert.ToInt32(Settings["ShowAllLinkPos"]);
                    switch (pos)
                    {
                    case 1:
                        lnkShowAllTop.Visible = true;
                        lnkShowAll            = lnkShowAllTop;
                        divShowAllTop.Style.Add("text-align", "left");
                        break;

                    case 2:
                        lnkShowAllTop.Visible = true;
                        lnkShowAll            = lnkShowAllTop;
                        divShowAllTop.Style.Add("text-align", "center");
                        break;

                    case 3:
                        lnkShowAllTop.Visible = true;
                        lnkShowAll            = lnkShowAllTop;
                        divShowAllTop.Style.Add("text-align", "right");
                        break;

                    case 4:
                        lnkShowAllBottom.Visible = true;
                        lnkShowAll = lnkShowAllBottom;
                        divShowAllBottom.Style.Add("text-align", "left");
                        break;

                    case 5:
                        lnkShowAllBottom.Visible = true;
                        lnkShowAll = lnkShowAllBottom;
                        divShowAllBottom.Style.Add("text-align", "center");
                        break;

                    case 6:
                        lnkShowAllBottom.Visible = true;
                        lnkShowAll = lnkShowAllBottom;
                        divShowAllBottom.Style.Add("text-align", "right");
                        break;
                    }
                    lnkShowAll.Text     = string.Format(Localization.GetString("ShowAllLink.Text", this.LocalResourceFile), Products.Count);
                    lnkShowAll.CssClass = "bbstore-productlist-showall";
                }
            }
            else
            {
                pnlListHead.Visible   = false;
                pnlListFooter.Visible = false;
            }

            if (Convert.ToBoolean(Settings["HideEmptyModule"] ?? "false") == true && _products.Any() == false && !IsEditable)
            {
                this.ContainerControl.Visible = false;
            }

            // Check licensing
            LicenseDataInfo license = Controller.GetLicense(PortalId, false);

            Controller.CheckLicense(license, this, ModuleKind);
        }
Esempio n. 14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                bool showReset = false;
                lblCurrency.Text = Currency;

                // Search ProductGroup
                pnlSearchProductGroup.Visible = false;
                List <ProductFilterInfo> pgf = Controller.GetProductFilter(PortalId, FilterSessionId, "ProductGroup");
                if (pgf.Count > 0)
                {
                    showReset = true;
                    string[] values = pgf[0].FilterValue.Split('|');
                    _productGroupId = Convert.ToInt32(values[0]);
                }

                if (Settings["ProductGroupSearchEnabled"] != null && Convert.ToBoolean(Settings["ProductGroupSearchEnabled"]))
                {
                    ProductGroupInfo pg = Controller.GetProductGroup(PortalId, CurrentLanguage, _productGroupId);
                    if (pg != null)
                    {
                        FilterValueProductGroup       = pg.ProductGroupName;
                        pnlSearchProductGroup.Visible = true;
                    }
                }
                // Search FeatureList
                pnlSearchFeatureList.Visible = false;
                List <ProductFilterInfo> pfl = Controller.GetProductFilter(PortalId, FilterSessionId, "FeatureList");
                if (pfl.Count > 0)
                {
                    showReset = true;
                    string[] values = pfl[0].FilterValue.Split('|');

                    int             FeatureListId = Convert.ToInt32(values[0]);
                    FeatureListInfo fli           = Controller.GetFeatureListById(FeatureListId, CurrentLanguage);
                    if (fli != null)
                    {
                        lblSearchFeatureListCap.Text = fli.FeatureList;
                        int FeatureListItemId = Convert.ToInt32(values[1]);
                        FeatureListItemLangInfo featureListItemLang = Controller.GetFeatureListItemLang(FeatureListItemId, CurrentLanguage);
                        if (featureListItemLang != null)
                        {
                            lblSearchFeatureList.Text    = featureListItemLang.FeatureListItem;
                            pnlSearchFeatureList.Visible = true;
                        }
                    }
                }

                // Search for text
                if (Settings["TextSearchEnabled"] != null && Convert.ToBoolean(Settings["TextSearchEnabled"]))
                {
                    List <ProductFilterInfo> fi = Controller.GetProductFilter(PortalId, FilterSessionId, "TextSearch");
                    if (fi.Count == 0 || fi[0].FilterValue == String.Empty)
                    {
                        MultiViewText.ActiveViewIndex = 0;
                        FilterValueText = (fi.Count == 0 ? "" : fi[0].FilterValue);
                    }
                    else
                    {
                        showReset = true;
                        MultiViewText.ActiveViewIndex = 1;
                        FilterValueText = fi[0].FilterValue;
                    }
                }
                else
                {
                    pnlSearchText.Visible = false;
                }

                // Static Search
                pnlSearchStatic.Visible = false;
                if (Settings["StaticSearchEnabled"] != null && Convert.ToBoolean(Settings["StaticSearchEnabled"]))
                {
                    List <StaticFilterInfo> sf = Controller.GetStaticFilters(PortalId);
                    if (sf.Count > 0)
                    {
                        List <ProductFilterInfo> fi = Controller.GetProductFilter(PortalId, FilterSessionId, "StaticSearch");
                        if (fi.Count > 0 && fi[0].FilterValue != String.Empty)
                        {
                            showReset = true;
                            MultiViewStatic.ActiveViewIndex = 1;
                            FilterValueStatic = Convert.ToInt32(fi[0].FilterValue);
                            StaticFilterInfo actFilter = sf.Find(x => x.StaticFilterId == FilterValueStatic);
                            if (actFilter != null)
                            {
                                lblSearchStatic.Text = actFilter.Token;
                            }
                        }
                        else
                        {
                            MultiViewStatic.ActiveViewIndex = 0;
                            cboSearchStatic.DataSource      = sf;
                            cboSearchStatic.DataTextField   = "Token";
                            cboSearchStatic.DataValueField  = "StaticFilterId";
                            cboSearchStatic.Items.Add(new ListItem {
                                Text = Localization.GetString("Select.Text", this.LocalResourceFile), Value = "0"
                            });
                            cboSearchStatic.AppendDataBoundItems = true;
                            cboSearchStatic.DataBind();
                        }
                        pnlSearchStatic.Visible = true;
                    }
                }

                // Search for Price
                if (Settings["PriceSearchEnabled"] != null && Convert.ToBoolean(Settings["PriceSearchEnabled"]))
                {
                    List <ProductFilterInfo> fi = Controller.GetProductFilter(PortalId, FilterSessionId, "PriceSearch");
                    if (fi.Count == 0 || fi[0].FilterValue == String.Empty)
                    {
                        MultiViewPrice.ActiveViewIndex = 0;
                        FilterValuePrice = (fi.Count == 0 ? "" : fi[0].FilterValue);
                    }
                    else
                    {
                        showReset = true;
                        MultiViewPrice.ActiveViewIndex = 1;
                        FilterValuePrice = fi[0].FilterValue;
                    }
                }
                else
                {
                    pnlSearchPrice.Visible = false;
                }

                // Search for Features
                if (Settings["FeatureSearchEnabled"] != null && Convert.ToBoolean(Settings["FeatureSearchEnabled"]))
                {
                    List <ProductFilterInfo> fi = Controller.GetProductFilter(PortalId, FilterSessionId, "FeatureSearch");
                    if (fi.Count > 0 && fi[0].FilterValue != String.Empty)
                    {
                        showReset = true;
                    }
                    pnlFeatures.Visible         = true;
                    FeatureGrid.ProductGroupId  = _productGroupId;
                    FeatureGrid.FilterSessionId = FilterSessionId;
                    FeatureGrid.SearchTabId     = DynamicPage;
                }
                else
                {
                    pnlFeatures.Visible = false;
                }

                pnlSearchReset.Visible = (Settings["ResetSearchEnabled"] != null && Convert.ToBoolean(Settings["ResetSearchEnabled"]) && showReset);
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }