private void RetrieveSkuLevel()
    {
        ItemLevelList levels = ItemLevel.GetAll();

        foreach (ItemLevel l in levels)
        {
            if (l.SkuLevel)
            {
                SKuLevelId = l.Id;
                break;
            }
        }
    }
Esempio n. 2
0
 private void RetrieveSkuLevel()
 {
     using (ItemLevelList levels = ItemLevel.GetAll())
     {
         foreach (ItemLevel l in levels)
         {
             if (l.SkuLevel)
             {
                 SkuLevel = l.Id;
                 break;
             }
         }
     }
 }
    private void UpdateDataEdit()
    {
        // Retrieve sku level if it exists$
        ItemLevelList list     = ItemLevel.GetAll();
        ItemLevel     skuLevel = null;

        foreach (ItemLevel l in list)
        {
            if (l.SkuLevel)
            {
                skuLevel = l;
                break;
            }
        }

        ItemLevel level = ItemLevel.GetByKey(levelId);

        if (level != null)
        {
            // *************************************************************************
            // Display the itemLevel
            // *************************************************************************
            txtLevelId.Text    = level.Id.ToString();
            txtLevelName.Text  = level.Name;
            cbOptional.Checked = level.Optional;
            cbSkuLevel.Checked = level.SkuLevel;
            txtExportName.Text = level.LevelExportName;

            cbSkuLevel.Enabled = (skuLevel == null || skuLevel.Id == level.Id);
            txtLevelId.Enabled = false;
            panelId.Visible    = true;
        }
        else
        {
            // *************************************************************************
            // Provide an empty screen to create a new Role
            // *************************************************************************
            panelId.Visible    = false;
            cbSkuLevel.Enabled = (skuLevel == null);

            UITools.HideToolBarButton(uwToolbar, "Delete");
            UITools.HideToolBarSeparator(uwToolbar, "DeleteSep");
        }
        Page.DataBind();
    }
Esempio n. 4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (SessionState.User.HasCapability(CapabilitiesEnum.ATTACH_INPUT_FORMS) ||
                SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_CARTOGRAPHY) ||
                SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_ITEMS) ||
                SessionState.User.HasCapability(CapabilitiesEnum.DISPLAY_ITEMS))
            {
                try
                {
                    itemObj = QDEUtils.GetItemIdFromRequest();
                    itemId  = itemObj.Id;
                }
                catch
                {
                    throw new ArgumentException("Item Id was not provided");
                }

                // List of level
                listLevel = new ItemLevelList();
                using (ItemLevelList itemLevelAll = ItemLevel.GetAll())
                {
                    foreach (ItemLevel i in itemLevelAll)
                    {
                        if (i.Id > 0)
                        {
                            listLevel.Add(i);
                        }
                    }
                }
                levelCount = listLevel.Count;

                if (!Page.IsPostBack)
                {
                    // Get applicable level list
                    ddlLevels.Items.Insert(0, new ListItem("-->Choose a level<--", "0"));
                    int l = 0;
                    for (int i = 1; i <= listLevel.Count - 1; i++)
                    {
                        if (listLevel[i].Id >= itemObj.LevelId)
                        {
                            l++;
                            ddlLevels.Items.Insert(l, new ListItem("[" + listLevel[i].Id.ToString() + "] " + listLevel[i].Name.ToString(), listLevel[i].Id.ToString()));
                        }
                    }
                    ddlLevels.Attributes.Add("onChange", "if (this.value=='0') return false;");

                    // Add Level Columns to grid
                    int totalWidth = 0;
                    foreach (HyperCatalog.Business.ItemLevel lev in listLevel)
                    {
                        Infragistics.WebUI.UltraWebGrid.UltraGridColumn levCol = new UltraGridColumn("L" + lev.Id.ToString(), lev.Id.ToString(), ColumnType.NotSet, null);
                        levCol.Width          = Unit.Pixel(25);
                        levCol.BaseColumnName = levCol.Key;
                        dg.Bands[0].Columns.Add(levCol);
                        totalWidth += 25;
                    }
                    int width = totalWidth;
                    AppLevelTitle.Width = width.ToString();
                    AppLevelTitle.DataBind();

                    // Move column "delete" in last position
                    dg.Bands[0].Columns.FromKey("Action").Move(dg.Bands[0].Columns.Count - 1);

                    // Update Grid
                    UpdateDataView();

                    cbInputForms.Enabled = false;
                    uwToolBar.Items.FromKeyButton("add").Enabled      = false;
                    uwToolBar.Items.FromKeyButton("applyAll").Enabled = false;
                }

                if (!SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_CARTOGRAPHY) && !SessionState.User.HasCapability(CapabilitiesEnum.ATTACH_INPUT_FORMS))
                {
                    ddlLevels.Enabled    = false;
                    cbInputForms.Enabled = false;
                    uwToolBar.Items.FromKeyButton("add").Enabled      = false;
                    uwToolBar.Items.FromKeyButton("applyAll").Enabled = false;
                }
            }
            else
            {
                UITools.DenyAccess(DenyMode.Popup);
            }
        }
Esempio n. 5
0
    private void InitTreeView()
    {
        using (dbObj = Utils.GetMainDB())
        {
            using (ds = dbObj.RunSPReturnDataSet("dbo.QDE_GetTV", "",
                                                 new SqlParameter("@UserId", SessionState.TVAllItems ? -1 : SessionState.User.Id),
                                                 new SqlParameter("@CultureCode", HyperCatalog.Shared.SessionState.Culture.Code),
                                                 new SqlParameter("@ParentId", -1),
                                                 new SqlParameter("@RetrieveItemInfo", 0),
                                                 new SqlParameter("@RetrieveObsolete", SessionState.User.ViewObsoletes),
                                                 new SqlParameter("@RetrieveCultureItemNames", (bool)SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_TRANSLATED_NAMES).Value),
                                                 new SqlParameter("@ReadOnly", SessionState.TVAllItems),
                                                 new SqlParameter("@Company", SessionState.CompanyName)
                                                 ))
            {
                dbObj.CloseConnection();
                if (dbObj.LastError != string.Empty)
                {
                    Debug.Trace("PRISM.UI", dbObj.LastError, DebugSeverity.High);
                }

                try
                {
                    ds.Relations.Add("ItemChilds", ds.Tables[0].Columns["ItemId"], ds.Tables[1].Columns["ParentId"], false);
                }
                catch (System.Exception x)
                {
                    Response.Write("step1->" + x.Message);
                    Response.End();
                }
                try
                {
                    webTree.DataSource                = ds.Tables[0].DefaultView;
                    webTree.Levels[0].RelationName    = "ItemChilds";
                    webTree.Levels[0].ColumnName      = "ItemName";
                    webTree.Levels[0].LevelKeyField   = "ItemId";
                    webTree.Levels[0].TargetFrameName = "IsProject";
                    webTree.Levels[0].ImageColumnName = "Icon";
                    using (ItemLevelList itemLevelAll = ItemLevel.GetAll())
                    {
                        int maxLevels = itemLevelAll.Count + 1;
                        for (int i = 1; i < maxLevels; i++)
                        {
                            webTree.Levels[i].ColumnName      = "ItemName";
                            webTree.Levels[i].LevelKeyField   = "ItemId";
                            webTree.Levels[i].TargetFrameName = "IsProject";
                            webTree.Levels[i].ImageColumnName = "ItemTypeId";
                            webTree.Levels[i].TargetUrlName   = "IsTopValue"; // Used for TopValue
                        }
                    }
                    webTree.DataMember = ds.Tables[0].TableName;
                    webTree.DataBind();
                    ds.Dispose();
                    webTree.Nodes[0].Expanded = true;
                    if (SessionState.TVAllItems)
                    {
                        webTree.Nodes[0].Tag = 0;
                    }
                }
                catch (System.Exception x)
                {
                    Response.Write("step2->" + x.ToString());
                    Response.End();
                }
            }
        }
    }
    private void InitTreeView()
    {
        lbError.Visible = false;
        bool showObsolete;
        bool level1Flag;

        if (bLinkFrom) //Adding companion, so considering the correct checked state of Include Obsolete checkbox
        {
            CheckBox cb = (CheckBox)uwToolbar.Items.FromKeyCustom("chkObs").FindControl("chkObsolete");
            showObsolete = cb.Checked;
        }
        else
        {
            showObsolete = true;  //Adding Host, so by default including Obsolete Items
        }

        if (Ultrawebtoolbar2.Items.FromKeyCustom("LoadLevel1").Visible)
        {
            CheckBox checkLoad = (CheckBox)Ultrawebtoolbar2.Items.FromKeyCustom("LoadLevel1").FindControl("chkLoad");
            level1Flag = checkLoad.Checked;
        }
        else
        {
            level1Flag = false;
        }

        // get possible links
        //ds = Link.GetTreeView(linkTypeId, Convert.ToByte(bLinkFrom), SessionState.Culture.Code, -1, itemId, Convert.ToByte(showObsolete), Convert.ToByte(level1Flag));
        //Added by venkata 06/10/16
        ds = GetTreeView(linkTypeId, Convert.ToByte(bLinkFrom), SessionState.Culture.Code, -1, itemId, Convert.ToByte(showObsolete), Convert.ToByte(level1Flag));
        //end

        if (ds == null || ds.Tables.Count == 0)
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = "Error in retrieving the Dataset";
            lbError.Visible  = true;

            return;
        }

        if (ds.Tables.Count > 1) // two tables (root and children)
        {
            // Add relation (between itemId and parentId)
            try
            {
                ds.Relations.Add("ItemChilds", ds.Tables[0].Columns["ItemId"], ds.Tables[1].Columns["ParentId"], false);
            }
            catch (System.Exception x)
            {
                lbError.CssClass = "hc_error";
                lbError.Text     = x.Message;
                lbError.Visible  = true;

                return;
            }

            // Update treeview
            try
            {
                webTree.DataSource                = ds.Tables[0].DefaultView;
                webTree.Levels[0].RelationName    = "ItemChilds";
                webTree.Levels[0].ColumnName      = "ItemName";
                webTree.Levels[0].LevelKeyField   = "ItemId";
                webTree.Levels[0].TargetFrameName = "ItemName";
                using (ItemLevelList itemLevelAll = ItemLevel.GetAll())
                {
                    int maxLevels = itemLevelAll.Count + 1;
                    for (int i = 1; i < maxLevels; i++)
                    {
                        webTree.Levels[i].ColumnName      = "ItemName";
                        webTree.Levels[i].LevelKeyField   = "ItemId";
                        webTree.Levels[i].TargetFrameName = "ItemName";
                    }
                }

                webTree.DataMember = ds.Tables[0].TableName;
                webTree.DataBind();
                webTree.Nodes[0].Expanded = true;
            }
            catch (System.Exception x)
            {
                lbError.CssClass = "hc_error";
                lbError.Text     = x.Message;
                lbError.Visible  = true;

                return;
            }
            finally
            {
                if (ds != null)
                {
                    ds.Dispose();
                }
            }
        }
        else
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = "No candidates";
            lbError.Visible  = true;
        }
    }