コード例 #1
0
 public frmInPhieu(List <DTO.HangDTO> hangDTO, DTO.HoaDonDTO hoaDon, DTO.KhachHangDTO khachHang)
 {
     InitializeComponent();
     this.hoaDon    = hoaDon;
     listHang       = hangDTO;
     this.khachHang = khachHang;
     Loading();
 }
コード例 #2
0
        private void BtnInPhieu_Click(object sender, EventArgs e)
        {
            var kiemtra = lvwChiTietHoaDon.Items.Count == 0;

            if (kiemtra)
            {
                MessageBox.Show("Điền đơn hàng");
                return;
            }
            List <DTO.HangDTO> list = new List <DTO.HangDTO>();

            foreach (ListViewItem item in lvwChiTietHoaDon.Items)
            {
                DTO.HangDTO chiTietHoaDon = new DTO.HangDTO()
                {
                    StrMaHang  = item.SubItems[0].Text.ToString(),
                    StrTenHang = item.SubItems[1].Text.ToString(),
                    FltDonGia  = float.Parse(item.SubItems[2].Text.ToString()),
                    IntSoLuong = int.Parse(item.SubItems[3].Text.ToString()),
                };
                /*DTO.HangDTO chiTietHoaDon = new DTO.HangDTO(maHang, tenHang, donGia, soLuong);*/
                list.Add(chiTietHoaDon);
            }
            var khachHang = quanLyThongTin.GetKhachHangBySDT(int.Parse(txtSDTKhachHang.Text.ToString()));

            int maHD = int.Parse((((int)DateTime.Now.TimeOfDay.TotalSeconds).ToString() + ((int)DateTime.Now.DayOfYear).ToString()));

            DTO.HoaDonDTO hoaDon = new DTO.HoaDonDTO(maHD, 0, "", 0, DateTime.Now, "0");
            //
            this.Cursor = Cursors.WaitCursor;
            using (frmInPhieu inPhieu = new frmInPhieu(list, hoaDon, khachHang))
            {
                this.Cursor = Cursors.Default;
                inPhieu.ShowDialog();
            }
        }