예제 #1
0
        private void DelProcedureBtn_Click(object sender, EventArgs e)
        {
            int index = Convert.ToInt32(this.dataGridView1.CurrentRow.Cells[0].Value);

            using (ClinicEntities1 db = new ClinicEntities1())
            {
                VisitProcedures cp = db.VisitProcedures.Where(x => x.Visit_ID == id && x.Procedure_ID == index).FirstOrDefault <VisitProcedures>();
                db.VisitProcedures.Remove(cp);
                db.SaveChanges();
                FillGrid();
            }
        }
예제 #2
0
 private void AddProcedureBtn_Click(object sender, EventArgs e)
 {
     using (ClinicEntities1 db = new ClinicEntities1())
     {
         ProcedureEdit procedureedit = new ProcedureEdit();
         procedureedit.ShowDialog();
         VisitProcedures temp = new VisitProcedures();
         temp.Visit_ID     = id;
         temp.Procedure_ID = procedureedit.Currentid;
         db.VisitProcedures.Add(temp);
         db.SaveChanges();
     }
     FillGrid();
 }