private void btnQuestioning_Click(object sender, EventArgs e) { lblPlateError.Visible = false; Costumer costumer = CostumerProcess.GetCostumer(userName, password); plate = textBox1.Text; Vehicle vehicle = VehicleProcess.GetVehicle(plate); if (vehicle != null) { if (costumer.ID == vehicle.CID) { lblLabel.Text = Convert.ToString(vehicle.LID); lblPlate.Text = vehicle.Plate; lblClass.Text = Convert.ToString(vehicle.Grade) + ". Class"; lblBalance.Text = Convert.ToString(vehicle.Balance); linkLabel2.Visible = true; } else { lblPlateError.Text = "This vehicle is not your's!"; lblPlateError.Visible = true; } } else { lblPlateError.Text = "There is no vehicle!"; lblPlateError.Visible = true; } }
private void btnSave_Click(object sender, EventArgs e) { if (txtBrand.Text == "" || txtModel.Text == "" || txtPlate.Text == "" || txtClass.Text == "") { lblBlanks.Text = "Please fill in the blanks"; } else { int len1, len2; string a, b; len1 = txtBrand.Text.Length; len2 = txtModel.Text.Length; a = txtBrand.Text.Substring(0, 1); b = txtModel.Text.Substring(0, 1); Vehicle vehicle = new Vehicle(); vehicle.Brand = a.ToUpper() + txtBrand.Text.Substring(1, len1 - 1); vehicle.Model = b.ToUpper() + txtModel.Text.Substring(1, len2 - 1); vehicle.Plate = txtPlate.Text; vehicle.Grade = txtClass.Text; Costumer costumer = CostumerProcess.GetCostumer(userName, password); vehicle.CID = costumer.ID; VehicleProcess.AddVehicle(vehicle); Questioning questioning = new Questioning(); questioning.userName = userName; questioning.password = password; questioning.Show(); this.Hide(); } }
private void AddVehicle_Load(object sender, EventArgs e) { Costumer costumer = CostumerProcess.GetCostumer(userName, password); pictureBox1.Parent = panel1; pictureBox1.BackColor = Color.Transparent; panel2.Parent = pictureBox1; panel2.BackColor = Color.Transparent; panel3.Parent = pictureBox1; panel3.BackColor = Color.Transparent; }
private void Questioning_Load(object sender, EventArgs e) { Costumer costumer = CostumerProcess.GetCostumer(userName, password); label1.Parent = pictureBox1; label1.BackColor = Color.Transparent; label1.Text = costumer.Name + " " + costumer.Surname; pictureBox1.Parent = panel1; pictureBox1.BackColor = Color.Transparent; panel2.Parent = pictureBox1; panel2.BackColor = Color.Transparent; panel3.Parent = pictureBox1; panel3.BackColor = Color.Transparent; linkLabel1.Parent = panel3; linkLabel1.BackColor = Color.Transparent; }
private void btnLogin_Click(object sender, EventArgs e) { Costumer costumer = CostumerProcess.GetCostumer(txtUsername.Text, txtPassword.Text); if (costumer == null) { label5.Text = "There is no costumer! Please try again!"; } else { Questioning questioning = new Questioning(); questioning.userName = txtUsername.Text; questioning.password = txtPassword.Text; questioning.Show(); this.Hide(); } }
private void btnComplete_Click(object sender, EventArgs e) { lblIdError.Visible = false; if (txtName.Text == "" || txtSurname.Text == "" || txtId.Text == "" || txtEmail.Text == "" || txtUserName.Text == "" || txtPassword.Text == "" || comboBox1.Text == "" || comboBox2.Text == "" || comboBox3.Text == "" || comboBox4.Text == "") { lblFill1.Text = "Please fill in the blanks"; } else if (checkBox1.Checked == false) { lblFill2.Text = "Please accept the Membership Agreement and Privacy Policy"; } else if (txtId.Text.Length < 11 || txtId.Text.Length > 11) { lblIdError.Visible = true; } else { int len1, len2; string a, b; len1 = txtName.Text.Length; len2 = txtSurname.Text.Length; a = txtName.Text.Substring(0, 1); b = txtSurname.Text.Substring(0, 1); Costumer costumer = new Costumer(); costumer.Name = a.ToUpper() + txtName.Text.Substring(1, len1 - 1); costumer.Surname = b.ToUpper() + txtSurname.Text.Substring(1, len2 - 1); costumer.ID = txtId.Text; costumer.Email = txtEmail.Text; costumer.UserName = txtUserName.Text; costumer.Password = txtPassword.Text; costumer.Gender = comboBox1.SelectedItem.ToString(); costumer.BDD = Convert.ToInt32(comboBox2.SelectedItem.ToString()); costumer.BDM = comboBox3.SelectedItem.ToString(); costumer.BDY = Convert.ToInt32(comboBox4.SelectedItem.ToString()); CostumerProcess.AddCostumer(costumer); AddVehicle addVehicle = new AddVehicle(); addVehicle.userName = costumer.UserName; addVehicle.password = costumer.Password; addVehicle.Show(); this.Hide(); } }