Exemple #1
0
        protected void lstUsers_SelectedIndexChanged(object sender, EventArgs e)
        {
            Classes.User staff = getAllUsers()[lstUsers.SelectedIndex];

            txtEmail.Text       = staff.email;
            txtPassword.Text    = staff.password;
            txtFirstName.Text   = staff.firstName;
            txtLastName.Text    = staff.lastName;
            txtDateOfBirth.Text = staff.dateOfBirth;
            txtAddress.Text     = staff.address;
            txtPhoneNumber.Text = staff.phoneNumber;
        }
Exemple #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Classes.User user = getAllUsers()[lstUsers.SelectedIndex];

            user.email       = txtEmail.Text;
            user.password    = txtPassword.Text;
            user.firstName   = txtFirstName.Text;
            user.lastName    = txtLastName.Text;
            user.dateOfBirth = txtDateOfBirth.Text;
            user.address     = txtAddress.Text;
            user.phoneNumber = txtPhoneNumber.Text;
            List <Classes.User> users = getAllUsers();

            users[lstUsers.SelectedIndex] = user;
            writeUpdateToJson(users);

            outputUsers();
        }
        protected void DropDownCustomer_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <Car>          cars      = CreateCar.getAllCars();//Change to only the customers car
            List <Classes.User> customers = CreateCar.getAllUsers();

            Classes.User currentCustomer = customers[0];
            foreach (Classes.User c in customers)
            {
                if (c.accountID == DropDownCustomer.SelectedValue.ToString())
                {
                    currentCustomer = c;
                }
            }
            List <string> s = new List <string>();

            foreach (Car c in currentCustomer.listOfCars)
            {
                s.Add(c.CarId);
            }
            DropDownCar.DataSource = s;
            DropDownCar.DataBind();
            carss = cars;
        }
Exemple #4
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            string id, email, password, accountType, firstName, lastName, address, phoneNumber, dateOfBirth;
            bool   availability;


            id          = rand.Next(1, 22000).ToString();
            email       = txtEmail.Text;
            password    = txtPassword.Text;
            accountType = drpAccountType.SelectedItem.Text;
            firstName   = txtFirstName.Text;
            lastName    = txtLastName.Text;
            dateOfBirth = txtDateOfBirth.Text;
            address     = txtAddress.Text;
            phoneNumber = txtPhoneNumber.Text;
            List <Classes.Car> carlist = new List <Classes.Car>();

            availability = true;


            Classes.User newUser = new Classes.User(id, password, accountType, firstName, lastName, dateOfBirth, address, email, phoneNumber, carlist, availability);

            newUser.writeToJson();
        }