Пример #1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
Пример #2
0
 public static void CleanUp()
 {
     if (_dbContext != null)
     {
         _dbContext.Dispose();
     }
     if (_unitOfWork != null)
     {
         _unitOfWork.Dispose();
     }
 }
Пример #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             _context.Dispose();
         }
     }
     this.disposed = true;
 }
Пример #4
0
        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();
        }
Пример #5
0
        /// <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();
        }
Пример #6
0
        /// <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();
        }