/// <summary> /// The main entry point for the application. /// </summary> static void Main() { RavenClient sentry = null; try { var sentryKey = System.Configuration.ConfigurationManager.AppSettings["sentryKey"]; sentry = new RavenClient(sentryKey); #if DEBUG var svc = new MyWindowsService(); svc.OnDebug(); #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new MyWindowsService() }; ServiceBase.Run(ServicesToRun); #endif } catch (Exception ex) { sentry?.Capture(new SharpRaven.Data.SentryEvent(ex)); } }
/// <summary> /// Method can be used to get the diagnosis Id /// </summary> /// <param name="appointmentId"></param> /// <returns></returns> public int GetDiagnosisId(int appointmentId) { try { return(db.Diagnosis.FirstOrDefault(d => d.AppointmentId == appointmentId).Id); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); return(0);//check for exceptions } }
public Diagnosis GetDiagnosisDetails(int appointmentId) { try { return(db.Diagnosis.FirstOrDefault(t => t.AppointmentId == appointmentId)); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); return(null); } }
/// <summary> /// This method can be used to retrieve the invoice data /// </summary> /// <param name="appointmentId"></param> /// <returns></returns> public InvoiceRecord GetInvoiceData(int appointmentId) { try { return(db.InvoiceRecord.Include(t => t.Appointment).Include(t => t.Appointment.Doctor).Include(t => t.Appointment.Patient).FirstOrDefault(t => t.AppointmentId == appointmentId)); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
/// <summary> /// Method to retrieve the time slots of a particular appointment /// </summary> /// <returns></returns> public List <AppointmentTime> GetTimeSlots() { try { return(db.AppointmentTime.OrderBy(t => t.Id).ToList()); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
/// <summary> /// This method can be used to get the test Id /// </summary> /// <param name="name"></param> /// <returns></returns> public int GetTestId(string name) { try { return(db.Tests.SingleOrDefault(t => t.Name == name && t.DeletedAt == null).Id); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); return(0);//check for exceptions } }
//For Patients Dashboard /// <summary> /// /// </summary> /// <param name="PatientId"></param> /// <returns></returns> public int GetPendingPatientAppointments(int PatientId) { try { return(db.Appointment.Include(t => t.Patient).Count(t => t.AppointmentStatusId == (byte)AppointmentStatus.Pending && t.PatientId == PatientId && t.Patient.IsDeleted == false)); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
public List <DoctorFee> GetAllDoctorsList() { try { return(db.DoctorFee.Include(t => t.Doctor).Where(t => t.Doctor.RoleId == (int)Roles.Doctor && t.Doctor.IsDeleted == false).Distinct().ToList()); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
public List <DoctorSpecialization> GetDoctorSpecilizationsList() { try { return(db.DoctorSpecialization.Include(t => t.Users).Include(t => t.Specialization).Where(t => t.Users.RoleId == (int)Roles.Doctor && t.Users.IsDeleted == false).ToList()); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); return(null); } }
public List <TestRecord> GetTestData(int DiagnosisId) { try { return(db.TestRecord.Include(t => t.Tests).Where(t => t.DiagnosisId == DiagnosisId).ToList()); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
/// <summary> /// /// </summary> /// <param name="DoctorId"></param> /// <returns></returns> public int GetDoctorsPatient(int DoctorId) { try { return(db.Appointment.Where(t => t.DoctorId == DoctorId).Select(t => t.PatientId).Distinct().Count()); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
public List <DoctorAvailability> GetDoctorList() { try { return(db.DoctorAvailability.Include(t => t.Users).Where(t => t.Users.IsDeleted == false).ToList()); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
/// <summary> /// Method to get doctor count /// </summary> /// <returns></returns> public int GetDoctorCount() { try { return(db.Users.Count(t => t.RoleId == (int)Roles.Doctor && t.IsDeleted == false)); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
/// <summary> /// This method can be used to retrieve all the tests that are present in the inventory /// </summary> /// <returns>The list of tests present in the inventory</returns> public List <Tests> TestsData() { try { return(db.Tests.Where(t => t.DeletedAt == null).ToList()); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
/// <summary> /// Method to get the count of todays appointments /// </summary> /// <returns></returns> public int GetTodaysAppointmentCount() { try { return(db.Appointment.Include(t => t.Patient).Include(t => t.Doctor).Count(t => t.Date == DateTime.Today && t.Doctor.IsDeleted == false && t.Patient.IsDeleted == false)); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
/// <summary> /// /// </summary> /// <param name="DoctorId"></param> /// <returns></returns> public int GetDoctorTodaysAppointments(int DoctorId) { try { return(db.Appointment.Count(t => t.DoctorId == DoctorId && t.Date == DateTime.Today.Date)); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
public List <Diagnosis> GetDiagnosisData(int PatientId) { try { return(db.Diagnosis.Include(t => t.Appointment).Include(t => t.Appointment.Patient).Include(t => t.Appointment.Doctor).Where(t => t.Appointment.PatientId == PatientId).ToList()); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
/// <summary> /// /// </summary> /// <param name="PatientId"></param> /// <returns></returns> public int GetUpcomingPatientAppointments(int PatientId) { try { return(db.Appointment.Count(t => t.Date > DateTime.Today && t.PatientId == PatientId && t.Patient.IsDeleted == false)); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
public List <Users> GetUsersList(int roleId) { try { return(db.Users.Where(u => u.RoleId == roleId).Where(t => t.IsDeleted == false).ToList()); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
static void Main() { AppDomain.CurrentDomain.UnhandledException += (sender, args) => { Exception e = (Exception)args.ExceptionObject; Logger.Error(e, "Unhandled exception"); if (ReportExceptions) { RavenClient.Capture(new SharpRaven.Data.SentryEvent(e)); } MessageBox.Show("Unhandled exception: " + args.ExceptionObject + "\n\n" + (ReportExceptions ? "The error has been reported to Ripple." : "Please report the error to Ripple."), "Oh no!", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); }; AppDomain.CurrentDomain.ProcessExit += (sender, args) => { Logger.Info("Shutting down"); NLog.LogManager.Shutdown(); }; var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "RippleServerSwitcher.log", Layout = "${longdate}:${level}:${message} ${exception:format=ToString}", DeleteOldFileOnStartup = true }; config.AddRule(NLog.LogLevel.Debug, NLog.LogLevel.Fatal, logfile); NLog.LogManager.Configuration = config; if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); bool firstProcess = true; using (Mutex mutex = new Mutex(true, guid, out firstProcess)) { if (firstProcess) { Logger.Info("Application started"); Application.Run(new MainForm()); } else { MessageBox.Show("Ripple Server Switcher is already running", "Opsie", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
/// <summary> /// This method can be used to retrieve the medicines and tests of a diagnosis /// </summary> /// <param name="diagnosis"></param> /// <param name="userObjects"></param> /// <returns></returns> public bool AddDiagnosisAndRecords(Diagnosis diagnosis, params object[] userObjects) { using (DbContextTransaction dbTransaction = db.Database.BeginTransaction()) { try { db.Diagnosis.Add(diagnosis); int diagnosisId = GetDiagnosisId(diagnosis.AppointmentId); if (userObjects.Length > 0) { if (userObjects[0] != null) { List <MedicineRecord> medicines = (List <MedicineRecord>)userObjects[0]; foreach (var medicine in medicines) { MedicineRecord medicineRecord = new MedicineRecord(); medicineRecord.MedicineId = medicine.MedicineId; medicineRecord.DiagnosisId = diagnosisId; medicineRecord.Quantity = medicine.Quantity; db.MedicineRecord.Add(medicineRecord); } } if (userObjects[1] != null) { var tests = (List <TestRecord>)userObjects[1]; foreach (var test in tests) { TestRecord testRecord = new TestRecord(); testRecord.TestId = test.TestId; testRecord.DiagnosisId = diagnosisId; db.TestRecord.Add(testRecord); } } } var appointment = db.Appointment.SingleOrDefault(t => t.Id == diagnosis.AppointmentId); appointment.AppointmentStatusId = (int)ClinicManagementSystemDOL.Enums.AppointmentStatus.Closed; appointment.ModifiedAt = DateTime.Now; db.SaveChanges(); dbTransaction.Commit(); return(true); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); dbTransaction.Rollback(); return(false); } } }
public DoctorAvailability GetDoctorInfo() { try { var DoctorInfo = db.DoctorAvailability.Include(t => t.Users).FirstOrDefault(a => a.UserId == Id && a.Users.IsDeleted == false); return(DoctorInfo); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
/// <summary> /// used to get doctor information /// </summary> /// <returns></returns> public DoctorFee GetDoctorUser() { try { var Doctor = db.DoctorFee.Include(t => t.Doctor).FirstOrDefault(a => a.Doctor.Id == Id && a.Doctor.RoleId == (int)Roles.Doctor && a.Doctor.IsDeleted == false); return(Doctor); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
public Patients GetPatientInfo() { try { var PatientInfo = db.Patients.FirstOrDefault(a => a.UserId == Id); return(PatientInfo); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
public Users GetPatientUser() { try { var Patient = db.Users.FirstOrDefault(a => a.Id == Id && a.RoleId == 4); return(Patient); } catch (Exception e) { var ravenClient = new RavenClient("https://[email protected]/1820886"); ravenClient.Capture(new SentryEvent(e)); throw e; } }
public void RegisterWithException(Issue issue, string logFileGuid) { var sentryEvent = new SentryEvent(issue.Exception) { Tags = issue.Tags }; if (issue.Message != null) { sentryEvent.Message = issue.Message; } AddDataToSentryEvent(sentryEvent, logFileGuid); _ravenClient.Capture(sentryEvent); }
/// <summary> /// Metodo para informar las Excepciones que se producen en el Sistema. /// </summary> /// <param name="ex"></param> public void informarExcepcionUsuario(Exception ex) { try { if (ex != null) { var ravenClient = new RavenClient(ConfigurationManager.AppSettings.Get("dns_sentry_nucleo")); var evento = new SentryEvent(ex); evento.Level = ErrorLevel.Warning; ravenClient.Capture(evento); } } catch (Exception e) { } }
internal static void Report(SentryEvent @event) { #if !DEBUG try { @event.Tags.Add("Arch", Environment.Is64BitOperatingSystem ? "x64" : "x86"); @event.Tags.Add("OS", Environment.OSVersion.VersionString); @event.Tags.Add("CLR", Environment.Version.ToString()); ravenClient.Capture(@event); } catch { } #endif }
static void Main(string[] args) { var ravenClient = new RavenClient("https://[email protected]/1277995"); try { int i2 = 0; int i = 10 / i2; } catch (Exception exception) { ravenClient.Capture(new SentryEvent(exception)); } }
/// <summary> /// Metodo para informar las Excepciones que se producen en el Sistema. /// </summary> /// <param name="ex"></param> public void informarExcepcion(Exception ex) { try { if (ex != null) { // // var ravenClient = new RavenClient(ConfigurationManager.AppSettings.Get("dns_sentry_nucleo")); var ravenClient = new RavenClient("https://*****:*****@sentry.io/243593"); ravenClient.Capture(new SentryEvent(ex)); } } catch (Exception e) { } }