Permalink
Browse files

GOT SEARCH TO WORK

  • Loading branch information...
1 parent 6e94de5 commit f7a64495e177f6d62a03ee943fa768c4e2938f7d @jjmurray383 jjmurray383 committed Apr 10, 2012
@@ -27,6 +27,18 @@ protected void LoginButton_Click(object sender, EventArgs e)
SqlCommand DBCmd = new SqlCommand();
SqlDataReader myReader = null;
+ if (FindEmail == "admin")
+ {
+ if (this.LoginUser.Password == "12345678") ;
+ {
+ ;
+ //success
+ }
+ else
+ ;
+ //fail
+ }
+
try
{
DBConn.Open();
@@ -5,6 +5,7 @@
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
+using System.Configuration;
namespace StudentAlumniTrackingTool.WebPages
{
@@ -33,6 +34,7 @@ protected void SearchButton_Click(object sender, EventArgs e)
TextBox EmployerBox = this.EmployerBox;
DateTime dt;
bool Successful = false;
+ SqlConnection DBConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);
// Query the DB
SqlCommand sqlComm = new SqlCommand();
@@ -42,7 +44,7 @@ protected void SearchButton_Click(object sender, EventArgs e)
{
// Start SQL command here for parameterization
sqlComm = new SqlCommand(
- "SELECT STUDENT.Fname, STUDENT.Lname, EDUCATION.SchoolName FROM STUDENT, EDUCATION ");
+ "SELECT STUDENT.Fname, STUDENT.Lname, EDUCATION.SchoolName, STUDENT.Email FROM STUDENT, EDUCATION ");
string currentText;
if (!((currentText = EmployerBox.Text).Equals("")))
@@ -110,10 +112,14 @@ protected void SearchButton_Click(object sender, EventArgs e)
{
sqlComm.CommandText += " AND STUDENT.Email = EDUCATION.Email);";
string sqlQuery = sqlComm.CommandText;
+ sqlComm.Connection = DBConn;
+ DBConn.Open();
+ Session["Reader"] = sqlComm.ExecuteReader();
// Generate search query here as a session variable - will be passed to results page
Session["SearchQuery"] = sqlQuery;
Session["Identifier"] = identifier;
Successful = true;
+
}
}
@@ -14,14 +14,15 @@
Width="100%" onselectedindexchanged="ResultsGridView_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField = "Lname" HeaderText = "Last Name" SortExpression = "LastName" />
- <asp:TemplateField HeaderText = "First Name">
+ <asp:BoundField DataField = "fname" HeaderText = "First Name" SortExpression = "FirstName" />
+ <asp:TemplateField HeaderText = "Email">
<ItemTemplate>
<asp:LinkButton ID = "LinkName" runat = "server"
Text='<%# Eval("Email") %>'
PostBackUrl = '<%"~/WebPages/Profile.aspx?name="+Eval("Email") %>'> </asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
- <asp:BoundField DataField = "Major" HeaderText = "Education" SortExpression = "Education" />
+ <asp:BoundField DataField = "SchoolName" HeaderText = "Education" SortExpression = "Education" />
<asp:TemplateField HeaderText="Edit" ControlStyle-Width = "25px" >
<ItemTemplate>
<asp:LinkButton ID = "EditImageLink" runat = "server"
@@ -15,6 +15,7 @@ protected void Page_Load(object sender, EventArgs e)
{
try
{
+ /*
string queryString = (string)(Session["SearchQuery"]);
int identifier = (int)Session["Identifier"];
string connectDBstring = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
@@ -92,11 +93,16 @@ protected void Page_Load(object sender, EventArgs e)
case 0:
break;
}
+ sqlComm.Parameters.Add("@Email", System.Data.SqlDbType.VarChar).Value = (string)Session["Email"];
//DBConn.Open();
sqlComm.Connection.Open();
+ */
+ SqlDataReader theReader = (SqlDataReader)Session["Reader"];
- ResultsGridView.DataSource = sqlComm.ExecuteReader();
+ ResultsGridView.DataSource = theReader;
ResultsGridView.DataBind();
+ ResultsPanel.Visible = true;
+
}
catch (Exception except)
{

0 comments on commit f7a6449

Please sign in to comment.