protected void BtnSowUsers_Click(object sender, EventArgs e) { List <User> Users = new List <User>(); SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["Connectionstring"].ToString()); SqlCommand cmd = new SqlCommand("select userpk,enterpriseid,firstname,lastname from del_user", con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { User usr = new User(); usr.Id = System.Convert.ToInt16(rdr["Userpk"].ToString()); usr.EnertpriseId = rdr["enterpriseid"].ToString(); usr.FirstName = rdr["firstname"].ToString(); usr.Lastname = rdr["lastname"].ToString(); Users.Add(usr); } } GrdUsers.DataSource = Users; GrdUsers.DataBind(); }
public void BindUsers() { try { Global ObjUser = new Global(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); DataView dv = new DataView(); ds = ObjUser.GetTopUserFront(); if (ds.Tables[0].Rows.Count > 0) { GrdUsers.Visible = true; dt = ds.Tables[0]; dv = dt.DefaultView; if ((SortExpression != string.Empty) && (SortDirection != string.Empty)) { dv.Sort = SortExpression + " " + SortDirection; } GrdUsers.DataSource = dv; GrdUsers.DataBind(); Utility.Setserial(GrdUsers, "srno"); lblNoUser.Visible = false; lnkUser.Visible = true; } else { lblNoUser.Visible = true; GrdUsers.Visible = false; lnkUser.Visible = false; } } catch { } }
/* Bind User function is use to bind all users to grid */ public void BindUsers() { Global ObjUser = new Global(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); DataView dv = new DataView(); ds = ObjUser.GetAllUserFront(Request.QueryString["SearchFor"].ToString(), Request.QueryString["SearchText"].ToString()); if (ds.Tables[0].Rows.Count > 0) { GrdUsers.Visible = true; dt = ds.Tables[0]; dv = dt.DefaultView; if ((SortExpression != string.Empty) && (SortDirection != string.Empty)) { dv.Sort = SortExpression + " " + SortDirection; } GrdUsers.DataSource = dv; GrdUsers.DataBind(); CheckAll(); check(); Utility.Setserial(GrdUsers, "srno"); btnDelete.Visible = true; divsearch.Visible = true; btnImport.Visible = true; btnExport.Visible = true; if (Convert.ToInt32(Session["AdminUserType"].ToString()) != 1) { btnDelete.Visible = true; } else { btnDelete.Visible = false; } } else { if ((Convert.ToInt32(ddlSearch.SelectedIndex) > 0) && (txtSearch.Text != "")) { txtSearch.Text = ""; ddlSearch.SelectedIndex = 0; lnkNorec.Visible = true; //btnAdd.Visible = false; btnImport.Visible = false; btnExport.Visible = false; ErrorMessage("Sorry, No records found."); } divsearch.Visible = false; GrdUsers.Visible = false; btnDelete.Visible = false; lnkNorec.Visible = true; //btnAdd.Visible = false; btnImport.Visible = false; btnExport.Visible = false; btnExpo.Visible = false; ErrorMessage("Sorry, No records found."); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GrdUsers.DataSource = users.GetAllRecords(); GrdUsers.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { SampleDataContext Users = new SampleDataContext(); GrdUsers.DataSource = from user in Users.Del_Users where user.UserPK < 25 orderby user.FirstName descending select new { user.UserPK, user.EnterpriseID, user.FirstName, user.LastName }; GrdUsers.DataBind(); }
/* Bind User function is use to bind all users to grid */ public void BindGroomers() { Groomer ObjGroomer = new Groomer(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); DataView dv = new DataView(); ds = ObjGroomer.GetAllGroomers(Request.QueryString["SearchFor"].ToString(), Request.QueryString["SearchText"].ToString()); if (ds.Tables[0].Rows.Count > 0) { GrdUsers.Visible = true; dt = ds.Tables[0]; dv = dt.DefaultView; if ((SortExpression != string.Empty) && (SortDirection != string.Empty)) { dv.Sort = SortExpression + " " + SortDirection; } GrdUsers.DataSource = dv; GrdUsers.DataBind(); Utility.Setserial(GrdUsers, "srno"); divsearch.Visible = true; } else { if ((Convert.ToInt32(ddlSearch.SelectedIndex) > 0) && (txtSearch.Text != "")) { txtSearch.Text = ""; ddlSearch.SelectedIndex = 0; ErrorMessage("Sorry, No records found."); } divsearch.Visible = false; GrdUsers.Visible = false; //btnAdd.Visible = false; ErrorMessage("Sorry, No records found."); } }
private void BindGridUsers() { GrdUsers.DataSource = null; GrdUsers.DataBind(); if (Session[_FilterSessionName] != null) { var DictionarySession = (Dictionary <string, object>)Session[_FilterSessionName]; if (DictionarySession.Count != 0) { DListFilterOrganizations.SelectedValue = DictionarySession["OrganizationsID"]._ToString(); TxtFilterFullname.Text = DictionarySession["Fullname"]._ToString(); TxtFilterDocNumber.Text = DictionarySession["DocumentNumber"]._ToString(); TxtFilterPin.Text = DictionarySession["PIN"]._ToString(); DListFilterDocType.SelectedValue = DictionarySession["DocumentsTypesID"]._ToString(); } } TxtFilterFullname.Text = TxtFilterFullname.Text.ToUpper(); TxtFilterPin.Text = TxtFilterPin.Text.ToUpper(); var Dictionary = new Dictionary <string, object>() { { "OrganizationsID", int.Parse(DListFilterOrganizations.SelectedValue) }, { "Fullname(LIKE)", TxtFilterFullname.Text }, { "DocumentNumber", TxtFilterDocNumber.Text }, { "PIN", TxtFilterPin.Text }, { "DocumentsTypesID", int.Parse(DListFilterDocType.SelectedValue) } }; int PageNum; int RowNumber = 20; if (!int.TryParse(Config._GetQueryString("p"), out PageNum)) { PageNum = 1; } HdnPageNumber.Value = PageNum.ToString(); DALC.DataTableResult UsersList = DALC.GetUsers(Dictionary, PageNum, RowNumber); if (UsersList.Count == -1) { return; } if (UsersList.Dt.Rows.Count < 1 && PageNum > 1) { Config.RedirectURL(string.Format("/tools/users/?p={0}", PageNum - 1)); } LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", UsersList.Count); int Total_Count = UsersList.Count % RowNumber > 0 ? (UsersList.Count / RowNumber) + 1 : UsersList.Count / RowNumber; HdnTotalCount.Value = Total_Count.ToString(); PnlPager.Visible = UsersList.Count > RowNumber; GrdUsers.DataSource = UsersList.Dt; GrdUsers.DataBind(); }
public void BindGroomersAppointmentByDate(DateTime dt) { Groomer ObjGroomer = new Groomer(); DataSet ds = new DataSet(); DataTable dt1 = new DataTable(); DataView dv = new DataView(); try { #region BindApp Session["CalenderDateSelected"] = dt; ds = ObjGroomer.GetGroomersTodaysAppointmentByDate(dt); if (ds.Tables[0].Rows.Count > 0) { GrdUsers.Visible = true; dt1 = ds.Tables[0]; dv = dt1.DefaultView; dv.Sort = "Name ASC,AppointmentDate ASC,ExpPetTime ASC,SequenceNo ASC"; if ((SortExpression != string.Empty) && (SortDirection != string.Empty)) { if ((SortExpression == "Name") && (SortDirection == "ASC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "SequenceNo ASC"; } if ((SortExpression == "Name") && (SortDirection == "DESC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "SequenceNo Asc"; } if ((SortExpression == "AppointmentDate") && (SortDirection == "ASC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "SequenceNo ASC"; } if ((SortExpression == "AppointmentDate") && (SortDirection == "DESC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "SequenceNo Asc"; } if ((SortExpression == "SequenceNo") && (SortDirection == "ASC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "Name ASC"; } if ((SortExpression == "SequenceNo") && (SortDirection == "DESC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "Name ASC"; } if ((SortExpression == "ExpPetTime") && (SortDirection == "ASC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "Name ASC"; } if ((SortExpression == "ExpPetTime") && (SortDirection == "DESC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "Name ASC"; } } divError.Visible = false; GrdUsers.DataSource = dv; GrdUsers.DataBind(); CheckAll(); check(); } else { GrdUsers.Visible = false; ErrorMessage("Sorry, No appointment scheduled for " + dt.ToString("MM'/'dd'/'yy")); } #endregion BindApp } catch (Exception ex) { ErrorMessage("Error: " + ex); } }
/* Bind User function is use to bind all users to grid */ public void BindGroomersAppointment() { Groomer ObjGroomer = new Groomer(); DataSet ds = new DataSet(); DataTable dt1 = new DataTable(); DataView dv = new DataView(); DateTime TodaysDate = System.DateTime.Now; DateTime olddate = Convert.ToDateTime("01/01/0001"); ds = ObjGroomer.GetGroomersTodaysAppointment(); if (ds.Tables[0].Rows.Count > 0) { GrdUsers.Visible = true; dt1 = ds.Tables[0]; dv = dt1.DefaultView; dv.Sort = "Name ASC,AppointmentDate ASC,ExpPetTime ASC,SequenceNo ASC"; if ((SortExpression != string.Empty) && (SortDirection != string.Empty)) { if ((SortExpression == "Name") && (SortDirection == "ASC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "SequenceNo ASC"; } if ((SortExpression == "Name") && (SortDirection == "DESC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "SequenceNo Asc"; } if ((SortExpression == "AppointmentDate") && (SortDirection == "ASC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "SequenceNo ASC"; } if ((SortExpression == "AppointmentDate") && (SortDirection == "DESC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "SequenceNo Asc"; } if ((SortExpression == "SequenceNo") && (SortDirection == "ASC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "Name ASC"; } if ((SortExpression == "SequenceNo") && (SortDirection == "DESC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "Name ASC"; } if ((SortExpression == "ExpPetTime") && (SortDirection == "ASC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "Name ASC"; } if ((SortExpression == "ExpPetTime") && (SortDirection == "DESC")) { dv.Sort = SortExpression + " " + SortDirection + "," + "Name ASC"; } } GrdUsers.DataSource = dv; GrdUsers.DataBind(); CheckAll(); check(); } else { GrdUsers.Visible = false; ErrorMessage("Sorry, No appointment scheduled for today"); } }
protected void GrdUsers_PageIndexChanging(object sender, GridViewPageEventArgs e) { GrdUsers.PageIndex = e.NewPageIndex; GrdUsers.DataSource = users.GetAllRecords(); GrdUsers.DataBind(); }
void BindGrid() { GrdUsers.DataSource = DALC.GetOmbudsmanUsers(TxtFullnameFilter.Text); GrdUsers.DataBind(); }