protected void btnUpdate_Click(object sender, EventArgs e) { Master.UserFeedBack.Text = "Your Account has been Updated"; Session["NewUser"] = false; string tempPath = Server.MapPath("~/App_Data/"); clsBusinessLayer myBusinessLayer = new clsBusinessLayer(tempPath); try { myBusinessLayer.UpdateUser(lblUsername.Text, lblCity.Text, lblState.Text, lblFavProgram.Text, lblLeastProgram.Text, lblDate.Text, Convert.ToInt32(lblUserID.Text)); Button1.Visible = false; } catch (Exception error) { string message = "Error updating user information, please check input values. "; Session["NewUser"] = true; Master.UserFeedBack.Text = message + error.Message; } }
/// BindCustomerGridView method // calls data layer to fetch customers & binds that to GridView private dsProgramaholics BindUserGridView() { // new path string tempPath = Server.MapPath("~/Programaholics.mdb"); clsDataLayer myDataLayer = new clsDataLayer(tempPath); // where the database is myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); // get all customers dsProgramaholics userListing = (dsProgramaholics)myBusinessLayer.GetPersonalStats(); // customer list's source is the table from the database gvStats.DataSource = userListing.tblUsers; // bind data to gridView & cache gvStats.DataBind(); Cache.Insert("UserDataSet", userListing); // return cache return(userListing); }
protected void btnSend_Click(object sender, EventArgs e) { // Because the SendMail method can through an exception, // we should place it in a try/catch block try { // Create our clsBusinessLayer object that will // send the message for us clsBusinessLayer sendObj = new clsBusinessLayer(); // Send the email using data from the form sendObj.SendEmail(txtFrom.Text, txtTo.Text, txtSubject.Text, txtMessage.Text); // Successful send - tell user lblSts.Text = "Status: The message was sent successfully to: " + txtFrom.Text; } catch (Exception ex) { // Error when sending - tell user lblSts.Text = "Status: An error has happened sending the email, " + ex.Message; } return; }
protected void btnCreate_Click(object sender, EventArgs e) { //Get Username Length int UsernameLength = txtUsername.Text.Length; //Get Password Length int PasswordLength = txtPassword.Text.Length; //Get Usernames from Database dsUsers dsFindUser; string tempPath = Server.MapPath("~/App_Data/"); clsBusinessLayer businessLayerObj = new clsBusinessLayer(tempPath); dsFindUser = businessLayerObj.FindUser(txtUsername.Text); //Check if username already exists if (dsFindUser.tblUsers.Rows.Count > 0) { Master.UserFeedBack.Text = "Username has already been used. Please try a different Username."; } //Check Username Length else if (UsernameLength < 5 || UsernameLength > 12) { Master.UserFeedBack.Text = "Username must be between 5 and 12 characters in length."; } //Check Password Length else if (PasswordLength < 6 || PasswordLength > 12) { Master.UserFeedBack.Text = "Passwords must be between 6 and 12 characters in length."; } else { Session["NewUser"] = true; Session["SessionUsername"] = txtUsername.Text; myBusinessLayer.InsertUser(txtUsername.Text, txtPassword.Text); Response.Redirect("~/pgUserDetails.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { objLogic = new clsBusinessLayer(); GridView1.DataSource = (DataTable)objLogic.LoadFlight(); GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); Master.UserFeedBack.Text = "Please enter username and password. If you are new to PA create an account."; }
protected void Page_Load(object sender, EventArgs e) { objLogic = new clsBusinessLayer(); DetailsView1.DataSource = (DataTable)objLogic.PrintTicket(Convert.ToInt32(Request.QueryString["PassengerID"].ToString())); DetailsView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); }
protected void btnLogin_Click(object sender, EventArgs e) { // Create new instant of the BusinessLayer clsBusinessLayer myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); // Checks session credentials with database bool isValid = myBusinessLayer.CheckUserCredentials(Session, txtUserID.Text, txtPassword.Text); try { // If the user is in the database then they proceed if (isValid) { lblCurrentUser.Text = txtUserID.Text; panelCatalog.Visible = true; Master.AboutUs.Visible = true; Master.AccountDetails.Visible = true; Master.Checkout.Visible = true; Master.FAQ.Visible = true; Master.HomePage.Visible = true; Master.Login.Visible = true; Master.OrderReview.Visible = false; Master.AboutUs.Enabled = true; Master.AccountDetails.Enabled = true; Master.Checkout.Enabled = true; Master.FAQ.Enabled = true; Master.HomePage.Enabled = true; Master.Login.Enabled = true; Master.OrderReview.Enabled = false; panelCatalog.Enabled = true; panelCatalog.Visible = true; panelReLogin.Enabled = false; panelReLogin.Visible = false; // Output message if match data is found Master.UserFeedBack.Text = "Welcome " + lblCurrentUser.Text + "!"; if (lblCurrentUser.Text.Contains("systemAdmin")) { Master.OrderReview.Visible = true; // Output message if match data is found Master.UserFeedBack.Text = "Welcome " + lblCurrentUser.Text + "!"; } } else if (Convert.ToBoolean(Session["LockedSession"])) { Master.UserFeedBack.Text = "Account is disabled. Contact System Administrator"; // Hide login button btnLogin.Visible = false; } else { Master.UserFeedBack.Text = "The User ID and/or Password supplied is incorrect. Please try again!"; } } catch (Exception error) { Master.UserFeedBack.Text = error.Message; } }
protected void Page_Load(object sender, EventArgs e) { objLogic = new clsBusinessLayer(); }
protected void Page_Load(object sender, EventArgs e) { Master.AboutUs.Visible = false; Master.AccountDetails.Visible = false; Master.Checkout.Visible = false; Master.FAQ.Visible = false; Master.HomePage.Visible = false; Master.Login.Visible = false; Master.OrderReview.Visible = false; Master.AboutUs.Enabled = false; Master.AccountDetails.Enabled = false; Master.Checkout.Enabled = false; Master.FAQ.Enabled = false; Master.HomePage.Enabled = false; Master.Login.Enabled = false; Master.OrderReview.Enabled = false; Master.UserFeedBack.Text = "Fill out the form below to create your account."; // Update GridView BindCustomerGridView(); // Add data to myBusinessLayer myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); lblCustID.Visible = false; customerID.Visible = false; ID.Visible = false; lblCustList.Visible = false; gvCustomerList.Visible = false; txtUsername.Enabled = true; txtSearch.Enabled = false; btnFindUsername.Enabled = false; btnDelete.Enabled = false; btnDelete.Visible = false; lblSearch.Visible = false; txtSearch.Visible = false; btnFindUsername.Visible = false; // If applicable, gives one of the below outputs // If username on AccountDetails page matches UserID from tblUsers // Can update details for that user try { if (PreviousPage.IsCrossPagePostBack) { lblCurrentUser.Text = PreviousPage.CurrentUser.Text; txtUsername.Text = PreviousPage.User.Text; // Creates new database for use in click event dsAccounts dsLoadDetails = myBusinessLayer.FindCustomer(txtUsername.Text); dsAccounts dsLoadUser = myBusinessLayer.FindUser(txtUsername.Text); // Checks session credentials with database bool isUser = myBusinessLayer.CheckUsername(Session, txtUsername.Text); if (isUser || dsLoadDetails.tblCustomers.Rows.Count > 0 || dsLoadUser.tblUsers.Rows.Count > 0) { // If the Username and their data is found then it is pulled and user is informed the record has been found txtUsername.Text = dsLoadDetails.tblCustomers[0].UserID; txtFirstName.Text = dsLoadDetails.tblCustomers[0].FirstName; txtLastName.Text = dsLoadDetails.tblCustomers[0].LastName; txtEmail.Text = dsLoadDetails.tblCustomers[0].Email; txtLine1.Text = dsLoadDetails.tblCustomers[0].Address1; txtLine2.Text = dsLoadDetails.tblCustomers[0].Address2; txtCity.Text = dsLoadDetails.tblCustomers[0].City; txtState.Text = dsLoadDetails.tblCustomers[0].State; txtPhone.Text = dsLoadDetails.tblCustomers[0].PhoneNumber; customerID.Text = dsLoadDetails.tblCustomers[0].CustomerID.ToString(); ID.Text = dsLoadUser.tblUsers[0].ID.ToString(); Master.AboutUs.Visible = true; Master.AccountDetails.Visible = true; Master.Checkout.Visible = true; Master.FAQ.Visible = true; Master.HomePage.Visible = true; Master.Login.Visible = true; Master.OrderReview.Visible = false; Master.AboutUs.Enabled = true; Master.AccountDetails.Enabled = true; Master.Checkout.Enabled = true; Master.FAQ.Enabled = true; Master.HomePage.Enabled = true; Master.Login.Enabled = true; Master.OrderReview.Enabled = false; txtUsername.Enabled = false; txtSearch.Enabled = false; btnFindUsername.Enabled = false; lblCustList.Visible = false; gvCustomerList.Visible = false; lblSearch.Visible = false; txtSearch.Visible = false; btnFindUsername.Visible = false; btnDelete.Enabled = true; btnDelete.Visible = true; // Output message if match data is found Master.UserFeedBack.Text = "Welcome back " + txtUsername.Text + "!"; if (PreviousPage.User.Text.Contains("systemAdmin")) { lblCustList.Visible = true; gvCustomerList.Visible = true; lblSearch.Visible = true; txtSearch.Visible = true; btnFindUsername.Visible = true; txtUsername.Enabled = false; txtSearch.Enabled = true; btnFindUsername.Enabled = true; btnDelete.Enabled = false; btnDelete.Visible = false; Master.OrderReview.Visible = true; lblCurrentUser.Text = "systemAdmin"; // Output message if match data is found Master.UserFeedBack.Text = "Welcome back " + txtUsername.Text + "!"; if (txtSearch.Text.Contains("Create") || txtSearch.Text.Contains("create")) { Master.OrderReview.Visible = true; lblCurrentUser.Text = "systemAdmin"; // Output message if match data is found Master.UserFeedBack.Text = "Welcome back " + txtUsername.Text + "!"; } } } else { ID.Text = "0"; // Output message if no matching data is found Master.UserFeedBack.Text = "Fill out the form below to create your account."; } } } catch (Exception error) { Master.UserFeedBack.Text = error.Message; } foreach (ListItem li in rblCCType.Items) { //add margin as css style li.Attributes.CssStyle.Add("margin-left", "75px"); } }