Exemplo n.º 1
0
        public void BindCorporate()
        {
            try
            {
                List <BALUser> lstcrop = new List <BALUser>();
                //ListItem lst = new ListItem();
                //lst.Value = "All";
                //lst.Text = "All";
                if (defaultPage.RoleID == 1)
                {
                    lstcrop = lclsservice.GetCorporateMaster().ToList();
                    drpcorsearch.DataSource     = lstcrop;
                    drpcorsearch.DataTextField  = "CorporateName";
                    drpcorsearch.DataValueField = "CorporateID";
                    drpcorsearch.DataBind();

                    //drpcorsearch.Items.Insert(0, lst);
                    //drpcorsearch.SelectedIndex = 0;
                }
                else
                {
                    lstcrop = lclsservice.GetCorporateFacilityByUserID(defaultPage.UserId).ToList();
                    drpcorsearch.DataSource     = lstcrop.Select(a => new { a.CorporateID, a.CorporateName }).Distinct();
                    drpcorsearch.DataTextField  = "CorporateName";
                    drpcorsearch.DataValueField = "CorporateID";
                    drpcorsearch.DataBind();
                    //ListItem lst = new ListItem();
                    //lst.Value = "0";
                    //lst.Text = "--Select Corporate--";
                    //drpcorsearch.Items.Insert(0, lst);
                    //drpcorsearch.SelectedIndex = 0;
                }

                foreach (ListItem lst in drpcorsearch.Items)
                {
                    lst.Attributes.Add("class", "selected");
                    lst.Selected = true;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.EndingInventoryErrorMessage.Replace("<<EndingInventory>>", ex.Message), true);
            }
        }
Exemplo n.º 2
0
        private void BindCorporateMaster()
        {
            drpcorp.DataSource     = lclsService.GetCorporateMaster().ToList();
            drpcorp.DataTextField  = "CorporateName";
            drpcorp.DataValueField = "CorporateID";
            drpcorp.DataBind();
            ListItem lst = new ListItem();

            lst.Value = "0";
            lst.Text  = "--Select Corporate--";
            drpcorp.Items.Insert(0, lst);
            drpcorp.SelectedIndex = 0;
        }
Exemplo n.º 3
0
        private void BindCorporateMaster()
        {
            BALUser lclsUser = new BALUser();

            lclsUser.UserName = Environment.UserName.ToString();
            DataSet ds = new DataSet();

            //ds = lclsService.GetUserCredentials(lclsUser);
            //if (ds.Tables.Count > 0)
            //{
            //    if (ds.Tables[0].Rows.Count > 0)
            //    {
            //        //DataTable dt = new DataTable();
            //        lclsUser.UserID = Convert.ToInt64(ds.Tables[0].Rows[0]["UserID"].ToString());
            //        lclsUser.UserRoleID = Convert.ToInt64(ds.Tables[0].Rows[0]["RoleID"].ToString());
            //    }

            //}
            //if (lclsUser.UserRoleID == 1)
            //{
            // Search Drop Down
            drpcorp.DataSource     = lclsService.GetCorporateMaster().ToList();
            drpcorp.DataTextField  = "CorporateName";
            drpcorp.DataValueField = "CorporateID";
            drpcorp.DataBind();
            //drpcorsearch.Items.Insert(0, lst);
            //drpcorsearch.SelectedIndex = 0;
            //}
            //else
            //{
            //    List<BALUser> lstfacility = new List<BALUser>();
            //    lstfacility = lclsService.GetCorporateFacilityByUserID(lclsUser.UserID).ToList();
            //    drpcorp.DataSource = lstfacility.Select(a => new { a.CorporateID, a.CorporateName }).Distinct();
            //    drpcorp.DataTextField = "CorporateName";
            //    drpcorp.DataValueField = "CorporateID";
            //    drpcorp.DataBind();

            //}
            ListItem lst = new ListItem();

            lst.Value = "0";
            lst.Text  = "--Select Corporate--";
            drpcorp.Items.Insert(0, lst);
            drpcorp.SelectedIndex = 0;
        }
Exemplo n.º 4
0
        public void BindCorporate()
        {
            try
            {
                List <BALUser> lstcorp = new List <BALUser>();
                lstcorp = lclsservice.GetCorporateMaster().ToList();
                drpcorsearch.DataSource     = lstcorp;
                drpcorsearch.DataTextField  = "CorporateName";
                drpcorsearch.DataValueField = "CorporateID";
                drpcorsearch.DataBind();

                foreach (ListItem lst in drpcorsearch.Items)
                {
                    lst.Attributes.Add("class", "selected");
                    lst.Selected = true;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ReportErrorMessage.Replace("<<Report>>", ex.Message), true);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Bind the Corporate details to dropdown control
        /// </summary>
        #region Bind Corporate Values
        public void BindCorporate()
        {
            try
            {
                List <BALUser> lstcrop = new List <BALUser>();

                if (defaultPage.RoleID == 1)
                {
                    lstcrop = lclsservice.GetCorporateMaster().ToList();
                    drpCorporate.DataSource     = lstcrop;
                    drpCorporate.DataTextField  = "CorporateName";
                    drpCorporate.DataValueField = "CorporateID";
                    drpCorporate.DataBind();
                    //ListItem lst = new ListItem();
                    //lst.Value = "0";
                    //lst.Text = "Select";
                    //drpCorporate.Items.Insert(0, lst);
                    //drpCorporate.SelectedIndex = 0;
                }
                else
                {
                    lstcrop = lclsservice.GetCorporateFacilityByUserID(defaultPage.UserId).ToList();
                    drpCorporate.DataSource     = lstcrop.Select(a => new { a.CorporateID, a.CorporateName }).Distinct().Where(a => a.CorporateID == defaultPage.CorporateID);
                    drpCorporate.DataTextField  = "CorporateName";
                    drpCorporate.DataValueField = "CorporateID";
                    drpCorporate.DataBind();
                    //ListItem lst = new ListItem();
                    //lst.Value = "0";
                    //lst.Text = "Select";
                    //drpCorporate.Items.Insert(0, lst);
                    //drpCorporate.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ServiceRequestPOErrorMessage.Replace("<<ServiceRequestPO>>", ex.Message.ToString()), true);
            }
        }