private void Button_Click(object sender, RoutedEventArgs e) { if (com_gorm.SelectedIndex == -1 || com_kind.SelectedIndex == -1 || com_num.SelectedIndex == -1) { MessageBox.Show("בשביל אישור עלייך למלאות את השדות.", "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); return; } pri.Text = fa.total_price.ToString(); new BLFactory.BlFactory().GetBL().update_Fault(fa, BE.update.gorm_htakla, (BE.who_fault)com_gorm.SelectedValue); r.is_defcive = true; new BLFactory.BlFactory().GetBL().update_rent(r, BE.update.gorm_htakla, false); BE.car ca = new BE.car(); foreach (BE.car item in (new BLFactory.BlFactory().GetBL().return_list(retur.car))) { if (item.car_number == r.number_of_rishui) { ca = item; break; } } new BLFactory.BlFactory().GetBL().update_car(ca, BE.update.takin, false); new BLFactory.BlFactory().GetBL().add_Car_fault(ca.car_number, fa.fault_number); MessageBox.Show(" השדות של הרכב, תקלות ותקלת מכונית עודכנו.", "אישור תקלה", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); }
public car(car a) { car_number = a.car_number; date_of_fix = a.date_of_fix; car_info = a.car_info; car_gear = a.car_gear; car_people_able = a.car_people_able; number_of_car_doors = a.number_of_car_doors; total_distance = a.total_distance; snif_address = a.snif_address; takin = a.takin; rishion = a.rishion; }
public Renting(int days, Drivers drive, car ca, int num_of_peo) { running_code = 0; start_rent = new DateTime(); start_rent = DateTime.Now; this.days = days; driver = drive; number_of_rishui = ca.car_number; number_of_pepole = num_of_peo; number_at_start = ca.total_distance; is_defcive = false; ended = false; }
public void del_car(BE.car ca) { try { (from item in xml_control.Car_Root.Elements() where item.Element("car_number").Value == ca.car_number.ToString() select item).Remove(); xml_control.Car_Root.Save(xml_control.Car_Path); } catch (Exception e) { throw new Exception(e.Message); } }
public void add_car(BE.car ca) { if (is_car_exist(ca.car_number)) { throw new Exception("קיים מספר רכב זה"); } else if (ca.car_number == 0) { ca.car_number = create_new_license_number(); } xml_control.Car_Root.Add(ca.ToXml()); xml_control.Car_Root.Save(xml_control.Car_Path); }
public void update_car(BE.car ca, BE.update t, object obj) { switch (t) { case update.date_test: if (obj is DateTime?) { del_car(ca); ca.date_of_fix = (DateTime)obj; } else { throw new Exception("this objet is not a DateTime"); } break; case update.destance: if (obj is int) { del_car(ca); ca.total_distance += float.Parse(obj.ToString()); } else { throw new Exception("this objet is not a bool"); } break; case update.rishion_rachav: if (obj is rishion_rachav) { del_car(ca); ca.rishion = (rishion_rachav)obj; } else { throw new Exception("this objet is not an rishion rachav"); } break; case update.takin: if (obj is bool) { del_car(ca); ca.takin = (bool)obj; } else { throw new Exception("this objet is not an boolean"); } break; case update.panuy: if (obj is bool) { del_car(ca); ca.moosker = (bool)obj; } else { throw new Exception("this objet is not an boolean"); } break; case update.mirchk: if (obj is float) { del_car(ca); ca.total_distance += (float)obj; } else { throw new Exception("this objet is not an mailage"); } break; case update.address: { if (obj is addres) { del_car(ca); ca.snif_address = (addres)obj; } else { throw new Exception("this objet is not an addres"); } } break; case update.mosif_n: if (obj is int) { del_car(ca); ca.car_people_able += (int)obj; } else { throw new Exception("this objet is not an pepole number"); } break; case update.morid_n: if (obj is int) { del_car(ca); ca.car_people_able -= (int)obj; } else { throw new Exception("this objet is not an pepole number"); } break; case update.ids: { del_car(ca); if (obj is int || obj is long || obj is decimal) { if (ca.car_number > 10m || ca.car_number < 1m) { ca.car_number = create_new_license_number(); } else { ca.car_number = (int)obj; } } else { throw new Exception("this objet is not an id"); } } break; default: throw new Exception(string.Format("this {0} is not an update option", t.ToString())); } add_car(ca); }