Example #1
0
 private void TreatmentPlanEdit_FormClosed(object sender, FormClosedEventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         if (db.TreatmentPlans.Find(id) == null)
         {
             var temp1 = db.TreatmentPlanProcedures.Where(x => x.DeleteTime == null && x.TreatmentPlan_ID == id);
             List <TreatmentPlanProcedures> vplist = temp1.ToList();
             if (dataGridView1.RowCount != 0)
             {
                 foreach (TreatmentPlanProcedures vp in vplist)
                 {
                     db.TreatmentPlanProcedures.Remove(vp);
                     db.Procedures.Remove(db.Procedures.Find(vp.Procedure_ID));
                     db.WorkerProcedures.Remove(db.WorkerProcedures.Where(x => x.Procedure_ID == vp.Procedure_ID).FirstOrDefault <WorkerProcedures>());
                     db.SaveChanges();
                 }
             }
             var temp2 = db.TreatmentPlanDagnosises.Where(x => x.DeleteTime == null && x.TreatmentPlan_ID == id);
             List <TreatmentPlanDagnosises> vpslist = temp2.ToList();
             if (DiagnosisesLstBx.Items.Count != 0)
             {
                 foreach (TreatmentPlanDagnosises tpd in vpslist)
                 {
                     db.TreatmentPlanDagnosises.Remove(tpd);
                     db.SaveChanges();
                 }
             }
         }
     }
 }
Example #2
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            Workers temp = new Workers();

            using (ClinicEntities1 db = new ClinicEntities1())
            {
                if (db.Workers.Find(id) == null)
                {
                    Workers w = new Workers();
                    w.Id              = id;
                    w.Name            = NameLbl.Text;
                    w.Specialization  = SpecializationLbl.Text;
                    w.TelephoneNumber = TelephoneNmbrLbl.Text;
                    db.Workers.Add(w);
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника!");
                    this.Close();
                }
                else
                {
                    var temp1 = db.Workers.Where(x => x.Id == id).FirstOrDefault <Workers>();
                    temp                 = temp1;
                    temp.Name            = NameLbl.Text;
                    temp.Specialization  = SpecializationLbl.Text;
                    temp.TelephoneNumber = TelephoneNmbrLbl.Text;
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника");
                    this.Close();
                }
            }
        }
Example #3
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            Cabinets temp = new Cabinets();

            using (ClinicEntities1 db = new ClinicEntities1())
            {
                if (db.Cabinets.Find(id) == null)
                {
                    Cabinets c = new Cabinets();
                    c.Id          = id;
                    c.Name        = NameTxtBx.Text;
                    c.Description = DescTxtBx.Text;
                    db.Cabinets.Add(c);
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника!");
                    this.Close();
                }
                else
                {
                    var temp1 = db.Cabinets.Where(x => x.Id == id).FirstOrDefault <Cabinets>();
                    temp             = temp1;
                    temp.Name        = NameTxtBx.Text;
                    temp.Description = DescTxtBx.Text;
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника");
                    this.Close();
                }
            }
        }
Example #4
0
 private void TypeOfProcedureEdit_Load(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         foreach (KindOfProcedures k in db.KindOfProcedures.ToList())
         {
             KOPcmbx.Items.Add(k.Name);
         }
         if (db.TypeOfProcedures.Find(id) != null)
         {
             TypeOfProcedures temp = db.TypeOfProcedures.Where(x => x.Id == id).FirstOrDefault <TypeOfProcedures>();
             NameLbl.Text          = temp.Name;
             KOPcmbx.SelectedIndex = Convert.ToInt16(temp.KindOfProcedure_ID - 1);
             PriceLbl.Text         = Convert.ToString(temp.Price);
             DescLbl.Text          = temp.Description;
         }
         else
         {
             PriceLbl.Text   = "0";
             SaveBtn.Enabled = false;
             TypeOfProcedures t = new TypeOfProcedures();
             t.Id                  = db.TypeOfProcedures.Count() + 1;
             Currentid             = Convert.ToInt16(t.Id);
             KOPcmbx.SelectedIndex = 0;
         }
     }
 }
Example #5
0
 private void WorkingHourEdit_Load(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         FillWorkerCmbx();
         FillCabinetCmbx();
         if (db.WorkingHours.Find(id) != null)
         {
             WorkingHours temp = db.WorkingHours.Where(x => x.Id == id).FirstOrDefault <WorkingHours>();
             WorkerCmbx.Text  = temp.Workers.Name;
             CabinetCmbx.Text = temp.Cabinets.Name;
             DTPStart.Value   = Convert.ToDateTime(temp.TimeStart);
             DTPEnd.Value     = Convert.ToDateTime(temp.TimeEnd);
         }
         else
         {
             Save.Enabled = false;
             WorkingHours c = new WorkingHours();
             c.Id      = db.WorkingHours.Count() + 1;
             Currentid = Convert.ToInt16(c.Id);
             WorkerCmbx.SelectedIndex  = 0;
             CabinetCmbx.SelectedIndex = 0;
         }
     }
 }
Example #6
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            TypeOfProcedures temp = new TypeOfProcedures();

            using (ClinicEntities1 db = new ClinicEntities1())
            {
                if (db.TypeOfProcedures.Find(id) == null)
                {
                    TypeOfProcedures t = new TypeOfProcedures();
                    t.Id   = id;
                    t.Name = NameLbl.Text;
                    t.KindOfProcedure_ID = db.KindOfProcedures.Find(KOPcmbx.SelectedIndex + 1).Id;
                    t.Price       = Convert.ToDouble(PriceLbl.Text);
                    t.Description = DescLbl.Text;
                    db.TypeOfProcedures.Add(t);
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника!");
                    this.Close();
                }
                else
                {
                    var temp1 = db.TypeOfProcedures.Where(x => x.Id == id).FirstOrDefault <TypeOfProcedures>();
                    temp      = temp1;
                    temp.Name = NameLbl.Text;
                    temp.KindOfProcedure_ID = KOPcmbx.SelectedIndex + 1;
                    temp.Price       = Convert.ToDouble(PriceLbl.Text);
                    temp.Description = DescLbl.Text;
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника");
                    this.Close();
                }
            }
        }
Example #7
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            TreatmentPlans temp = new TreatmentPlans();

            using (ClinicEntities1 db = new ClinicEntities1())
            {
                if (db.TreatmentPlans.Find(id) == null)
                {
                    TreatmentPlans t = new TreatmentPlans();
                    t.Id          = id;
                    t.Description = textBox1.Text;
                    t.Worker_ID   = db.Workers.Where(x => x.Name == workerscmbx.Text).FirstOrDefault <Workers>().Id;
                    t.Patient_ID  = db.Patients.Where(x => x.Name == PatientLbl.Text).FirstOrDefault <Patients>().Id;
                    db.TreatmentPlans.Add(t);
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника!");
                    this.Close();
                }
                else
                {
                    var temp1 = db.TreatmentPlans.Where(x => x.Id == id).FirstOrDefault <TreatmentPlans>();
                    temp             = temp1;
                    temp.Patient_ID  = db.Patients.Where(x => x.Name == PatientLbl.Text).FirstOrDefault <Patients>().Id;
                    temp.Worker_ID   = db.Workers.Where(x => x.Name == workerscmbx.Text).FirstOrDefault <Workers>().Id;
                    temp.Description = textBox1.Text;
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника!");
                    this.Close();
                }
            }
        }
Example #8
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            Patients temp = new Patients();

            using (ClinicEntities1 db = new ClinicEntities1())
            {
                if (db.Patients.Find(id) == null)
                {
                    Patients p = new Patients();
                    p.Id              = id;
                    p.Name            = textBox2.Text;
                    p.TelephoneNumber = textBox3.Text;
                    p.Height          = Convert.ToDouble(textBox4.Text);
                    p.Weight          = Convert.ToDouble(textBox5.Text);
                    p.Comment         = textBox1.Text;
                    db.Patients.Add(p);
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника!");
                    this.Close();
                }
                else
                {
                    var temp1 = db.Patients.Where(x => x.Id == id).FirstOrDefault <Patients>();
                    temp                 = temp1;
                    temp.Name            = textBox2.Text;
                    temp.TelephoneNumber = textBox3.Text;
                    temp.Height          = Convert.ToDouble(textBox4.Text);
                    temp.Weight          = Convert.ToDouble(textBox5.Text);
                    temp.Comment         = textBox1.Text;
                    db.SaveChanges();
                    MessageBox.Show("Сохранение успешно", "Ортопедическая клиника");
                    this.Close();
                }
            }
        }
Example #9
0
 private void ProcedureEdit_FormClosed(object sender, FormClosedEventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         if (db.Procedures.Find(id) == null)
         {
             var temp1 = db.WorkerProcedures.Where(x => x.DeleteTime == null && x.Procedure_ID == id);
             List <WorkerProcedures> vplist = temp1.ToList();
             if (listBox1.Items.Count != 0)
             {
                 foreach (WorkerProcedures vp in vplist)
                 {
                     db.WorkerProcedures.Remove(vp);
                     db.SaveChanges();
                 }
             }
             var temp2 = db.FilesProcedures.Where(x => x.Procedure_ID == id);
             List <FilesProcedures> fp = temp2.ToList();
             if (listBox2.Items.Count != 0)
             {
                 foreach (FilesProcedures f in fp)
                 {
                     db.FilesProcedures.Remove(f);
                     db.SaveChanges();
                 }
             }
         }
     }
 }
Example #10
0
 private void RefreshFormData(int id)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         Procedures temp = db.Procedures.Where(x => x.Id == id).FirstOrDefault <Procedures>();
         NameLbl.Text          = temp.Name;
         DescLbl.Text          = temp.Description;
         PatientLnkLbl.Text    = temp.Patients.Name;
         DateFactDTP.Value     = Convert.ToDateTime(temp.DateFact);
         DateEventDTP.Value    = Convert.ToDateTime(temp.DateEventStart);
         dateTimePicker1.Value = Convert.ToDateTime(temp.DateEventEnd);
         TimeStartDTP.Value    = Convert.ToDateTime(temp.DateEventStart);
         TimeEndDTP.Value      = Convert.ToDateTime(temp.DateEventEnd);
         KOPLbl.Text           = temp.KindOfProcedures.Name;
         TOPLkLbl.Text         = temp.TypeOfProcedures.Name;
         CabinetLkLbl.Text     = temp.Cabinets.Name;
         if (temp.IsOurs == 1)
         {
             IsOurCheck.Checked = true;
         }
         else
         {
             IsOurCheck.Checked = false;
         }
         FillListBox();
         FillFilesListBox();
     }
 }
Example #11
0
 private void DiagnosisEdit_Load(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         FillStatusCmbx();
         FillWorkersCmbx();
         if (db.Diagnosises.Find(id) != null)
         {
             Diagnosises temp = db.Diagnosises.Where(x => x.Id == id).FirstOrDefault <Diagnosises>();
             PatientLbl.Text    = temp.Patients.Name;
             WorkerCmbx.Text    = temp.Workers.Name;
             Diagnosisname.Text = temp.Name;
             DateDTP.Value      = Convert.ToDateTime(temp.Date);
             StatusCmbx.Text    = temp.Status;
             Desc.Text          = temp.Description;
         }
         else
         {
             SaveBtn.Enabled = false;
             Diagnosises c = new Diagnosises();
             c.Id      = db.Diagnosises.Count() + 1;
             Currentid = Convert.ToInt16(c.Id);
             WorkerCmbx.SelectedIndex = 0;
             StatusCmbx.SelectedIndex = 0;
         }
     }
 }
Example #12
0
 public void RefreshFormData()
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         double s = 0;
         double p = 0;
         linkLabel1.Text = db.Patients.Find(id).Name;
         var         temp1       = db.Pays.Where(x => x.Patient_ID == id);
         List <Pays> payslistsum = temp1.ToList();
         foreach (Pays q in payslistsum)
         {
             s = s + Convert.ToDouble(q.Procedures.TypeOfProcedures.Price);
         }
         Sum.Text = Convert.ToString(s);
         var         temp2        = db.Pays.Where(x => x.Patient_ID == id && x.Status == 1);
         List <Pays> payslistpaid = temp2.ToList();
         foreach (Pays w in payslistpaid)
         {
             p = p + Convert.ToDouble(w.Procedures.TypeOfProcedures.Price);
         }
         Paid.Text = Convert.ToString(p);
         debt.Text = Convert.ToString(p - s);
         FillGrid();
     }
 }
Example #13
0
 private void VisitEdit_Load(object sender, EventArgs e)
 {
     FillCmbxWithCabinets();
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         if (db.Visits.Find(id) != null)
         {
             Visits temp = db.Visits.Where(x => x.Id == id).FirstOrDefault <Visits>();
             PatientLbl.Text    = temp.Patients.Name;
             CabinetCmbx.Text   = temp.Cabinets.Name;
             dateStartDTP.Value = Convert.ToDateTime(temp.DateStart);
             DateEndDTP.Value   = Convert.ToDateTime(temp.DateEnd);
             PatientLbl.Text    = temp.Patients.Name;
             DescTxtBx.Text     = temp.Description;
             ResultTxtBx.Text   = temp.Result;
             FillGrid();
         }
         else
         {
             SaveBtn.Enabled = false;
             Visits c = new Visits();
             c.Id      = db.Visits.Count() + 1;
             Currentid = Convert.ToInt16(c.Id);
             CabinetCmbx.SelectedIndex = 0;
         }
     }
 }
Example #14
0
 private void WorkerNameLkLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         Workers    w  = db.Workers.Where(x => x.Name == WorkerNameLkLbl.Text).FirstOrDefault <Workers>();
         WorkerCard wc = new WorkerCard();
         wc.Currentid = w.Id;
         wc.ShowDialog();
     }
 }
Example #15
0
 private void RefreshFormData(int id)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         Cabinets temp = db.Cabinets.Where(x => x.Id == id).FirstOrDefault <Cabinets>();
         CabinetNameLbl.Text = temp.Name;
         DescriptionLbl.Text = temp.Description;
     }
     FillGrid();
 }
Example #16
0
 private void FileDelBtn_Click(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         FilesProcedures fp = db.FilesProcedures.Where(x => x.Procedure_ID == id && x.Path == listBox2.SelectedItem.ToString()).FirstOrDefault <FilesProcedures>();
         db.FilesProcedures.Remove(fp);
         db.SaveChanges();
         FillFilesListBox();
     }
 }
Example #17
0
 private void PatientNameLkLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         Patients    p  = db.Patients.Where(x => x.Name == PatientNameLkLbl.Text).FirstOrDefault <Patients>();
         PatientCard pc = new PatientCard();
         pc.Currentid = p.Id;
         pc.ShowDialog();
     }
 }
Example #18
0
 public void FillWorkerCmbx()
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         foreach (Workers p in db.Workers.Where(x => x.DeleteTime == null).ToList())
         {
             WorkerCmbx.Items.Add(p.Name);
         }
     }
 }
Example #19
0
 private void CabinetLkLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         Cabinets    c  = db.Cabinets.Where(x => x.Name == CabinetLkLbl.Text).FirstOrDefault <Cabinets>();
         CabinetCard cc = new CabinetCard();
         cc.Currentid = c.Id;
         cc.ShowDialog();
     }
 }
Example #20
0
 private void TOPLkLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         TypeOfProcedures    top  = db.TypeOfProcedures.Where(x => x.Name == TOPLkLbl.Text).FirstOrDefault <TypeOfProcedures>();
         TypeOfProcedureCard topc = new TypeOfProcedureCard();
         topc.Currentid = top.Id;
         topc.ShowDialog();
     }
 }
Example #21
0
 public void FillCmbxWithCabinets()
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         foreach (Cabinets c in db.Cabinets.Where(x => x.DeleteTime == null).ToList())
         {
             CabinetCmbx.Items.Add(c.Name);
         }
     }
 }
Example #22
0
 private void DelBtn_Click(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         Diagnosises c = db.Diagnosises.Where(x => x.Id == id).FirstOrDefault <Diagnosises>();
         c.DeleteTime = DateTime.Now;
         MessageBox.Show("Диагноз успешно удален!", "Ортопедическая клиника");
         db.SaveChanges();
         this.Close();
     }
 }
Example #23
0
 private void DelBtn_Click(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         TypeOfProcedures t = db.TypeOfProcedures.Where(x => x.Id == id).FirstOrDefault <TypeOfProcedures>();
         t.DeleteTime = DateTime.Now;
         MessageBox.Show("Тип процедур успешно удален!", "Ортопедическая клиника");
         db.SaveChanges();
         this.Close();
     }
 }
Example #24
0
 private void DelBtn_Click(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         Visits v = db.Visits.Where(x => x.Id == id).FirstOrDefault <Visits>();
         v.DeleteTime = DateTime.Now;
         MessageBox.Show("Приём успешно удален!", "Ортопедическая клиника");
         db.SaveChanges();
         this.Close();
     }
 }
Example #25
0
 private void button4_Click(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         Patients c = db.Patients.Where(x => x.Id == id).FirstOrDefault <Patients>();
         c.DeleteTime = DateTime.Now;
         MessageBox.Show("Пациент успешно удален!", "Ортопедическая клиника");
         db.SaveChanges();
         this.Close();
     }
 }
Example #26
0
 private void RefreshFormData(int id)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         Workers temp = db.Workers.Where(x => x.Id == id).FirstOrDefault <Workers>();
         NameLbl.Text           = temp.Name;
         SpecializationLbl.Text = temp.Specialization;
         TelephonenbmrLbl.Text  = temp.TelephoneNumber;
         FillListBox();
     }
 }
Example #27
0
 private void RefreshFormData(int id)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         TypeOfProcedures temp = db.TypeOfProcedures.Where(x => x.Id == id).FirstOrDefault <TypeOfProcedures>();
         NameLbl.Text    = temp.Name;
         KOP.Text        = db.KindOfProcedures.Find(temp.KindOfProcedure_ID).Name;
         PriceLbl.Text   = Convert.ToString(temp.Price);
         DescTxtBox.Text = temp.Description;
     }
 }
Example #28
0
 private void DelBtn_Click(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         WorkingHours w = db.WorkingHours.Where(x => x.Id == id).FirstOrDefault <WorkingHours>();
         w.DeleteTime = DateTime.Now;
         MessageBox.Show("Запись расписания успешно удалена!", "Ортопедическая клиника");
         db.SaveChanges();
         this.Close();
     }
 }
Example #29
0
 private void DelBtn_Click(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         TreatmentPlans t = db.TreatmentPlans.Where(x => x.Id == id).FirstOrDefault <TreatmentPlans>();
         t.DeleteTime = DateTime.Now;
         MessageBox.Show("План лечения успешно удален!", "Ортопедическая клиника");
         db.SaveChanges();
         this.Close();
     }
 }
Example #30
0
        private void DelCabProc_Click(object sender, EventArgs e)
        {
            int index = Convert.ToInt32(this.dataGridView7.CurrentRow.Cells[0].Value);

            using (ClinicEntities1 db = new ClinicEntities1())
            {
                CabinetProcedures cp = db.CabinetProcedures.Where(x => x.Cabinet_ID == id && x.ProcedureType_ID == index).FirstOrDefault <CabinetProcedures>();;
                db.CabinetProcedures.Remove(cp);
                db.SaveChanges();
                FillGrid();
            }
        }