示例#1
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public XuatHang()
 {
     xh       = null;
     Sql      = null;
     conn     = null;
     cmd      = null;
     arr      = null;
     dr       = null;
     xuathang = null;
     cn       = null;
 }
示例#2
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public XuatHang()
 {
     xh = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     xuathang = null;
     cn = null;
 }
示例#3
0
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.XuatHang[] Select(Entities.XuatHang ct)
        {
            Entities.XuatHang[] arrC = null;
            try
            {
                xh  = new Constants.XuatHang();
                Sql = new Constants.Sql();
                string sql = Sql.XuatHang;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(xh.MaKhachHang, SqlDbType.NVarChar, 20).Value = ct.MaKhachHang;
                dr  = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    xuathang                   = new Entities.XuatHang();
                    xuathang.MaKhachHang       = dr[xh.MaKhachHang].ToString();
                    xuathang.MaHDBanHang       = dr[xh.MaHDBanHang].ToString();
                    xuathang.NgayBan           = Convert.ToDateTime(dr[xh.NgayBan].ToString());
                    xuathang.HinhThucThanhToan = dr[xh.HinhThucThanhToan].ToString();
                    xuathang.GhiChu            = dr[xh.GhiChu].ToString();
                    xuathang.TongTienThanhToan = dr[xh.TongTienThanhToan].ToString();
                    arr.Add(xuathang);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return(null);
                }
                arrC = new Entities.XuatHang[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.XuatHang)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(arrC);
        }
示例#4
0
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.XuatHang[] Select(Entities.XuatHang ct)
        {
            Entities.XuatHang[] arrC = null;
            try
            {
                xh = new Constants.XuatHang();
                Sql = new Constants.Sql();
                string sql = Sql.XuatHang;
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(xh.MaKhachHang, SqlDbType.NVarChar, 20).Value = ct.MaKhachHang;
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    xuathang = new Entities.XuatHang();
                    xuathang.MaKhachHang = dr[xh.MaKhachHang].ToString();
                    xuathang.MaHDBanHang = dr[xh.MaHDBanHang].ToString();
                    xuathang.NgayBan = Convert.ToDateTime(dr[xh.NgayBan].ToString());
                    xuathang.HinhThucThanhToan = dr[xh.HinhThucThanhToan].ToString();
                    xuathang.GhiChu = dr[xh.GhiChu].ToString();
                    xuathang.TongTienThanhToan = dr[xh.TongTienThanhToan].ToString();
                    arr.Add(xuathang);
                }
                int n = arr.Count;
                if (n == 0) { return null; }
                arrC = new Entities.XuatHang[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.XuatHang)arr[i];
                }
            }

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