public void FilterResults(Object sender, EventArgs a) { dbProcedures db = new dbProcedures(); try { System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("SELECT * FROM tbl_Members WHERE Firstname + ' ' + LastName like '%" + txtEmployeeName.Text + "%' AND EmployerGroup like '%" + ddlEmployerGroup.SelectedValue + "%' ORDER BY Username", new db().SqlConnection); sqlCmd.CommandType = System.Data.CommandType.Text; System.Data.DataTable loadReaderdata = new System.Data.DataTable(); loadReaderdata.Load(sqlCmd.ExecuteReader()); GridView1.DataSource = loadReaderdata; GridView1.DataBind(); } catch (Exception ex) { db.LogAction("", "Error", "Error loading Members UI page. " + ex.Message.ToString()); } db.Close(); }
public void MemberSearch(string strUsername) { dbProcedures db = new dbProcedures(); try { System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("SELECT * FROM tbl_Members WHERE Username like '%" + strUsername + "%' ORDER BY Username", new db().SqlConnection); sqlCmd.CommandType = System.Data.CommandType.Text; System.Data.DataTable loadReaderdata = new System.Data.DataTable(); loadReaderdata.Load(sqlCmd.ExecuteReader()); GridView1.DataSource = loadReaderdata; GridView1.DataBind(); } catch (Exception ex) { db.LogAction("", "Error", "Error loading Members UI page. " + ex.Message.ToString()); } db.Close(); }
public void PopulateEmployerGroupDDL() { dbProcedures db = new dbProcedures(); try { System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("SELECT DISTINCT EmployerGroup FROM tbl_Members ORDER BY EmployerGroup", new db().SqlConnection); sqlCmd.CommandType = System.Data.CommandType.Text; System.Data.DataTable loadReaderdata = new System.Data.DataTable(); loadReaderdata.Load(sqlCmd.ExecuteReader()); ddlEmployerGroup.DataSource = loadReaderdata; ddlEmployerGroup.DataTextField = "EmployerGroup"; ddlEmployerGroup.DataValueField = "EmployerGroup"; ddlEmployerGroup.DataBind(); ddlEmployerGroup.Items.Insert(0, new ListItem("", "")); ddlEmployerGroup.SelectedIndex = 0; } catch (Exception ex) { db.LogAction("", "Error", "Error loading Members UI page. " + ex.Message.ToString()); } db.Close(); }
protected void btnDelete_Click(object sender, EventArgs e) { dbProcedures db = new dbProcedures(); db.DeleteMember(txtUsername.Text, txtCarrier.SelectedValue); db.LogAction(txtUsername.Text, "Information", "Deleted member: " + txtUsername.Text + " [" + txtCarrier.SelectedValue + "]"); db.Close(); Session["strMemberId"] = ""; Response.Redirect("~/Members.aspx"); }