Exemple #1
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public BaoCaoNhapHangTheoMatHang()
 {
     kh        = null;
     Sql       = null;
     conn      = null;
     cmd       = null;
     arr       = null;
     dr        = null;
     khachhang = null;
     cn        = null;
 }
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public BaoCaoNhapHangTheoMatHang()
 {
     kh = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     khachhang = null;
     cn = null;
 }
Exemple #3
0
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.BaoCaoNhapHangTheoMatHang[] Select()
        {
            Entities.BaoCaoNhapHangTheoMatHang[] arrC = null;
            try
            {
                kh  = new Constants.BaoCapNhapHangTheoMatHang();
                Sql = new Constants.Sql();
                string sql = Sql.BaoCaoNhapHangTheoMatHang;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                dr   = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr  = new ArrayList();
                while (dr.Read())
                {
                    Entities.BaoCaoNhapHangTheoMatHang khachhang = new Entities.BaoCaoNhapHangTheoMatHang();
                    khachhang.MaKho        = dr[kh.MaKho].ToString();
                    khachhang.MaHoaDonNhap = dr[kh.MaHoaDonNhap].ToString();
                    khachhang.TenHangHoa   = dr[kh.TenHangHoa].ToString();
                    khachhang.NgayNhap     = Convert.ToDateTime(dr[kh.NgayNhap].ToString());
                    khachhang.SoLuong      = Convert.ToInt32(dr[kh.SoLuong].ToString());
                    khachhang.TongTien     = (float.Parse)(dr[kh.TongTien].ToString());
                    arr.Add(khachhang);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return(null);
                }
                arrC = new Entities.BaoCaoNhapHangTheoMatHang[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.BaoCaoNhapHangTheoMatHang)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(arrC);
        }
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.BaoCaoNhapHangTheoMatHang[] Select()
        {
            Entities.BaoCaoNhapHangTheoMatHang[] arrC = null;
            try
            {
                kh = new Constants.BaoCapNhapHangTheoMatHang();
                Sql = new Constants.Sql();
                string sql = Sql.BaoCaoNhapHangTheoMatHang;
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
            while (dr.Read())
            {
                Entities.BaoCaoNhapHangTheoMatHang khachhang = new Entities.BaoCaoNhapHangTheoMatHang();
                khachhang.MaKho = dr[kh.MaKho].ToString();
                khachhang.MaHoaDonNhap = dr[kh.MaHoaDonNhap].ToString();
                khachhang.TenHangHoa = dr[kh.TenHangHoa].ToString();
                khachhang.NgayNhap = Convert.ToDateTime(dr[kh.NgayNhap].ToString());
                khachhang.SoLuong =Convert.ToInt32( dr[kh.SoLuong].ToString());
                khachhang.TongTien =(float.Parse) (dr[kh.TongTien].ToString());
                arr.Add(khachhang);
            }
            int n = arr.Count;
            if (n == 0) { return null; }
            arrC = new Entities.BaoCaoNhapHangTheoMatHang[n];
            for (int i = 0; i < n; i++)
            {
                arrC[i] = (Entities.BaoCaoNhapHangTheoMatHang)arr[i];
            }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return arrC;
        }