partial void Updateplaystation_timezone(playstation_timezone instance);
partial void Deleteplaystation_timezone(playstation_timezone instance);
partial void Insertplaystation_timezone(playstation_timezone instance);
private void detach_playstation_timezones(playstation_timezone entity) { this.SendPropertyChanging(); entity.timezones_t = null; }
private void attach_playstation_timezones(playstation_timezone entity) { this.SendPropertyChanging(); entity.tables_t = this; }
public void InsertNewTimeZone(string timeZoneName, TimeSpan startTime, TimeSpan endTime) { var db = new dbDataContext(); lock (db) { Table<timezones_t> timeZonesT = db.GetTable<timezones_t>(); var timezones = new timezones_t { timezone_name = timeZoneName, timezone_start = startTime, timezone_end = endTime }; try { timeZonesT.InsertOnSubmit(timezones); db.SubmitChanges(); // RefreshTable(); } catch (Exception) { MessageBox.Show(ErrorsAndWarningsMessages.ErrorsAndWarningsInstance().GetError(5)); } try { var playstations = GetAllTables(); foreach (tables_t t in playstations) { Table<playstation_timezone> timeZoneTable = db.GetTable<playstation_timezone>(); var playstationTimezone = new playstation_timezone { playstation_id = t.playstation_id, timezone_name = timeZoneName, timezone_cost_per_hour = 0 }; timeZoneTable.InsertOnSubmit(playstationTimezone); db.SubmitChanges(); } } catch (Exception) { MessageBox.Show(ErrorsAndWarningsMessages.ErrorsAndWarningsInstance().GetError(7)); } } }
public void InsertNewConsole(string consoleName) { var db = new dbDataContext(); lock (db) { Table<tables_t> consolesT = db.GetTable<tables_t>(); var console = new tables_t { playstation_id = consoleName, playstation_state = "free", order_time = new DateTime(2000, 1, 1, 0, 0, 0) }; consolesT.InsertOnSubmit(console); var timeZoneList = GetAllTimeZones(); foreach (timezones_t t in timeZoneList) { Table<playstation_timezone> playstationPricesT = db.GetTable<playstation_timezone>(); var timezonePrice = new playstation_timezone { playstation_id = consoleName, timezone_cost_per_hour = 0, timezone_name = t.timezone_name }; playstationPricesT.InsertOnSubmit(timezonePrice); } db.SubmitChanges(); } }