protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
public static void CleanUp() { if (_dbContext != null) { _dbContext.Dispose(); } if (_unitOfWork != null) { _unitOfWork.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { _context.Dispose(); } } this.disposed = true; }
public static void SyncDeleted() { if (Server.Debug) Server.WriteDisplay("Creating Data Connection"); _conn = new EntitiesModel(); if (Server.Debug) Server.WriteDisplay("Getting Deleted Appointments"); var data = new { appointments = GetDeletedAppointments().Select(row => row.apnum).ToArray() }; if (!data.appointments.Any()) { if (Server.Debug) Server.WriteDisplay("No Deleted Appointments to Sync"); _conn.Dispose(); return; } if (Server.Debug) Server.WriteDisplay("JsonConvert Deleted Appointments"); var jdata = JsonConvert.SerializeObject( data, Formatting.None, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore } ); if (Server.Debug) Server.WriteDisplay("Sending Deleted Appointments"); var results = Send("syncDeleted", jdata); if (Server.Debug) Server.WriteDisplay("Deleted Appointments Synced"); ProcessDeleted(results); _conn.Dispose(); }
/// <summary> /// /// </summary> public static void SyncData() { if (Server.Debug) Server.WriteDisplay("Creating Data Connection"); _conn = new EntitiesModel(); if (Server.Debug) Server.WriteDisplay("Getting Books and Insurances to Sync"); var data = new { books = GetBooks(), insuranceCombo = GetInsuranceComboData() // facultyCombo = GetFacultyComboData() }; if (Server.Debug) Server.WriteDisplay("JsonConvert Books and Insurances"); var jdata = JsonConvert.SerializeObject( data, Formatting.None, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore } ); if (Server.Debug) Server.WriteDisplay("Sending Books and Insurances"); Send("syncData", jdata); if (Server.Debug) Server.WriteDisplay("Books and Insurances Synced"); _conn.Dispose(); }
/// <summary> /// /// </summary> public static void SyncApps() { if (Server.Debug) Server.WriteDisplay("Creating Data Connection"); _conn = new EntitiesModel(); if (Server.Debug) Server.WriteDisplay("Getting Appointments to Sync"); var data = new { appointments = GetNewAppointments() }; if (!data.appointments.Any()) { if (Server.Debug) Server.WriteDisplay("No Appointments to Sync"); _conn.Dispose(); return; } if (Server.Debug) Server.WriteDisplay("JsonConvert Appointments"); var jdata = JsonConvert.SerializeObject( data, Formatting.None, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore } ); if (Server.Debug) Server.WriteDisplay("Sending Appointments"); var results = Send("syncApps", jdata); if (Server.Debug) Server.WriteDisplay("Appointments Synced"); if (Server.Debug) Server.WriteDisplay("Results:"); if (Server.Debug) Server.WriteDisplay(results); ProcessResults(results); _conn.Dispose(); }