Example #1
0
        private void loadDuLieu()
        {
            dgvDanhSach.Rows.Clear();

            DataTable dt = SanPhamControl.layDanhSach();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dgvDanhSach.Rows.Add(new object[] { false, dt.Rows[i][0], dt.Rows[i][1], dt.Rows[i][2], dt.Rows[i][3], dt.Rows[i][4], String.Format("{0:dd/MM/yyyy}", dt.Rows[i][5]),
                                                    String.Format("{0:dd/MM/yyyy}", dt.Rows[i][6]), dt.Rows[i][7] });
            }
        }
Example #2
0
        private void loadDanhSachSP()
        {
            dgvDanhSachSP.Rows.Clear();
            DataTable dt = SanPhamControl.layDanhSach();

            for (int i = 0; i < dt.Rows.Count; ++i)
            {
                int soluong;
                int vitri = HDB.ChiTiet.isContain(Convert.ToInt32(dt.Rows[i][0].ToString()));
                if (vitri != -1) // nếu sản phẩm có trong HDB
                {
                    soluong = Convert.ToInt32(dt.Rows[i]["SoLuong"].ToString()) - HDB.ChiTiet.ListSanPham[vitri].SoLuong;
                }
                else
                {
                    soluong = Convert.ToInt32(dt.Rows[i]["SoLuong"].ToString());
                }
                dgvDanhSachSP.Rows.Add(new object[] { dt.Rows[i][0], dt.Rows[i][1], dt.Rows[i][3], dt.Rows[i][4], soluong });
            }
        }