Esempio n. 1
0
        private void btnAddNewPatient_Click(object sender, EventArgs e)
        {
            GlobalVariables.Is_Edit = false;
            New_Patient_Page yeni_danısan = new New_Patient_Page();

            this.Hide();
            yeni_danısan.Show();
        }
Esempio n. 2
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)
                {
                }
            }
        }