//ListWhere
        public List <Ob_POS_KhuyenMaiKhoangGiaHoaDon> _ListWhere(string keyword, SqlConnection conn)
        {
            if (conn.ConnectionString == "")
            {
                return(null);
            }
            conn.Open();
            List <Ob_POS_KhuyenMaiKhoangGiaHoaDon> list = new List <Ob_POS_KhuyenMaiKhoangGiaHoaDon>();
            SqlCommand command = new SqlCommand
            {
                Connection  = conn,
                CommandType = CommandType.Text,
                CommandText = @"Select ID_KhoangGia, ID_KhuyenMai, TuGiaTri, DenGiaTri, GiamGiaPT, GiamGiaTien, ID_SanPham, SoLuong, ModifiedTime, ModifiedBy, CreatedTime, CreatedBy From POS_KhuyenMaiKhoangGiaHoaDon Where " + keyword + ""
            };
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Ob_POS_KhuyenMaiKhoangGiaHoaDon ob = new Ob_POS_KhuyenMaiKhoangGiaHoaDon();
                if (reader[0] != DBNull.Value)
                {
                    ob.ID_KHOANGGIA = Convert.ToInt64(reader[0]);
                }
                if (reader[1] != DBNull.Value)
                {
                    ob.ID_KHUYENMAI = Convert.ToInt32(reader[1]);
                }
                if (reader[2] != DBNull.Value)
                {
                    ob.TUGIATRI = Convert.ToDouble(reader[2]);
                }
                if (reader[3] != DBNull.Value)
                {
                    ob.DENGIATRI = Convert.ToDouble(reader[3]);
                }
                if (reader[4] != DBNull.Value)
                {
                    ob.GIAMGIAPT = Convert.ToDouble(reader[4]);
                }
                if (reader[5] != DBNull.Value)
                {
                    ob.GIAMGIATIEN = Convert.ToDouble(reader[5]);
                }
                if (reader[6] != DBNull.Value)
                {
                    ob.ID_SANPHAM = Convert.ToInt64(reader[6]);
                }
                if (reader[7] != DBNull.Value)
                {
                    ob.SOLUONG = Convert.ToInt32(reader[7]);
                }
                if (reader[8] != DBNull.Value)
                {
                    ob.MODIFIEDTIME = Convert.ToDateTime(reader[8]);
                }
                if (reader[9] != DBNull.Value)
                {
                    ob.MODIFIEDBY = Convert.ToString(reader[9]);
                }
                if (reader[10] != DBNull.Value)
                {
                    ob.CREATEDTIME = Convert.ToDateTime(reader[10]);
                }
                if (reader[11] != DBNull.Value)
                {
                    ob.CREATEDBY = Convert.ToString(reader[11]);
                }
                list.Add(ob);
            }
            command.Dispose();
            command = null;
            reader.Dispose();
            reader = null;
            conn.Close();
            return(list);
        }
        //ListAll
        public List <Ob_POS_KhuyenMaiKhoangGiaHoaDon> _ListAll_sp(string StoredName, SqlConnection conn)
        {
            if (conn.ConnectionString == "")
            {
                return(null);
            }
            conn.Open();
            List <Ob_POS_KhuyenMaiKhoangGiaHoaDon> list = new List <Ob_POS_KhuyenMaiKhoangGiaHoaDon>();
            SqlCommand command = new SqlCommand
            {
                Connection  = conn,
                CommandType = CommandType.Text,
                CommandText = StoredName
            };
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Ob_POS_KhuyenMaiKhoangGiaHoaDon ob = new Ob_POS_KhuyenMaiKhoangGiaHoaDon();
                if (reader[0] != DBNull.Value)
                {
                    ob.ID_KHOANGGIA = Convert.ToInt64(reader[0]);
                }
                if (reader[1] != DBNull.Value)
                {
                    ob.ID_KHUYENMAI = Convert.ToInt32(reader[1]);
                }
                if (reader[2] != DBNull.Value)
                {
                    ob.TUGIATRI = Convert.ToDouble(reader[2]);
                }
                if (reader[3] != DBNull.Value)
                {
                    ob.DENGIATRI = Convert.ToDouble(reader[3]);
                }
                if (reader[4] != DBNull.Value)
                {
                    ob.GIAMGIAPT = Convert.ToDouble(reader[4]);
                }
                if (reader[5] != DBNull.Value)
                {
                    ob.GIAMGIATIEN = Convert.ToDouble(reader[5]);
                }
                if (reader[6] != DBNull.Value)
                {
                    ob.ID_SANPHAM = Convert.ToInt64(reader[6]);
                }
                if (reader[7] != DBNull.Value)
                {
                    ob.SOLUONG = Convert.ToInt32(reader[7]);
                }
                if (reader[8] != DBNull.Value)
                {
                    ob.MODIFIEDTIME = Convert.ToDateTime(reader[8]);
                }
                if (reader[9] != DBNull.Value)
                {
                    ob.MODIFIEDBY = Convert.ToString(reader[9]);
                }
                if (reader[10] != DBNull.Value)
                {
                    ob.CREATEDTIME = Convert.ToDateTime(reader[10]);
                }
                if (reader[11] != DBNull.Value)
                {
                    ob.CREATEDBY = Convert.ToString(reader[11]);
                }
                list.Add(ob);
            }
            command.Dispose();
            command = null;
            reader.Dispose();
            reader = null;
            conn.Close();
            return(list);
        }