Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region Common
        if (User.IsInRole("CGAdmin"))
        {
            sqlParamSrh[3].Value = "CGAdmin";
        }
        else if (User.IsInRole("CCAdmin"))
        {
            sqlParamSrh[3].Value = "CCAdmin";
        }
        else if (User.IsInRole("Super Admin"))
        {
            sqlParamSrh[3].Value = "Super Admin";
        }
        else
        {
            sqlParamSrh[3].Value = "";
        }

        sqlParamSrh[1].Value = ddlSearch.SelectedValue.ToString();
        sqlParamSrh[2].Value = txtSearch.Text.Trim();
        sqlParamSrh[4].Value = int.Parse(rdoboth.SelectedValue);
        #endregion Common
        lblMessage.Text = "";
        #region not Postback
        if (!Page.IsPostBack)
        {
            hdnEditType.Value    = "Add";
            imgBtnUpdate.Visible = false;
            //Filling Countries to grid of calling BindDataGrid of CommonClass
            objCommonClass.BindUserRegion(ddlRegion);
            objCommonClass.BindProductDivisionForUser(ddlProductDivision);
            objCommonClass.BindState(ddlState, 1);
            if (User.IsInRole("CGAdmin"))
            {
                objCommonClass.BindUserType(ddlUserType, "CGAdmin");
            }
            else if (User.IsInRole("CCAdmin"))
            {
                objCommonClass.BindUserType(ddlUserType, "CCAdmin");
            }
            else if (User.IsInRole("Super Admin"))
            {
                objCommonClass.BindUserType(ddlUserType, "Super Admin");
            }
            else
            {
                objCommonClass.BindUserType(ddlUserType, "");
            }
            objCommonClass.BindDataGrid(gvShowUser, "uspEditUserAndRoleMaster", true, sqlParamSrh, lblRowCount);
            ViewState["Column"] = "Name";
            ViewState["Order"]  = "ASC";
            if (User.IsInRole("CGAdmin"))
            {
                trPassword.Visible    = false;
                trConPassword.Visible = false;
            }
            else
            {
                trPassword.Visible    = true;
                trConPassword.Visible = true;
            }
        }
        #endregion not Postback
        System.Threading.Thread.Sleep(int.Parse(ConfigurationManager.AppSettings["AjaxPleaseWaitTime"]));
    }