コード例 #1
0
        /// <summary>
        /// Create a new vehicle object.
        /// </summary>
        /// <param name="vehicleId">Initial value of the VehicleId property.</param>
        /// <param name="licenseNumber">Initial value of the LicenseNumber property.</param>
        /// <param name="vehicleMake">Initial value of the VehicleMake property.</param>
        /// <param name="vehicleYear">Initial value of the VehicleYear property.</param>
        public static vehicle Createvehicle(global::System.Int32 vehicleId, global::System.String licenseNumber, global::System.String vehicleMake, global::System.String vehicleYear)
        {
            vehicle vehicle = new vehicle();

            vehicle.VehicleId     = vehicleId;
            vehicle.LicenseNumber = licenseNumber;
            vehicle.VehicleMake   = vehicleMake;
            vehicle.VehicleYear   = vehicleYear;
            return(vehicle);
        }
コード例 #2
0
 /// <summary>
 /// Create a new vehicle object.
 /// </summary>
 /// <param name="vehicleId">Initial value of the VehicleId property.</param>
 /// <param name="licenseNumber">Initial value of the LicenseNumber property.</param>
 /// <param name="vehicleMake">Initial value of the VehicleMake property.</param>
 /// <param name="vehicleYear">Initial value of the VehicleYear property.</param>
 public static vehicle Createvehicle(global::System.Int32 vehicleId, global::System.String licenseNumber, global::System.String vehicleMake, global::System.String vehicleYear)
 {
     vehicle vehicle = new vehicle();
     vehicle.VehicleId = vehicleId;
     vehicle.LicenseNumber = licenseNumber;
     vehicle.VehicleMake = vehicleMake;
     vehicle.VehicleYear = vehicleYear;
     return vehicle;
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the vehicles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTovehicles(vehicle vehicle)
 {
     base.AddObject("vehicles", vehicle);
 }
コード例 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the vehicles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTovehicles(vehicle vehicle)
 {
     base.AddObject("vehicles", vehicle);
 }
コード例 #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.";
        }
    }