Esempio n. 1
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public TheoHangHoa()
 {
     thh = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     theohanghoa = null;
     cn = null;
 }
Esempio n. 2
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public TheoHangHoa()
 {
     thh         = null;
     Sql         = null;
     conn        = null;
     cmd         = null;
     arr         = null;
     dr          = null;
     theohanghoa = null;
     cn          = null;
 }
Esempio n. 3
0
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.TheoHangHoa[] Select()
        {
            Entities.TheoHangHoa[] arrC = null;
            try
            {
                thh = new Constants.TheoHangHoa();
                Sql = new Constants.Sql();
                string sql = Sql.TheoHangHoa;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                dr   = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr  = new ArrayList();
                while (dr.Read())
                {
                    theohanghoa             = new Entities.TheoHangHoa();
                    theohanghoa.MaHangHoa   = dr[thh.MaHangHoa].ToString();
                    theohanghoa.NgayBatDau  = Convert.ToDateTime(dr[thh.NgayBatDau].ToString());
                    theohanghoa.NgayKetThuc = Convert.ToDateTime(dr[thh.NgayKetThuc].ToString());
                    theohanghoa.GiaBanBuon  = dr[thh.GiaBanBuon].ToString();
                    theohanghoa.GiaBanLe    = dr[thh.GiaBanLe].ToString();
                    theohanghoa.GhiChu      = dr[thh.GhiChu].ToString();
                    arr.Add(theohanghoa);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return(null);
                }
                arrC = new Entities.TheoHangHoa[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.TheoHangHoa)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(arrC);
        }
Esempio n. 4
0
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.TheoHangHoa[] Select()
        {
            Entities.TheoHangHoa[] arrC = null;
            try
            {
                thh = new Constants.TheoHangHoa();
                Sql = new Constants.Sql();
                string sql = Sql.TheoHangHoa;
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    theohanghoa = new Entities.TheoHangHoa();
                    theohanghoa.MaHangHoa = dr[thh.MaHangHoa].ToString();
                    theohanghoa.NgayBatDau = Convert.ToDateTime(dr[thh.NgayBatDau].ToString());
                    theohanghoa.NgayKetThuc =Convert.ToDateTime( dr[thh.NgayKetThuc].ToString());
                    theohanghoa.GiaBanBuon = dr[thh.GiaBanBuon].ToString();
                    theohanghoa.GiaBanLe = dr[thh.GiaBanLe].ToString();
                    theohanghoa.GhiChu = dr[thh.GhiChu].ToString();
                    arr.Add(theohanghoa);
                }
                int n = arr.Count;
                if (n == 0) { return null; }
                arrC = new Entities.TheoHangHoa[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.TheoHangHoa)arr[i];
                }
                }

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