예제 #1
0
        private void btnHuyDV_Click(object sender, EventArgs e)
        {
            CDatDichVu dv_kh_old = timKHOld();

            foreach (int j in lvwChooseDSDV.SelectedIndices)
            {
                int vitrixoa = 0;
                foreach (CDichVu dv in dv_kh_old.Arrdv)
                {
                    if (string.Equals(dv.Smadv, lvwChooseDSDV.Items[j].Text))
                    {
                        break;
                    }
                    vitrixoa++;
                }
                dv_kh_old.Arrdv.RemoveAt(vitrixoa);
                hienthiChooseDSDV(iCMND);
                txtTongGiaTien.Text = dv_kh_old.tinhTongGiaTien().ToString();
                if (frmmng.Data.ArrDV.Count > 0)
                {
                    hienthiDSDV();
                }
                break;
            }
            foreach (CBill item in frmmng.Data.ArrBill)
            {
                if (item.Kh.CMND == iCMND)
                {
                    item.Ddv = dv_kh_old;
                    break;
                }
            }
        }
예제 #2
0
 private void btnHuyDV_Click(object sender, EventArgs e)
 {
     #region Bỏ ik
     //if (cbxHoten.SelectedIndex == -1)
     //{
     //    MessageBox.Show("Chưa chọn KH", "Error");
     //    return;
     //}
     //CDichVu a = null;
     //foreach(int j in lvwChooseDSDV.SelectedIndices)
     //{
     //    a = timDV(lvwChooseDSDV.Items[j].Text);
     //    break;
     //}
     //if(a==null)
     //{
     //    MessageBox.Show("Không thấy DV đó", "Error");
     //    return;
     //}
     //CDatDichVu dv_kh_old = timKHOld();
     //int vitrixoa = 0;
     //foreach(CDichVu dv in dv_kh_old.Arrdv)
     //{
     //    if (string.Equals(dv.Smadv, lvwChooseDSDV.Items[j].Text))
     //        break;
     //    vitrixoa++;
     //}
     //dv_kh_old.Arrdv.RemoveAt(vitrixoa);
     #endregion
     CDatDichVu dv_kh_old = timKHOld();
     foreach (int j in lvwChooseDSDV.SelectedIndices)
     {
         int vitrixoa = 0;
         foreach (CDichVu dv in dv_kh_old.Arrdv)
         {
             if (string.Equals(dv.Smadv, lvwChooseDSDV.Items[j].Text))
             {
                 break;
             }
             vitrixoa++;
         }
         dv_kh_old.Arrdv.RemoveAt(vitrixoa);
         hienthiChooseDSDV(iCMND);
         txtTongGiaTien.Text = dv_kh_old.tinhTongGiaTien().ToString();
         if (frmmng.Data.ArrDV.Count > 0)
         {
             hienthiDSDV();
         }
         break;
     }
     foreach (CBill item in frmmng.Data.ArrBill)
     {
         if (item.Kh.CMND == iCMND)
         {
             item.Ddv = dv_kh_old;
             break;
         }
     }
 }