private void Register_update_car_Click(object sender, EventArgs e) { if (Wizzard_Helper.inputValidator(Register_car_deatiles) && Register_car_list.SelectedIndex != -1) { Register_utiles.updateCar(GetCarData(), Register_car_list.SelectedIndex); Register_car_list.SelectedIndex = -1; Load_car(); } }
private void Register_delete_car_Click(object sender, EventArgs e) { if (Register_car_list.SelectedIndex != -1) { Register_utiles.RemoveCar(Register_car_list.SelectedIndex); Register_car_list.SelectedIndex = -1; Load_car(); } }
private List <object> GetCarData() { List <object> car = new List <object>(); try { car.Add(int.Parse(Register_car_number.Text)); car.Add(Register_id.Text); car.Add(Register_utiles.getModelId(Register_model.SelectedIndex)); car.Add(Register_kilometer.Text); return(car); } catch { return(null); } }
private void Register_manufactor_SelectedIndexChanged(object sender, EventArgs e) { if (Register_manufactor.SelectedIndex == -1) { return; } try { Register_utiles.SetManufactor(Register_manufactor.SelectedIndex); Register_model.Enabled = true; Load_Register_Models(); } catch { Register_model.SelectedIndex = -1; Register_model.Enabled = false; Register_model.Items.Clear(); } }
private void Register_car_list_SelectedIndexChanged(object sender, EventArgs e) { if (Register_car_list.SelectedIndex == -1) { return; } List <object> car = Register_utiles.GetCar(Register_car_list.SelectedIndex); try { Register_car_number.Text = car[0].ToString(); Register_manufactor.SelectedIndex = Register_utiles.getManufactorIndex((int)car[2]); Register_model.SelectedIndex = Register_utiles.getModelIndex((int)car[2]); Register_kilometer.Text = car[3].ToString(); } catch (Exception err) { MessageBox.Show(err.Message); } }
private void Register_add_car_Click(object sender, EventArgs e) { if (Register_id.Text == "") { MessageBox.Show("אנא הכנס תעודת זהות בחלון הקודם"); return; } if (Wizzard_Helper.inputValidator(Register_car_deatiles)) { if (Register_utiles.ExsistCar(int.Parse(Register_car_number.Text)) == false) { Register_utiles.AddCar(GetCarData()); Register_car_list.SelectedIndex = -1; Load_car(); Clear_Car_Register_Form(); } else { MessageBox.Show("מספר מכונית קיים במערכת"); } } }
private void Register_Finish(object sender, EventArgs e) { List <object> values = new List <object>(); if (Wizzard_Helper.inputValidator(Register_Profile_Page)) { try { values.Add(int.Parse(Register_id.Text)); values.Add(Register_firstname.Text); values.Add(Register_lastname.Text); values.Add(Register_birthady.Value.ToShortDateString()); values.Add(Register_gender.Text); values.Add(Register_phone.Text); values.Add(Register_email.Text); if (Register_utiles.InsertPerson(values) && Register_utiles.InsertCar()) { Refresh_Screen(); Clear_Car_Register_Form(); MessageBox.Show("Inserted"); } else { MessageBox.Show("not Inserted"); } } catch { } } else { MessageBox.Show("not ok"); } //register account }
private void Load_Register_Models() { Load_List(Register_model, Register_utiles.getModelsNames()); }
private void Load_car() { Load_List(Register_car_list, Register_utiles.getCarNumbers()); }