private void webTab_TabClick(object sender, Infragistics.WebUI.UltraWebTab.WebTabEvent e)
        {
            HyperCatalog.Business.Chunk localizedProductNameChunk = null;
            try
            {
                bool isRoll = false;
                if (SessionState.CurrentItem != null)
                {
                    if (e.Tab.Key == "tb_ori")
                    {
                        if (SessionState.Culture.Type != CultureType.Master)
                        {
                            localizedProductNameChunk = HyperCatalog.Business.Chunk.GetByKey(SessionState.CurrentItem.Id, 1, SessionState.Culture.Code);
                        }

                        // Update item name and level name
                        if (localizedProductNameChunk == null)
                        {
                            lbItemName.Text = SessionState.CurrentItem.FullName;
                        }
                        else
                        {
                            if (SessionState.CurrentItem.Sku != null && SessionState.CurrentItem.Sku.Length > 0)
                            {
                                lbItemName.Text = "[" + SessionState.CurrentItem.Sku + "] " + localizedProductNameChunk.Text;
                            }
                            else
                            {
                                lbItemName.Text = localizedProductNameChunk.Text;
                            }
                        }

                        itemLevelName = SessionState.CurrentItem.Level.Name;
                    }
                    else // tb_roll
                    {
                        using (Item rollItem = SessionState.CurrentItem.GetRoll())
                        {
                            if (rollItem != null)
                            {
                                isRoll          = true;
                                lbItemName.Text = rollItem.FullName;
                                if (SessionState.Culture.Type != CultureType.Master)
                                {
                                    localizedProductNameChunk = HyperCatalog.Business.Chunk.GetByKey(rollItem.Id, 1, SessionState.Culture.Code);
                                }

                                // Update item name and level name
                                if (localizedProductNameChunk == null)
                                {
                                    lbItemName.Text = rollItem.FullName;
                                }
                                else
                                {
                                    if (rollItem.Sku != null && rollItem.Sku.Length > 0)
                                    {
                                        lbItemName.Text = "[" + rollItem.Sku + "] - " + localizedProductNameChunk.Text;
                                    }
                                    else
                                    {
                                        lbItemName.Text = localizedProductNameChunk.Text;
                                    }
                                }

                                itemLevelName = rollItem.Level.Name;
                            }
                        }
                    }

                    if (lbItemName.Text.Length > 50)
                    {
                        lbItemName.Text = lbItemName.Text.Substring(0, 49) + "...";
                    }

                    if (isRoll)
                    {
                        lbItemName.Text = "<img src='/hc_v4/img/ed_roll.gif'> " + lbItemName.Text;
                    }
                }
            }
            finally
            {
                if (localizedProductNameChunk != null)
                {
                    localizedProductNameChunk.Dispose();
                }
            }
        }
Exemple #2
0
        private void ShowTabs()
        {
            webTab.Tabs.Clear();
            if (SessionState.CurrentItem != null)
            {
                HyperCatalog.Business.Chunk localizedProductNameChunk = null;
                try
                {
                    if (SessionState.Culture.Type != CultureType.Master && ((bool)SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_TRANSLATED_NAMES).Value))
                    {
                        localizedProductNameChunk = HyperCatalog.Business.Chunk.GetByKey(SessionState.CurrentItem.Id, 1, SessionState.Culture.Code);
                    }
                    if (localizedProductNameChunk == null)
                    {
                        lbItemName.Text = SessionState.CurrentItem.FullName;
                    }
                    else
                    {
                        if (SessionState.CurrentItem.Sku != null && SessionState.CurrentItem.Sku.Length > 0)
                        {
                            lbItemName.Text = "[" + SessionState.CurrentItem.Sku + "] - " + localizedProductNameChunk.Text;
                        }
                        else
                        {
                            lbItemName.Text = localizedProductNameChunk.Text;
                        }
                    }
                }
                finally
                {
                    if (localizedProductNameChunk != null)
                    {
                        localizedProductNameChunk.Dispose();
                    }
                }
                if (lbItemName.Text.Length > 50)
                {
                    lbItemName.Text = lbItemName.Text.Substring(0, 49) + "...";
                }
                itemLevelName = SessionState.CurrentItem.Level.Name;

                InputForm defaultInputForm = InputForm.GetByKey(0);

                // Add input form tabs
                string tabTitle          = string.Empty;
                string tabDesc           = string.Empty;
                int    nbMandatoryChunks = 0;

                #region "Master or Region or Locale to create country specific"
                if (SessionState.Culture.Type == CultureType.Master ||
                    SessionState.Culture.Type == CultureType.Regionale ||
                    (SessionState.Culture.Type == CultureType.Locale && SessionState.CurrentItem.IsCountrySpecific))
                {
                    // Add information tab
                    AddTab("Information", "Information for item #" + SessionState.CurrentItem.Id.ToString(), "tb_info", "/hc_v4/img/ed_about.gif", "QDE_ItemAbout.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code);

                    // Not other tab if item is for country specific (in master culture)
                    if (!(SessionState.CurrentItem.IsCountrySpecific && SessionState.Culture.Type == CultureType.Master))
                    {
                        InputFormList itemInputForms = SessionState.CurrentItem.GetInputForms(SessionState.Culture.Code);
                        if (itemInputForms != null)
                        {
                            if (itemInputForms.Count > 0)
                            {
                                foreach (InputForm inputForm in itemInputForms)
                                {
                                    if (inputForm.ShortName != string.Empty && inputForm.Id != 0)
                                    {
                                        nbMandatoryChunks = 0;
                                        foreach (InputFormContainer ifc in inputForm.Containers)
                                        {
                                            if (ifc.Mandatory)
                                            {
                                                nbMandatoryChunks++;
                                            }
                                        }
                                        tabTitle = inputForm.ShortName + " (" + nbMandatoryChunks.ToString() + "/" + inputForm.Containers.Count.ToString() + ")";
                                        tabDesc  = inputForm.Description + " (Mandatory/Total)";
                                        AddTab(tabTitle, tabDesc, "tb_" + inputForm.Id.ToString(), "/hc_v4/img/ed_inputforms.gif", "QDE_FormContent.aspx?i=" + SessionState.CurrentItem.Id + "&f=IF_" + inputForm.Id.ToString() + "&c=" + SessionState.Culture.Code);
                                    }
                                }
                            }
                            tabTitle = "Content";
                            tabDesc  = "Content attached to this product (Mandatory/Total)";
                            AddTab(tabTitle, tabDesc, "tb_all", "/hc_v4/img/ed_content.gif", "QDE_FormContent.aspx?i=" + SessionState.CurrentItem.Id + "&f=IF_-1" + "&c=" + SessionState.Culture.Code);

                            // Add link tab
                            if (Convert.ToInt32(SessionState.CacheParams["LinksStartLevel"].Value) <= SessionState.CurrentItem.LevelId &&
                                SessionState.CurrentItem.LevelId <= HyperCatalog.Shared.SessionState.SkuLevel.Id &&
                                !SessionState.CurrentItem.IsRoll)
                            {
                                AddTab("Links", "Product compatibilities and links", "tb_lnk", "/hc_v4/img/ed_links.gif", "../links/Links_main.aspx?i=" + SessionState.CurrentItem.Id.ToString() + "&c=" + SessionState.Culture.Code);
                            }
                        }

                        if (SessionState.CurrentItem.LevelId <= HyperCatalog.Shared.SessionState.SkuLevel.Id)
                        {
                            // Add Delivery tab
                            AddTab("Delivery", "Chunks to deliver", "tb_delivery", "/hc_v4/img/ed_delivery.gif", "QDE_Delivery.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code);
                            //Added for Merging PDB view tab with 9.0
                            AddTab("PDBView", "Data Delivered to PDB", "tb_PDBVIew", "/hc_v4/img/ed_delivery.gif", "QDE_PDBView.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code);
                            //Added for Merging PDB view tab with 9.0
                        }
                        if (SessionState.QDETab != null)
                        {
                            if (webTab.Tabs.FromKeyTab(SessionState.QDETab) != null)
                            {
                                webTab.SelectedTabObject = webTab.Tabs.FromKeyTab(SessionState.QDETab);
                            }
                            else
                            {
                                webTab.SelectedTabIndex = 0;
                                SessionState.QDETab     = webTab.Tabs[0].Key;
                            }
                        }
                        else
                        {
                            webTab.SelectedTabIndex = 0;
                            SessionState.QDETab     = webTab.Tabs[0].Key;
                        }
                    }
                }
            }
            #endregion
        }
        private void ShowTabs()
        {
            webTab.Tabs.Clear();
            HyperCatalog.Business.Chunk localizedProductNameChunk = null;
            try
            {
                if (SessionState.Culture.Type != CultureType.Master && ((bool)SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_TRANSLATED_NAMES).Value))
                {
                    localizedProductNameChunk = HyperCatalog.Business.Chunk.GetByKey(SessionState.CurrentItem.Id, 1, SessionState.Culture.Code);
                }

                // Update item name and level name
                if (localizedProductNameChunk == null)
                {
                    lbItemName.Text = SessionState.CurrentItem.FullName;
                }
                else
                {
                    if (SessionState.CurrentItem.Sku != null && SessionState.CurrentItem.Sku.Length > 0)
                    {
                        lbItemName.Text = "[" + SessionState.CurrentItem.Sku + "] - " + localizedProductNameChunk.Text;
                    }
                    else
                    {
                        lbItemName.Text = localizedProductNameChunk.Text;
                    }
                }
                if (lbItemName.Text.Length > 50)
                {
                    lbItemName.Text = lbItemName.Text.Substring(0, 49) + "...";
                }
                if (SessionState.CurrentItem.IsRoll)
                {
                    lbItemName.Text = "<img src='/hc_v4/img/ed_roll.gif'> " + lbItemName.Text;
                }

                itemLevelName = SessionState.CurrentItem.Level.Name;
                string url1, url2;
                if (SessionState.CurrentItem.IsRoll) // item is roll
                {
                    // Add tabs (original and roll)
                    url1 = "QDE_Forms.aspx?i=" + SessionState.CurrentItem.RefItemId;
                    url2 = "QDE_Forms.aspx?i=" + SessionState.CurrentItem.Id;
                    if (SessionState.Culture.Type == CultureType.Locale && !SessionState.CurrentItem.IsCountrySpecific)
                    {
                        url1 = "QDE_CountryViewMain.aspx?i=" + SessionState.CurrentItem.RefItemId + "&c=" + SessionState.Culture.Code;
                        url2 = "QDE_CountryViewMain.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code;
                    }
                    AddTab("Original", "Original item", "tb_ori", "/hc_v4/img/ed_content.gif", url1);
                    AddTab("Roll", "Roll item", "tb_roll", "/hc_v4/img/ed_roll.gif", url2);

                    webTab.SelectedTabIndex = 1; // roll is selected
                }
                else // item is original
                {
                    // Add tabs (original and roll)
                    url1 = "QDE_Forms.aspx?i=" + SessionState.CurrentItem.Id;
                    url2 = "QDE_Forms.aspx?i=" + itemRoll.Id;
                    if (SessionState.Culture.Type == CultureType.Locale && !SessionState.CurrentItem.IsCountrySpecific)
                    {
                        url1 = "QDE_CountryViewMain.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code;
                        url2 = "QDE_CountryViewMain.aspx?i=" + itemRoll.Id + "&c=" + SessionState.Culture.Code;
                    }
                    AddTab("Original", "Original item", "tb_ori", "/hc_v4/img/ed_content.gif", url1);
                    AddTab("Roll", "Roll item", "tb_roll", "/hc_v4/img/ed_roll.gif", url2);
                    webTab.SelectedTabIndex = 0; // original is selected
                }
            }
            finally
            {
                if (localizedProductNameChunk != null)
                {
                    localizedProductNameChunk.Dispose();
                }
            }
        }