public update_date_rent() { InitializeComponent(); //BE.Renting ren = new Renting(); ren = (((List <Renting>)bl.return_list(retur.renting)) .Where(a => a.running_code == update_rent_win.num)).First(); }
public void del_rent(BE.Renting rent) { try { (from item in xml_control.Renting_Root.Elements() where item.Element("running_code").Value == rent.running_code.ToString() select item).Remove(); xml_control.Renting_Root.Save(xml_control.Renting_Path); } catch (Exception e) { throw new Exception(e.Message); } }
public void add_rent(BE.Renting rent) { if (is_rent_exist(rent.running_code)) { throw new Exception("קיים מספר הזמנה זה"); } else if (rent.running_code == 0) { rent.running_code = create_new_run_code(); } xml_control.Renting_Root.Add(rent.ToXml()); xml_control.Renting_Root.Save(xml_control.Renting_Path); }
public Renting(Renting rent) { running_code = rent.running_code; start_rent = rent.start_rent; end_rent = rent.end_rent; days = rent.days; driver = rent.driver; number_of_rishui = rent.number_of_rishui; number_of_pepole = rent.number_of_pepole; number_at_start = rent.number_at_start; number_at_end = rent.number_at_end; number_drove = rent.number_drove; is_defcive = rent.is_defcive; price = rent.price; ended = rent.ended; }
public end_rent_tkinut(BE.Renting re) { re = r; InitializeComponent(); com_gorm.Items.Add(BE.who_fault.blay); com_gorm.Items.Add(BE.who_fault.Negligence); com_kind.Items.Add(BE.fault_type.betichut); com_kind.Items.Add(BE.fault_type.blamim); com_kind.Items.Add(BE.fault_type.chasmal); com_kind.Items.Add(BE.fault_type.gir); com_kind.Items.Add(BE.fault_type.light); com_kind.Items.Add(BE.fault_type.magavim); com_kind.Items.Add(BE.fault_type.marout); com_kind.Items.Add(BE.fault_type.mazgan); com_kind.Items.Add(BE.fault_type.mnoah); com_kind.Items.Add(BE.fault_type.pancher); com_kind.Items.Add(BE.fault_type.pch); com_kind.Items.Add(BE.fault_type.plastica); com_kind.Items.Add(BE.fault_type.radio); com_kind.Items.Add(BE.fault_type.tipulTen); com_kind.Items.Add(BE.fault_type.tzeva); }
public void close_rent(BE.Renting rent) { throw new NotImplementedException(); }//-
public void update_rent(BE.Renting rent, BE.update t, object obj) { switch (t) { case update.rishion_nahg: if (obj is long) { del_rent(rent); Drivers dra = new Drivers { first_id = rent.driver.first_id, first_name = rent.driver.first_name, second_id = (long)obj, second_name = "" }; rent.driver = dra; } else { throw new Exception("this objet is not a float"); } break; case update.date_end: if (obj is DateTime) { del_rent(rent); rent.end_rent = (DateTime)obj; } else { throw new Exception("this objet is not a float"); } break; case update.destance: if (obj is float || obj is int) { del_rent(rent); rent.number_at_end = (int)obj; rent.number_drove = rent.number_at_end - rent.number_at_start; } else { throw new Exception("this objet is not a float"); } break; case update.defect: if (obj is bool) { del_rent(rent); rent.is_defcive = (bool)obj; } else { throw new Exception("this objet is not a bool"); } break; case update.ended: if (obj is bool) { del_rent(rent); rent.ended = (bool)obj; } else { throw new Exception("this objet is not a bool"); } break; case update.price: if (obj is float) { del_rent(rent); rent.price = (float)obj; } else { throw new Exception("this objet is not an pepole number"); } break; case update.mosif_n: if (obj is Drivers) { del_rent(rent); rent.number_of_pepole = 2; } else { throw new Exception("this objet is not a \"driver object\""); } break; case update.morid_n: //- if (obj is int) { del_rent(rent); rent.number_of_pepole = 1; } else { throw new Exception("this objet is not a \"int object\""); } break; case update.mispar_yamim: if (obj is int) { del_rent(rent); rent.days = (int)obj; } else if (obj is DateTime) { del_rent(rent); rent.end_rent = (DateTime)obj; rent.days = (rent.end_rent - rent.start_rent).Days; } else { throw new Exception("this objet is not a \"int object\""); } break; case update.price_horada_achuz: if (obj is int) { if ((int)obj > 100 || (int)obj < 0) { throw new Exception("המספר שנשלח הוא לא אחוז נדרש מספר בין 0 ל100 "); } del_rent(rent); rent.price = rent.price - (int)obj * rent.price; } else { throw new Exception("צריך לשלוח משתנה מסוג אינטג'ר "); } break; case update.price_horada_shqulim: if (obj is int) { if ((int)obj > rent.price || (int)obj < 0) { throw new Exception("המספר שנשלח צריך להיות גדול מ0 וקטן מהמחיר המקורי"); } del_rent(rent); rent.price = rent.price - (int)obj; } else { throw new Exception("צריך לשלוח משתנה מסוג אינטג'ר "); } break; case update.panuy: if (obj is bool) { del_rent(rent); rent.panuy = (bool)obj; } else { throw new Exception("this objet is not a \"int object\""); } break; default: throw new Exception(string.Format("לא ניתן לעדכן {0} בהשכרה", t.ToString())); } add_rent(rent); }