示例#1
0
        public static List <clsHoaDonBan_DTO> LayDSHDBan()
        {
            List <clsHoaDonBan_DTO> dsCT = new List <clsHoaDonBan_DTO>();
            string        query          = "select * from ChiTietHDBan where TrangThai = 1";
            SqlDataReader dr             = DataProvider.Retrieve_Table(query);

            while (dr.Read())
            {
                clsHoaDonBan_DTO ct = new clsHoaDonBan_DTO();

                if (!dr.IsDBNull(0))
                {
                    ct.MaHDBan = dr.GetString(0);
                }
                if (!dr.IsDBNull(1))
                {
                    ct.MaNVLap = dr.GetString(1);
                }
                if (!dr.IsDBNull(2))
                {
                    ct.NgayLapHD = dr.GetDateTime(2);
                }
                if (!dr.IsDBNull(3))
                {
                    ct.ThanhTien = dr.GetInt32(3);
                }
                if (!dr.IsDBNull(4))
                {
                    ct.TrangThai = dr.GetBoolean(4);
                }
                dsCT.Add(ct);
            }
            DataProvider.CloseConnect();
            return(dsCT);
        }
示例#2
0
        private void btnXacNhan_Click(object sender, EventArgs e)
        {
            clsHoaDonBan_DTO    hd   = new clsHoaDonBan_DTO();
            clsChiTietHDBan_DTO cthd = new clsChiTietHDBan_DTO();

            int n = dgvHoaDon.Rows.Count;

            for (int i = 0; i < n; i++)
            {
                getData(hd, cthd, i);
                MessageBox.Show(cthd.DonGia.ToString() + ", " + cthd.MaHDBan + ", " + cthd.SoLuong.ToString());
            }
        }
示例#3
0
        void getData(clsHoaDonBan_DTO hd, clsChiTietHDBan_DTO cthd, int i)
        {
            DataGridViewRow r = dgvHoaDon.Rows[i];

            hd.MaHDBan   = autoID_HoaDonBan();
            hd.MaNVLap   = Program.NV_Login.MaNV;
            hd.NgayLapHD = DateTime.Now;
            hd.ThanhTien = Program.convertToInt(lblTongTien.Text.Substring(0, lblTongTien.Text.Length - 4));
            hd.TrangThai = true;

            cthd.MaHDBan = hd.MaHDBan;
            List <clsChiTietSanPham_DTO> ctsp = clsChiTietSanPham_BUS.Retrieve_ChiTietSanPham(r.Cells["colMaSPHD"].Value.ToString(), r.Cells["colMauHD"].Value.ToString(), r.Cells["colChatLieuHD"].Value.ToString(), r.Cells["colSizeHD"].Value.ToString());

            cthd.MaChiTietSP = ctsp[0].MaChiTietSP;
            cthd.DonGia      = Program.convertToInt(r.Cells["colGiaBanHD"].Value.ToString().Substring(0, r.Cells["colGiaBanHD"].Value.ToString().Length - 4));
            cthd.SoLuong     = Program.convertToInt(r.Cells["colSoLuongHD"].Value.ToString());
            cthd.TrangThai   = true;
        }