コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the RegisteredCustomers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRegisteredCustomers(RegisteredCustomer registeredCustomer)
 {
     base.AddObject("RegisteredCustomers", registeredCustomer);
 }
コード例 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the RegisteredCustomers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRegisteredCustomers(RegisteredCustomer registeredCustomer)
 {
     base.AddObject("RegisteredCustomers", registeredCustomer);
 }
コード例 #5
0
ファイル: Default2.aspx.cs プロジェクト: skocode/Assignment6
    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.";
        }
    }
コード例 #6
0
ファイル: Default3.aspx.cs プロジェクト: skocode/FinalProject
    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");
            }
    }
コード例 #7
0
ファイル: Default2.aspx.cs プロジェクト: skocode/Assignment6
    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.";
        }
    }