Ejemplo n.º 1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            ServiceTreatment serviceTreatment = new ServiceTreatment();

            tam = listBox1.GetItemText(listBox1.SelectedItem);
            serviceTreatment = Cons.dataContext.ServiceTreatments.Where(ma => ma.ServiceTreatmentId == luuID[listBox1.SelectedIndex]).Single();
            Cons.dataContext.ServiceTreatments.DeleteOnSubmit(serviceTreatment);
            Cons.dataContext.SubmitChanges();
            luuID.RemoveAt(listBox1.SelectedIndex);

            listBox1.Items.Remove(listBox1.SelectedItem);
        }
Ejemplo n.º 2
0
        private void btnChon_Click(object sender, EventArgs e)
        {
            ServiceTreatment serviceTreatment = new ServiceTreatment();

            listBox1.Items.Add(comboBox_DichVu.Text);

            serviceTreatment.TreatmentId = txtMaDieuTri.Text;
            serviceTreatment.ServiceId   = comboBox_DichVu.SelectedValue.ToString();
            Cons.dataContext.ServiceTreatments.InsertOnSubmit(serviceTreatment);

            Cons.dataContext.SubmitChanges();


            luuID.Add(serviceTreatment.ServiceTreatmentId);
            MessageBox.Show(luuID[0].ToString());
        }