Пример #1
0
        public MotelInfo MotelInfoIDataReader(IDataReader dr)
        {
            MotelInfo obj = new DataAccess.MotelInfo();

            obj.MotelID            = (dr["MotelID"] is DBNull) ? string.Empty : dr["MotelID"].ToString();
            obj.RealEstateOwnersID = (dr["RealEstateOwnersID"] is DBNull) ? string.Empty : dr["RealEstateOwnersID"].ToString();
            obj.RealEstateID       = (dr["RealEstateID"] is DBNull) ? string.Empty : dr["RealEstateID"].ToString();
            obj.MotelTypeID        = (dr["MotelTypeID"] is DBNull) ? string.Empty : dr["MotelTypeID"].ToString();
            obj.Name = (dr["Name"] is DBNull) ? string.Empty : dr["Name"].ToString();
            obj.RealEstateOwnersName = (dr["RealEstateOwnersName"] is DBNull) ? string.Empty : dr["RealEstateOwnersName"].ToString();
            obj.Title       = (dr["Title"] is DBNull) ? string.Empty : dr["Title"].ToString();
            obj.CreateDate  = (dr["CreateDate"] is DBNull) ? string.Empty : dr["CreateDate"].ToString();
            obj.TierNumber  = (dr["TierNumber"] is DBNull) ? string.Empty : dr["TierNumber"].ToString();
            obj.Tag         = (dr["Tag"] is DBNull) ? string.Empty : dr["Tag"].ToString();
            obj.CreateBy    = (dr["CreateBy"] is DBNull) ? string.Empty : dr["CreateBy"].ToString();
            obj.CityID      = (dr["CityID"] is DBNull) ? string.Empty : dr["CityID"].ToString();
            obj.DistrictID  = (dr["DistrictID"] is DBNull) ? string.Empty : dr["DistrictID"].ToString();
            obj.LocationID  = (dr["LocationID"] is DBNull) ? string.Empty : dr["LocationID"].ToString();
            obj.Description = (dr["Description"] is DBNull) ? string.Empty : dr["Description"].ToString();
            obj.Address     = (dr["Address"] is DBNull) ? string.Empty : dr["Address"].ToString();
            obj.Price       = (dr["Price"] is DBNull) ? string.Empty : dr["Price"].ToString();
            obj.TotalArea   = (dr["TotalArea"] is DBNull) ? string.Empty : dr["TotalArea"].ToString();
            obj.IsClosed    = (dr["IsClosed"] is DBNull) ? string.Empty : dr["IsClosed"].ToString();
            obj.IsCooker    = (dr["IsCooker"] is DBNull) ? string.Empty : dr["IsCooker"].ToString();
            obj.Furniture   = (dr["Furniture"] is DBNull) ? string.Empty : dr["Furniture"].ToString();
            obj.Image1      = (dr["Image1"] is DBNull) ? string.Empty : dr["Image1"].ToString();
            obj.Image2      = (dr["Image2"] is DBNull) ? string.Empty : dr["Image2"].ToString();
            obj.Image3      = (dr["Image3"] is DBNull) ? string.Empty : dr["Image3"].ToString();
            obj.Image4      = (dr["Image4"] is DBNull) ? string.Empty : dr["Image4"].ToString();
            obj.Image5      = (dr["Image5"] is DBNull) ? string.Empty : dr["Image5"].ToString();
            obj.Image6      = (dr["Image6"] is DBNull) ? string.Empty : dr["Image6"].ToString();
            return(obj);
        }
        public List <MotelInfo> MotelInfo_GetByAll()
        {
            List <DataAccess.MotelInfo> list = new List <DataAccess.MotelInfo>();

            DataAccess.MotelInfo obj = new DataAccess.MotelInfo();
            DbCommand            cmd = db.GetStoredProcCommand("Motel_SelectAll");

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                while (dr.Read())
                {
                    list.Add(obj.MotelInfoIDataReader(dr));
                }
                dr.Close();
                dr.Dispose();
            }
            return(list);
        }
        public List <MotelInfo> MotelInfo_GetByLevel(string Level, int LevelLength)
        {
            List <DataAccess.MotelInfo> list = new List <DataAccess.MotelInfo>();

            DataAccess.MotelInfo obj = new DataAccess.MotelInfo();
            DbCommand            cmd = db.GetStoredProcCommand("sp_MotelInfo_GetByLevel", Level, LevelLength);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                while (dr.Read())
                {
                    list.Add(obj.MotelInfoIDataReader(dr));
                }
                dr.Close();
                dr.Dispose();
            }
            return(list);
        }
        public List <MotelInfo> MotelInfo_Paging(string CurentMotelInfo, string MotelInfoSize)
        {
            List <DataAccess.MotelInfo> list = new List <DataAccess.MotelInfo>();

            DataAccess.MotelInfo obj = new DataAccess.MotelInfo();
            DbCommand            cmd = db.GetStoredProcCommand("Motel_SelectPage", CurentMotelInfo, MotelInfoSize);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                while (dr.Read())
                {
                    list.Add(obj.MotelInfoIDataReader(dr));
                }
                dr.Close();
                dr.Dispose();
            }
            return(list);
        }