Ejemplo n.º 1
0
        //Code Added for Links Requirement (PR658943) - to load the Level dropdown on 18th Dec 2012
        private void LoadLevelDDL()
        {
            int configLimit;

            using (LinkType linkType = HyperCatalog.Business.LinkType.GetByKey(linkTypeId))
            {
                configLimit = linkType.GetConfigLimit(itemId, Convert.ToByte(bLinkFrom));
            }
            Database dbObj;

            using (dbObj = Utils.GetMainDB())
            {
                using (DataSet ds = dbObj.RunSQLReturnDataSet("select LevelId, LevelName from dbo.ItemLevels where LevelId between " + configLimit + " and 7"))
                {
                    dbObj.CloseConnection();
                    ddlLevel.DataSource     = ds.Tables[0];
                    ddlLevel.DataTextField  = "LevelName";
                    ddlLevel.DataValueField = "LevelId";
                    ddlLevel.DataBind();
                }
            }
        }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        UITools.CheckConnection(Page);
        colErrorIndex = dg.Columns.FromKey("Error").Index;
        if (SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_LINKS))
        {
            RetrieveSkuLevel(); // Retrieve Id of the SKU level
            try
            {
                // get properties
                if (Request["f"] != null)
                {
                    bLinkFrom = Request["f"].ToString().Equals("1");
                }
                if (Request["f"] != null)
                {
                    linkTypeId = Convert.ToInt32(Request["t"]);
                }
                if (Request["f"] != null)
                {
                    itemId = Convert.ToInt64(Request["i"]);
                }

                //Code added for Links Requirement (PR658943) - to set the min and max date of Effective Date calendar by Prachi on 15th Jan 2013 - start
                dateValue.MinDate = SessionState.User.FormatUtcDate(DateTime.UtcNow);
                dateValue.MaxDate = SessionState.User.FormatUtcDate(DateTime.UtcNow).AddYears(dateValue.CalendarLayout.DropDownYearsNumber);
                //Code added for Links Requirement (PR658943) - to set the min and max date of Effective Date calendar by Prachi on 15th Jan 2013 - end

                if (linkTypeId > -1)
                {
                    using (LinkType linkType = HyperCatalog.Business.LinkType.GetByKey(linkTypeId))
                    {
                        isBidirectional = linkType.IsBidirectional;
                        configLimit     = linkType.GetConfigLimit(itemId, Convert.ToByte(bLinkFrom));
                    }
                    isItemObs = IsItemObsolete();
                }

                if (rblInput.SelectedValue.ToUpper().Equals("NAME"))
                {
                    ddlLevel.Enabled = true;
                    lbLevel.Enabled  = true;
                }
                else
                {
                    ddlLevel.Enabled = false;
                    lbLevel.Enabled  = false;
                }

                if (!Page.IsPostBack)
                {
                    if (Request["filter"] != null)
                    {
                        txtFilter.Text = Request["filter"].ToString();
                        if (Request["filter"].ToString().Trim() != string.Empty)
                        {
                            DisplaySearchResults();
                        }
                        else
                        {
                            UpdateDataView();
                        }
                    }
                    else
                    {
                        UpdateDataView();
                    }
                    //Code added for Links Requirement (PR658943) - to set today's date as Effective Date in the calendar by Prachi on 15th Jan 2013
                    dateValue.Value = SessionState.User.FormatUtcDate(DateTime.UtcNow);
                    LoadLevelDDL();

                    if (!bLinkFrom)  //Adding a Host; so disable the 'Include Obsolete' checkbox
                    {
                        CheckBox cb = (CheckBox)uwToolbar.Items.FromKeyCustom("chkObs").FindControl("chkObsolete");
                        cb.Enabled = false;
                    }

                    if (configLimit == 1) //If limit is Product Type, display the "Load from Level 1" checkbox
                    {
                        UITools.ShowToolBarSeparator(Ultrawebtoolbar2, "LoadSep");
                        Ultrawebtoolbar2.Items.FromKeyCustom("LoadLevel1").Visible = true;
                    }
                    else
                    {
                        UITools.HideToolBarSeparator(Ultrawebtoolbar2, "LoadSep");
                        Ultrawebtoolbar2.Items.FromKeyCustom("LoadLevel1").Visible = false;
                    }
                }
            }
            catch (FormatException fe)
            {
                UITools.DenyAccess(DenyMode.Popup);
            }
        }
        else
        {
            UITools.DenyAccess(DenyMode.Popup);
        }
    }