Esempio n. 1
0
 //Grabs info from BL and populates the grid view on the page
 public void populateGV()
 {
     BL.userAccountManagementAdminBL AccClass = new BL.userAccountManagementAdminBL();
     if (AccClass.getUsers().Count > 0)
     {
         var userList = AccClass.getUsers();
         GVUsers.DataSource = userList;
         GVUsers.DataBind();
     }
     else
     {
         var userList = AccClass.getUsers();
         GVUsers.DataSource = userList;
         userList.Add(new DAL.Users()
         {
             UserID = 0, FirstName = "N/A", LastName = "N/A", StreetNo = "N/A", Street = "N/A", Suburb = "N/A", Postcode = "N/A", State = "N/A", Country = "N/A", Phone = "N/A", Password = "******", DateJoined = "N/A"
         });
         GVUsers.DataBind();
         userList.RemoveAt(0);
         GVUsers.Rows[0].Cells.Add(new TableCell());
         GVUsers.Rows[0].Cells[0].ColumnSpan      = GVUsers.Columns.Count;
         GVUsers.Rows[0].Cells[0].Text            = "No Data!";
         GVUsers.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     //Label3.Text = Session["username"].ToString();
     cmd             = new SqlCommand();
     cmd.Connection  = con;
     cmd.CommandText = "select * from userreg where roleid=2 and isActive=1";
     da = new SqlDataAdapter(cmd);
     ds = new DataSet();
     da.Fill(ds);
     GVUsers.DataSource = ds;
     GVUsers.DataBind();
 }
Esempio n. 3
0
        private void BindGrid()
        {
            string    query = "select courseId ,courses.courseName , stream.streamName from courses inner join stream on courses.streamid = Stream.StreamId";
            DataTable dt    = c.getData(query);

            GVUsers.DataSource = dt;
            GVUsers.DataBind();

            if (dt.Rows.Count == 0)
            {
                noInfoAlert.Visible = true;
                UsersTable.Visible  = false;
            }
            c.closeConn();
        }
Esempio n. 4
0
 protected void BindGrid()
 {
     check();
     MstObj.Dept   = Session["Department"].ToString();
     MstObj.Action = "R";
     dt            = MstDL.UserRegistration_IUDR(MstObj, con);
     if (dt.Rows.Count > 0)
     {
         GVUsers.DataSource = dt;
         GVUsers.DataBind();
     }
     else
     {
         GVUsers.DataSource = null;
         GVUsers.DataBind();
         ObjCommon.ShowAlertMessage("No Data");
     }
 }
Esempio n. 5
0
    protected void LBSearch_Click(object sender, EventArgs e)
    {
        try
        {
            SqlParameter[] arrParam = new SqlParameter[2];
            arrParam[0] = new SqlParameter("@Action", "SEARCH");
            arrParam[1] = new SqlParameter("@SearchText", TBSearch.Text);
            DataSet DSUser = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_Users_CRUD", arrParam);

            if (DSUser.Tables[0].Rows.Count > 0)
            {
                GVUsers.DataSource = DSUser.Tables[0];
                GVUsers.DataBind();
            }
            else
            {
                GVUsers.EmptyDataText = "No Record Found !";
                GVUsers.DataBind();
            }
            foreach (GridViewRow Row in GVUsers.Rows)
            {
                Label      lblStatus = (Label)Row.FindControl("lblStatus");
                LinkButton LBEdit    = (LinkButton)Row.FindControl("LBEdit");
                LinkButton LBDelete  = (LinkButton)Row.FindControl("LBDelete");
                if (lblStatus.Text == "Active")
                {
                    lblStatus.CssClass = "label label-success";
                    LBEdit.Enabled     = true;
                    LBDelete.Enabled   = true;
                }
                else
                {
                    lblStatus.CssClass = "label label-danger";
                    LBEdit.Enabled     = false;
                    LBDelete.Enabled   = false;
                }
            }
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, MessageType.Error);
        }
    }
        protected void UserGridview()
        {
            DataTable dtSysUsers = obj_TerrQut.GetSysUsers();

            //GVUsers.DataSource = dtSysUsers;
            GVUsers.DataSource = dtSysUsers;
            GVUsers.DataBind();
            GVUsers.MasterTableView.GetColumn("StatusID").Visible      = false;
            GVUsers.MasterTableView.GetColumn("DepartmentID").Visible  = false;
            GVUsers.MasterTableView.GetColumn("RoleID").Visible        = false;
            GVUsers.MasterTableView.GetColumn("ManagerID").Visible     = false;
            GVUsers.MasterTableView.GetColumn("DesignationID").Visible = false;
            GVUsers.MasterTableView.GetColumn("LOBID").Visible         = false;
            GVUsers.MasterTableView.GetColumn("SubDepID").Visible      = false;
            GVUsers.MasterTableView.GetColumn("DomainID").Visible      = false;
            GVUsers.MasterTableView.GetColumn("RegionID").Visible      = false;
            GVUsers.MasterTableView.GetColumn("UserID").Visible        = false;
            GVUsers.MasterTableView.GetColumn("Email").Visible         = false;
            GVUsers.MasterTableView.GetColumn("Password").Visible      = false;
            GVUsers.MasterTableView.GetColumn("Phone").Visible         = false;
        }
Esempio n. 7
0
 protected void GVUsers_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GVUsers.PageIndex = e.NewPageIndex;
     BindUserDetails();
     GVUsers.DataBind();
 }
Esempio n. 8
0
    private void BindUserDetails()
    {
        try
        {
            DataSet DSUser = new DataSet();
            switch (AbhiMethod.GetUserRole())
            {
            case "Super":
                SqlParameter[] arrParam = new SqlParameter[1];
                arrParam[0] = new SqlParameter("@Action", "SELECT");
                DSUser      = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_Users_CRUD", arrParam);
                break;

            case "ComLevel":
                SqlParameter[] arrParam1 = new SqlParameter[2];
                arrParam1[0] = new SqlParameter("@Action", "SELECT_ByComID");
                arrParam1[1] = new SqlParameter("@ComID", Session["ComID"]);
                DSUser       = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_Users_CRUD", arrParam1);
                break;

            case "NGOLevel":
                SqlParameter[] arrParam2 = new SqlParameter[3];
                arrParam2[0] = new SqlParameter("@Action", "SELECT_ByComIDNGOID");
                arrParam2[1] = new SqlParameter("@ComID", Session["ComID"]);
                arrParam2[2] = new SqlParameter("@NGOID", Session["NGOID"]);
                DSUser       = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_Users_CRUD", arrParam2);
                break;

            default:
                break;
            }

            if (DSUser.Tables[0].Rows.Count > 0)
            {
                GVUsers.DataSource = DSUser.Tables[0];
                GVUsers.DataBind();
            }
            else
            {
                GVUsers.EmptyDataText = "No Record Found !";
                GVUsers.DataBind();
            }
            foreach (GridViewRow Row in GVUsers.Rows)
            {
                Label      lblStatus = (Label)Row.FindControl("lblStatus");
                LinkButton LBEdit    = (LinkButton)Row.FindControl("LBEdit");
                LinkButton LBDelete  = (LinkButton)Row.FindControl("LBDelete");
                if (lblStatus.Text == "Active")
                {
                    lblStatus.CssClass = "label label-success";
                    LBEdit.Enabled     = true;
                    LBDelete.Enabled   = true;
                }
                else
                {
                    lblStatus.CssClass = "label label-danger";
                    LBEdit.Enabled     = false;
                    LBDelete.Enabled   = false;
                }
            }
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, MessageType.Error);
        }
    }