protected void ButtonLogin_Click(object sender, EventArgs e) { System.Data.DataView dv; SDS_Customer.Select(DataSourceSelectArguments.Empty); dv = (System.Data.DataView)SDS_Customer.Select(DataSourceSelectArguments.Empty); System.Data.DataRow dr; dr = dv.Table.Rows[0]; // go back SDS look SQL for array index values // match db email and password to form email and password if (dr.ItemArray[1].ToString().ToLower().Equals(TextBoxEmail.Text) && dr.ItemArray[2].ToString().ToLower().Equals(TextBoxPassword.Text)) { Session["CustomerID"] = dr.ItemArray[0]; LabelMessage.Text = "Welcome back " + dr.ItemArray[0].ToString(); if (CheckBoxRemember.Checked) { SetCookie(); } ButtonContinue.Visible = true; } else { LabelMessage.Text = "Login not found!"; ButtonContinue.Visible = false; } }
protected void ButtonCreate_Click(object sender, EventArgs e) { LabelMessage.Text = ""; try { if (Page.IsValid) { SDS_Customer.Insert(); //could textbox email - just try to showcase session variables Session["EmailAddress"] = TextBoxEmail.Text; Select_Customer(); // get the Reviewer ID and store it in a session variable SetCookie(); } else { LabelMessage.Text = "Page contains errors."; } LabelMessage.Text = TextBoxFirstName.Text + " " + TextBoxLastName.Text + " was created!"; } catch (System.Data.OleDb.OleDbException ex) { if (ex.ErrorCode == -2147467259) //Error for duplicate records { LabelMessage.Text = "Email Address already exists. / Error."; } else { LabelMessage.Text = "ERROR CREATING ACCOUNT: " + TextBoxFirstName.Text + " " + TextBoxLastName.Text + " was NOT created!"; } } }
protected void Select_Customer() { System.Data.DataView dv; SDS_Customer.Select(DataSourceSelectArguments.Empty); dv = (System.Data.DataView)SDS_Customer.Select(DataSourceSelectArguments.Empty); System.Data.DataRow dr; dr = dv.Table.Rows[0]; //could textbox email - just try to showcase session variables /*if (dr.ItemArray[6].ToString().ToLower().Equals(Session["EmailAddress"].ToString().ToLower()))*/ Session["CustomerID"] = dr.ItemArray[0]; }
protected void saveCustomerData(object sender, EventArgs e) { SDS_Customer.Insert(); }