private void btnBack_Click(object sender, EventArgs e)
        {
            GlobalVariables.Sessions_Search_Flag = 0;
            Sessions_Page sessions = new Sessions_Page();

            this.Hide();
            sessions.Show();
        }
Exemple #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         try
         {
             if (GlobalVariables.neulogProcess.HasExited == false)
             {
                 GlobalVariables.neulogProcess.Kill();
             }
         }
         catch (Exception)
         {
         }
         try
         {
             if (GlobalVariables.sessionProcess.HasExited == false)
             {
                 var simProc = Process.GetProcesses().Where(pr => pr.ProcessName.Contains(GlobalVariables.sessionProcess.ProcessName));
                 foreach (var procs in simProc)
                 {
                     procs.Kill();
                 }
             }
         }
         catch (Exception)
         {
         }
         using (VivosEntities db = new VivosEntities())
         {
             List <Session> sessionList = (from x in db.Sessions select x).ToList();
             Session        new_session = new Session();
             new_session.Id              = Guid.NewGuid();
             new_session.AssetId         = GlobalVariables.Asset_Start_ID;
             new_session.PatientId       = GlobalVariables.Session_ID;
             new_session.Notes           = null;
             new_session.SessionDateTime = DateTime.Now;
             new_session.SensorData      = data;
             db.Sessions.Add(new_session);
             db.SaveChanges();
             DialogResult information = new DialogResult();
             information = MessageBox.Show(resourceManager.GetString("msgSessionAdded", GlobalVariables.uiLanguage), resourceManager.GetString("msgInformation", GlobalVariables.uiLanguage), MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         GlobalVariables.NewSessions_Search_Flag = 0;
         Sessions_Page sessions = new Sessions_Page();
         this.Hide();
         sessions.Show();
     }
     catch (Exception)
     {
     }
 }
Exemple #3
0
        private void patients_datagrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                try
                {
                    Guid id = Guid.Parse(patients_datagrid.Rows[e.RowIndex].Cells[0].Value.ToString());
                    find_notes(id);
                }
                catch (Exception)
                {
                }
            }
            else if (e.ColumnIndex == 5)
            {
                try
                {
                    GlobalVariables.Session_ID = Guid.Parse(patients_datagrid.Rows[e.RowIndex].Cells[0].Value.ToString());
                    GlobalVariables.Is_Session = true;
                    using (VivosEntities db = new VivosEntities())
                    {
                        List <Patient> patientlist1 = (from x in db.Patients where x.Id == GlobalVariables.Session_ID select x).ToList();
                        GlobalVariables.Session_ID_name = patientlist1[0].Code;
                    }
                    GlobalVariables.Sessions_Search_Flag = 0;
                    Sessions_Page sessions = new Sessions_Page();
                    this.Hide();
                    sessions.Show();
                }
                catch (Exception)
                {
                }
            }
            else if (e.ColumnIndex == 6)
            {
                try
                {
                    GlobalVariables.Edit_ID = Guid.Parse(patients_datagrid.Rows[e.RowIndex].Cells[0].Value.ToString());
                    GlobalVariables.Is_Edit = true;
                    New_Patient_Page yeni_danısan = new New_Patient_Page();
                    this.Hide();
                    yeni_danısan.Show();
                }
                catch (Exception)
                {
                }
            }
            else if (e.ColumnIndex == 7)
            {
                try
                {
                    DialogResult delete = new DialogResult();
                    delete = MessageBox.Show(resourceManager.GetString("msgIsPatientDeleted", GlobalVariables.uiLanguage), resourceManager.GetString("msgWarning", GlobalVariables.uiLanguage), MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (delete == DialogResult.Yes)
                    {
                        GlobalVariables.Edit_ID = Guid.Parse(patients_datagrid.Rows[e.RowIndex].Cells[0].Value.ToString());
                        using (VivosEntities db = new VivosEntities())
                        {
                            List <Session> sessionList = (from x in db.Sessions where x.PatientId == GlobalVariables.Edit_ID select x).ToList();
                            Session[]      sessions    = new Session[sessionList.Count];

                            for (int i = 0; i < sessions.Length; i++)
                            {
                                sessions[i] = sessionList[i];
                                db.Sessions.Remove(sessions[i]);
                            }
                            Patient patient = db.Patients.First(x => x.Id == GlobalVariables.Edit_ID);

                            db.Patients.Remove(patient);
                            db.SaveChanges();
                            GlobalVariables.Patients_Search_Flag = 0;
                            string key = null;
                            fill_datagrid(key);
                            DialogResult information = new DialogResult();
                            information = MessageBox.Show(resourceManager.GetString("msgPatientDeleted", GlobalVariables.uiLanguage), resourceManager.GetString("mesajBilgilendirme", GlobalVariables.uiLanguage), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }