/// <summary> /// Create a new RegisteredCustomer object. /// </summary> /// <param name="registeredCustomerID">Initial value of the RegisteredCustomerID property.</param> /// <param name="email">Initial value of the Email property.</param> /// <param name="customerPassword">Initial value of the CustomerPassword property.</param> public static RegisteredCustomer CreateRegisteredCustomer(global::System.Int32 registeredCustomerID, global::System.String email, global::System.String customerPassword) { RegisteredCustomer registeredCustomer = new RegisteredCustomer(); registeredCustomer.RegisteredCustomerID = registeredCustomerID; registeredCustomer.Email = email; registeredCustomer.CustomerPassword = customerPassword; return(registeredCustomer); }
/// <summary> /// Create a new RegisteredCustomer object. /// </summary> /// <param name="registeredCustomerID">Initial value of the RegisteredCustomerID property.</param> /// <param name="email">Initial value of the Email property.</param> /// <param name="customerPassword">Initial value of the CustomerPassword property.</param> public static RegisteredCustomer CreateRegisteredCustomer(global::System.Int32 registeredCustomerID, global::System.String email, global::System.String customerPassword) { RegisteredCustomer registeredCustomer = new RegisteredCustomer(); registeredCustomer.RegisteredCustomerID = registeredCustomerID; registeredCustomer.Email = email; registeredCustomer.CustomerPassword = customerPassword; return registeredCustomer; }
/// <summary> /// Deprecated Method for adding a new object to the RegisteredCustomers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRegisteredCustomers(RegisteredCustomer registeredCustomer) { base.AddObject("RegisteredCustomers", registeredCustomer); }
protected void SubmitBtn_Click(object sender, EventArgs e) { try { // Form Validation - Checks for blank required fields and password matching if (FirstNameTxt.Text == "") { FNErrorLbl.Text = "* Required Field"; return; } else { FNErrorLbl.Text = ""; } if (LastNameTxt.Text == "") { LNErrorLbl.Text = "* Required Field"; return; } else { LNErrorLbl.Text = ""; } if (EmailTxt.Text == "") { EMErrorLbl.Text = "* Required Field"; return; } else { EMErrorLbl.Text = ""; } if (LicenseTxt.Text == "") { LPErrorLbl.Text = "* Required Field"; return; } else { LPErrorLbl.Text = ""; } if (PasswordTxt.Text == "") { PWErrorLbl.Text = "* Required Field"; return; } else { PWErrorLbl.Text = ""; } if (PasswordConfirmTxt.Text == "") { PWCErrorLbl.Text = "* Required Field"; return; } else { PWCErrorLbl.Text = ""; } if (PasswordTxt.Text != PasswordConfirmTxt.Text) { PWErrorLbl.Text = "* Passwords Must Match"; PWCErrorLbl.Text = "* Passwords Must Match"; return; } else { PWErrorLbl.Text = ""; PWCErrorLbl.Text = ""; } // End Form Validation // Writes user-entered information into the AutoMart database using the AutoMartEntities ADO.Net Data Entities Component then redirects to Default3.aspx AutomartModel.AutomartEntities ame = new AutomartModel.AutomartEntities(); AutomartModel.Person p = new AutomartModel.Person(); p.FirstName = FirstNameTxt.Text; p.LastName = LastNameTxt.Text; ame.People.AddObject(p); AutomartModel.RegisteredCustomer rc = new AutomartModel.RegisteredCustomer(); rc.Email = EmailTxt.Text; rc.CustomerPassword = PasswordTxt.Text; ame.RegisteredCustomers.AddObject(rc); AutomartModel.vehicle v = new AutomartModel.vehicle(); v.LicenseNumber = LicenseTxt.Text; v.VehicleMake = MakeTxt.Text; v.VehicleYear = YearTxt.Text; ame.vehicles.AddObject(v); ame.SaveChanges(); Response.Redirect("Default3.aspx"); } catch { ErrorLbl.Text = "Registration failed. Please check your entries and try again."; } }
protected void SubmitBtn_Click(object sender, EventArgs e) { // Form Validation - Checks for blank required fields and password matching using C# code if (LastNameTxt.Text == "") { LNErrorLbl.Text = "* Required Field"; return; } else { LNErrorLbl.Text = ""; } if (EmailTxt.Text == "") { EMErrorLbl.Text = "* Required Field"; return; } else { EMErrorLbl.Text = ""; } if (LicenseTxt.Text == "") { LPErrorLbl.Text = "* Required Field"; return; } else { LPErrorLbl.Text = ""; } if (PasswordTxt.Text == "") { PWErrorLbl.Text = "* Required Field"; return; } else { PWErrorLbl.Text = ""; } if (PasswordConfirmTxt.Text == "") { PWCErrorLbl.Text = "* Required Field"; return; } else { PWCErrorLbl.Text = ""; } if (PasswordTxt.Text != PasswordConfirmTxt.Text) { PWErrorLbl.Text = "* Passwords Must Match"; PWCErrorLbl.Text = "* Passwords Must Match"; return; } else { PWErrorLbl.Text = ""; PWCErrorLbl.Text = ""; } // End Form Validation // This code uses the ADO.Net Data Entities to collect user-entered registration information and enter it into the Automart database, then redirect the user to a thank you page try { AutomartModel.AutomartEntities ame = new AutomartModel.AutomartEntities(); AutomartModel.Person p = new AutomartModel.Person(); p.FirstName = FirstNameTxt.Text; p.LastName = LastNameTxt.Text; ame.People.AddObject(p); AutomartModel.RegisteredCustomer rc = new AutomartModel.RegisteredCustomer(); rc.Email = EmailTxt.Text; rc.CustomerPassword = PasswordTxt.Text; ame.RegisteredCustomers.AddObject(rc); AutomartModel.vehicle v = new AutomartModel.vehicle(); v.LicenseNumber = LicenseTxt.Text; v.VehicleMake = MakeTxt.Text; v.VehicleYear = YearTxt.Text; ame.vehicles.AddObject(v); ame.SaveChanges(); Response.Redirect("Default4.aspx", false); } catch (Exception ex) { Session["error"] = ex.Message; Response.Redirect("Default6.aspx"); } }
protected void SubmitBtn_Click(object sender, EventArgs e) { try { // Form Validation - Checks for blank required fields and password matching if (FirstNameTxt.Text == "") { FNErrorLbl.Text = "* Required Field"; return; } else {FNErrorLbl.Text = "";} if (LastNameTxt.Text == "") { LNErrorLbl.Text = "* Required Field"; return; } else {LNErrorLbl.Text = "";} if (EmailTxt.Text == "") { EMErrorLbl.Text = "* Required Field"; return; } else {EMErrorLbl.Text = "";} if (LicenseTxt.Text == "") { LPErrorLbl.Text = "* Required Field"; return; } else { LPErrorLbl.Text = ""; } if (PasswordTxt.Text == "") { PWErrorLbl.Text = "* Required Field"; return; } else { PWErrorLbl.Text = ""; } if (PasswordConfirmTxt.Text == "") { PWCErrorLbl.Text = "* Required Field"; return; } else { PWCErrorLbl.Text = ""; } if (PasswordTxt.Text != PasswordConfirmTxt.Text) { PWErrorLbl.Text = "* Passwords Must Match"; PWCErrorLbl.Text = "* Passwords Must Match"; return; } else { PWErrorLbl.Text = ""; PWCErrorLbl.Text = ""; } // End Form Validation // Writes user-entered information into the AutoMart database using the AutoMartEntities ADO.Net Data Entities Component then redirects to Default3.aspx AutomartModel.AutomartEntities ame = new AutomartModel.AutomartEntities(); AutomartModel.Person p = new AutomartModel.Person(); p.FirstName = FirstNameTxt.Text; p.LastName = LastNameTxt.Text; ame.People.AddObject(p); AutomartModel.RegisteredCustomer rc = new AutomartModel.RegisteredCustomer(); rc.Email = EmailTxt.Text; rc.CustomerPassword = PasswordTxt.Text; ame.RegisteredCustomers.AddObject(rc); AutomartModel.vehicle v = new AutomartModel.vehicle(); v.LicenseNumber = LicenseTxt.Text; v.VehicleMake = MakeTxt.Text; v.VehicleYear = YearTxt.Text; ame.vehicles.AddObject(v); ame.SaveChanges(); Response.Redirect("Default3.aspx"); } catch { ErrorLbl.Text = "Registration failed. Please check your entries and try again."; } }