protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             if (Utility.CheckAccess("RoleDetailsAddEdit") == false)
             {
                 pnlInvalid.Visible = true;
                 MainDiv.Visible    = false;
             }
             if (!Convert.ToBoolean(Session[clsConstant.SESS_VIEWTYPE]))
             {
                 this.MakeReadOnly(this.Controls);
             }
         }
         string sRoleID = Request.QueryString["roleid"];
         if (sRoleID != null)
         {
             if (!IsPostBack)
             {
                 clsEntRolesDetails objEnt = objRole.readerForRoles(int.Parse(sRoleID));
                 fillControl(objEnt);
             }
         }
         else
         {
             btnUpdate.Visible = false;
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex);
     }
 }
 private void fillControl(clsEntRolesDetails objEnt)
 {
     if (objEnt.RoleId > 0)
     {
         btnSubmit.Visible   = false;
         btnUpdate.Visible   = true;
         lblRoleID.Text      = objEnt.RoleId.ToString();
         txtRoleName.Text    = objEnt.RoleName;
         txtDescription.Text = objEnt.RoleDesc;
     }
     else
     {
         btnSubmit.Visible = true;
     }
 }
Example #3
0
    public clsEntRolesDetails readerForRoles(int roleID = 0, string roleName = "")
    {
        clsEntRolesDetails objEnt = new clsEntRolesDetails();
        SqlDataReader      reader;

        if (objDataAccess.Connection.State == ConnectionState.Closed)
        {
            objDataAccess.Connection.Open();
        }
        SqlParameter[] param = new SqlParameter[] { new SqlParameter("@RoleID", roleID), new SqlParameter("@RoleName", roleName) };
        reader = objDataAccess.ExecuteReaderQuery(clsConstant.SP_SELECT_ROLE_CHECK, CommandType.StoredProcedure, param);
        if (reader.Read())
        {
            objEnt.RoleId   = Convert.ToInt32(reader.GetValue(0));
            objEnt.RoleName = reader.GetValue(1).ToString();
            objEnt.RoleDesc = reader.GetValue(2).ToString();
        }
        return(objEnt);
    }
        protected void txtRoleName_TextChanged(object sender, EventArgs e)
        {
            clsEntRolesDetails objEnt = objRole.readerForRoles(0, txtRoleName.Text);

            fillControl(objEnt);
        }