Beispiel #1
0
        private void gvAdditionItem_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = (DataGridView)sender;

            if (dgv.Columns[e.ColumnIndex].Name == "colDel")
            {
                trn_patient_add_item item = (trn_patient_add_item)dgv.Rows[e.RowIndex].DataBoundItem;
                bsPatientAddItem.Remove(item);
                bsPatientAddItem.EndEdit();
                foreach (CheckBox cb in groupBox5.Controls)
                {
                    try
                    {
                        int?tag = (int?)Convert.ToInt32(cb.Tag);
                        if (tag == item.tpai_seq)
                        {
                            cb.Checked = false;
                            break;
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Beispiel #2
0
        private void btnAdditionItem_Click(object sender, EventArgs e)
        {
            string txt = txtAdditionItem.Text.Trim();

            if (txt.Length > 0)
            {
                trn_patient_add_item item = new trn_patient_add_item
                {
                    tpai_add_item = txt
                };
                bsPatientAddItem.Add(item);
                bsPatientAddItem.EndEdit();
                txtAdditionItem.Text = "";
            }
        }
Beispiel #3
0
        private void chkItem_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox cb  = (CheckBox)sender;
            int?     seq = (int?)Convert.ToInt32(cb.Tag);

            if (cb.Checked)
            {
                trn_patient_add_item item = new trn_patient_add_item
                {
                    tpai_seq      = seq,
                    tpai_add_item = cb.Text
                };
                bsPatientAddItem.Add(item);
                bsPatientAddItem.EndEdit();
            }
            else
            {
                trn_patient_add_item item = bsPatientAddItem.OfType <trn_patient_add_item>()
                                            .Where(x => x.tpai_seq == seq)
                                            .FirstOrDefault();
                bsPatientAddItem.Remove(item);
                bsPatientAddItem.EndEdit();
            }
        }