Example #1
0
 private void btnSua_Click(object sender, EventArgs e)
 {
     if (lvwSanPhamMua.SelectedItems.Count > 0)
     {
         ListViewItem item            = lvwSanPhamMua.SelectedItems[0];
         String       maGiay          = item.SubItems[2].Text.ToString();
         int          soLuongNhapCu   = int.Parse(item.SubItems[4].Text.ToString());
         float        phanTramGiamGia = float.Parse(item.SubItems[5].Text.ToString());
         String[]     giaString       = item.SubItems[6].Text.ToString().Split(" ");
         float        gia             = float.Parse(giaString[0]);
         int          soLuongConlai   = 0;
         DataTable    dt = busChiTietDonDatHang.getMaGiayandSoLuongByMaHoaDon(this.maDonDatHang);
         if (dt.Rows.Count > 0)
         {
             foreach (DataRow row in dt.Rows)
             {
                 soLuongConlai = int.Parse(row[2].ToString());
             }
         }
         int soLuongToiDa = soLuongNhapCu + soLuongConlai;
         Tool_NhapSoLuongDatHang toolNhapSoLuongDatHang = new Tool_NhapSoLuongDatHang(this.maDonDatHang, maGiay, soLuongToiDa, soLuongNhapCu, phanTramGiamGia, gia);
         toolNhapSoLuongDatHang.ShowDialog();
         if (toolNhapSoLuongDatHang.isClickThem)
         {
             loadDataChiTIetHoaDon();
         }
     }
 }
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (lvwGiay.SelectedItems.Count > 0)
            {
                ListViewItem item            = lvwGiay.SelectedItems[0];
                String       maGiay          = item.SubItems[2].Text;
                int          soLuong         = int.Parse(item.SubItems[8].Text);
                float        gia             = float.Parse(item.SubItems[9].Text);
                float        phanTramGiamGia = float.Parse(item.SubItems[7].Text);

                Tool_NhapSoLuongDatHang toolNhapSoLuongDatHang = new Tool_NhapSoLuongDatHang(maGiay, soLuong, this.maHoaDon, phanTramGiamGia, gia);
                toolNhapSoLuongDatHang.ShowDialog();
                if (toolNhapSoLuongDatHang.isClickThem)
                {
                    loadDataGiay();
                }
            }
        }