Exemplo n.º 1
0
        //delete patient history
        private void button2_Click(object sender, EventArgs e)
        {
            int       hospitalized = 0;
            int       surgery      = 0;
            ConnectDB EMRDatabase  = new ConnectDB();

            for (int i = 0; i < PMHCB_Item.Count(); i++)
            {
                if (PMHCB_Hospitalized[i] == "Yes")
                {
                    hospitalized = 1;
                }
                else
                {
                    hospitalized = 0;
                }
                if (PMHCB_Surgery[i] == "Yes")
                {
                    surgery = 1;
                }
                else
                {
                    surgery = 0;
                }
                EMRDatabase.RemoveMedHistory(PatientInfo[2], PMHCB_Item[i], hospitalized, surgery, PMHCB_Date[i]);
            }

            List <DataGridViewRow> toDelete = new List <DataGridViewRow>();

            foreach (DataGridViewRow row in dataGridView2.Rows)
            {
                DataGridViewCheckBoxCell cell = row.Cells[4] as DataGridViewCheckBoxCell;
                if ((bool)cell.EditedFormattedValue == true)
                {
                    toDelete.Add(row);
                }
            }
            foreach (DataGridViewRow row in toDelete)
            {
                dataGridView2.Rows.Remove(row);
            }
            dataGridView2.ClearSelection();
            button2.Enabled = false;
        }