//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; } }
public void saveUpdate(int index) { BL.userAccountManagementAdminBL updateClass = new BL.userAccountManagementAdminBL(); string status = (GVUsers.Rows[index].FindControl("ddlStatus") as DropDownList).Text.Trim(); updateClass.updateUserStatus(index, GVUsers, status); GVUsers.EditIndex = -1; populateGV(); }
//redirect function protected void continueButtonFunc(object sender, EventArgs e) { //if (txbPassword.Text != txbRePassword.Text) if (compareStringFunc(txbPassword.Text, txbRePassword.Text) == false) { matchError.Visible = true; } else { matchError.Visible = false; } if (checkPassword(txbPassword.Text) == false) { lbPassVal.Visible = true; } else { lbPassVal.Visible = false; } if (IsValidEmail(txbUsername.Text) == false) { LbUsernamVal.Visible = true; } else { LbUsernamVal.Visible = false; } if (isValCodeInts(txbAdminCode.Text) == false) { //bxAdminCode.Visible = true; lbCodeVal.Visible = true; } else { lbCodeVal.Visible = false; } if (compareStringFunc(txbPassword.Text, txbRePassword.Text) && checkPassword(txbPassword.Text) && IsValidEmail(txbUsername.Text)) { BL.userAccountManagementAdminBL insertAdminClass = new BL.userAccountManagementAdminBL(); insertAdminClass.insertAdmin(txbAdminCode.Text, txbPassword.Text, txbUsername.Text); regoSuccess(); } }
protected void validationOnLoginBtn(object sender, EventArgs e) { LbUsernamVal.Visible = false; BL.userAccountManagementAdminBL adminLogin = new BL.userAccountManagementAdminBL(); if (adminLogin.loginAdmin(txbUsername.Text, txbPassword.Text)) { lblOutput.Text = "Successfully Logged In!"; lblOutput.Visible = true; } else { lblOutput.Text = "Error Logging In! Incorrect Username Or Password!"; lblOutput.Visible = true; } }
//only redirects if form data is valid, and form data matches the hardcoded values in this page protected void setToTYPage(object sender, EventArgs e) { BL.userAccountManagementAdminBL Uam = new BL.userAccountManagementAdminBL(); if (Uam.loginUser(textBoxEmail.Text, textBoxPassword.Text)) { labelError.Visible = true; labelError.Text = "login success!"; } else { //this was a test Response.Redirect("RegistrationPage.aspx"); } // If the page is valid and the data matches, go to success page //if ((Page.IsValid) && IsMatching()) //{ // Response.Redirect("sucessLogin.aspx"); //} }
protected void validationOnLoginBtn(object sender, EventArgs e) { if (IsValidEmail(txbUsername.Text) == false) { LbUsernamVal.Visible = true; } else { LbUsernamVal.Visible = false; BL.userAccountManagementAdminBL Uam = new BL.userAccountManagementAdminBL(); if (Uam.loginUser(txbUsername.Text, txbPassword.Text)) { btnLogin.Text = "logout"; } else { btnLogin.Text = "error"; } } }