Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 2
0
 public CBill(CKhachHang kh, CDatPhong dp, CDatDichVu ddv, DateTime ngaythanhtoan)
 {
     m_kh            = kh;
     m_dp            = dp;
     m_ddv           = ddv;
     m_ngaythanhtoan = ngaythanhtoan;
 }
Exemplo n.º 3
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;
         }
     }
 }
Exemplo n.º 4
0
        private void btnThemDV_Click(object sender, EventArgs e)
        {
            if (cbxHoten.SelectedIndex == -1)
            {
                MessageBox.Show("Chưa chọn KH", "Error");
                return;
            }
            CDatDichVu a = timKHOld();

            if (a != null)
            {
                foreach (int j in lvwDSDV.SelectedIndices)
                {
                    CDichVu dv = new CDichVu();
                    dv.Smadv   = lvwDSDV.Items[j].Text;
                    dv.Stendv  = lvwDSDV.Items[j].SubItems[1].Text;
                    dv.Giatien = Convert.ToInt32(lvwDSDV.Items[j].SubItems[2].Text);

                    a.Arrdv.Add(dv);
                }
            }
            else
            {
                a = new CDatDichVu();
                foreach (CKhachHang item in frmmng.Data.ArrKH)
                {
                    if (item.CMND == iCMND)
                    {
                        a.Kh = item;
                        break;
                    }
                }
                foreach (int j in lvwDSDV.SelectedIndices)
                {
                    CDichVu dv = new CDichVu();
                    dv.Smadv   = lvwDSDV.Items[j].Text;
                    dv.Stendv  = lvwDSDV.Items[j].SubItems[1].Text;
                    dv.Giatien = Convert.ToInt32(lvwDSDV.Items[j].SubItems[2].Text);

                    a.Arrdv.Add(dv);
                }
                frmmng.Data.ArrDDV.Add(a);
            }
            hienthiChooseDSDV(iCMND);
            txtTongGiaTien.Text = a.tinhTongGiaTien().ToString();
            if (frmmng.Data.ArrDV.Count > 0)
            {
                hienthiDSDV();
            }

            foreach (CBill item in frmmng.Data.ArrBill)
            {
                if (item.Kh.CMND == iCMND)
                {
                    item.Ddv = a;
                    break;
                }
            }
        }
Exemplo n.º 5
0
 private void hienthiDSDDV(CDatDichVu ddv)
 {
     lvwPhong.Items.Clear();
     if (frmmng.Data.ArrBill.Count > 0)
     {
         foreach (CDichVu item in ddv.Arrdv)
         {
             ListViewItem li = lvwDichVu.Items.Add(item.Smadv);
             li.SubItems.Add(item.Stendv);
             li.SubItems.Add(item.Giatien.ToString());
         }
     }
 }
Exemplo n.º 6
0
        private CDatDichVu timKHOld()
        {
            CDatDichVu ddv_old = null;

            if (frmmng.Data.ArrDDV.Count > 0)
            {
                foreach (CDatDichVu item in frmmng.Data.ArrDDV)
                {
                    if (item.Kh.CMND == iCMND)
                    {
                        ddv_old = item;
                        break;
                    }
                }
            }
            return(ddv_old);
        }