Example #1
0
        public virtual List <UserModels> GetUserNearby(int tradeAreaId)
        {
            List <dynamic> dym       = new List <dynamic>();
            string         sqlString = "dbo.dz_User_GetUserNearby";

            SqlParameter[]    parm  = { new SqlParameter("@TradeAreaId", tradeAreaId) };
            List <UserModels> users = new List <UserModels>();
            DataTable         dtb   = SqlSeverProvider.ExecuteQuery(sqlString, CommandType.StoredProcedure, parm);

            if (dtb == null)
            {
                return(users);
            }
            foreach (DataRow row in dtb.Rows)
            {
                users.Add(new UserModels
                {
                    mobilePhone  = (string)row["u_mobilePhone"],
                    password     = row["a_tradeAreaFloor"].ToString(),
                    nickName     = (string)row["u_nickName"],
                    avatar       = (string)(row["u_avatar"] == System.DBNull.Value ? string.Empty : row["u_avatar"]),
                    positionTime = (DateTime)(row["u_positionTime"] == System.DBNull.Value ? "2013-08-12" : row["u_positionTime"])
                });
            }
            return(users);
        }
Example #2
0
        /// <summary>
        /// Get all users
        /// </summary>
        /// <returns></returns>
        public virtual List <UserModels> GetAll()
        {
            string            sqlStr = "select * from m_user";
            List <UserModels> users  = new List <UserModels>();
            DataTable         dt     = SqlSeverProvider.ExecuteQuery(sqlStr);
            UserModels        user   = null;

            foreach (DataRow row in dt.Rows)
            {
                user = new UserModels
                {
                    mobilePhone  = (string)row["u_mobilePhone"],
                    password     = (string)row["u_password"],
                    nickName     = (string)row["u_nickName"],
                    cityName     = (string)(row["u_cityName"] == System.DBNull.Value ?string.Empty: row["u_cityName"]),
                    level        = (int)(row["u_level"] == System.DBNull.Value ? "0" : row["u_level"]),
                    userPoint    = (int)(row["u_userPoint"] == System.DBNull.Value ? "0" : row["u_userPoint"]),
                    email        = (string)(row["u_email"] == System.DBNull.Value ? string.Empty : row["u_email"]),
                    avatar       = (string)(row["u_avatar"] == System.DBNull.Value ?string.Empty : row["u_avatar"]),
                    position     = (int)(row["u_position"] == System.DBNull.Value ? "-1" : row["u_position"]),
                    positionTime = (DateTime)(row["u_positionTime"] == System.DBNull.Value ? "2013-08-12" : row["u_positionTime"]),
                    registerTime = (DateTime)(row["u_registerTime"] == System.DBNull.Value ? "2013-08-12" : row["u_registerTime"])
                };
                users.Add(user);
            }
            return(users);
        }
Example #3
0
        //Method of IProvider
        public virtual List <AreaModels> GetAll()
        {
            string            sqlString = "select * from m_area";
            List <AreaModels> areas     = new List <AreaModels>();
            AreaModels        area      = null;
            DataTable         tab       = SqlSeverProvider.ExecuteQuery(sqlString);

            foreach (DataRow row in tab.Rows)
            {
                area = new AreaModels
                {
                    AreaKeyID      = (int)row["a_allAreaKeyId"],
                    TradeAreaID    = (int)row["a_tradeAreaId"],
                    TradeAreaFloor = (int)row["a_tradeAreaFloor"],
                    AradID         = (int)row["a_areaId"],
                    Category       = (int)row["a_areaCategory"],
                    StartX         = (float)row["a_startX"],
                    StartY         = (float)row["a_startY"],
                    Width          = (float)row["a_width"],
                    Height         = (float)row["a_height"],
                    IsMark         = (bool)row["a_isMark"]
                };
                areas.Add(area);
            }
            return(areas);
        }
Example #4
0
        /// <summary>
        /// Get  user by mobilePhone
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        public virtual UserModels GetByPhone(string phone)
        {
            string sqlStr = "select * from m_user where u_mobilePhone=@phone";

            SqlParameter[] parm =
            {
                new SqlParameter("@phone", phone)
            };
            DataTable  dt   = SqlSeverProvider.ExecuteQuery(sqlStr);
            UserModels user = null;

            foreach (DataRow row in dt.Rows)
            {
                user = new UserModels
                {
                    mobilePhone  = (string)row["u_mobilePhone"],
                    password     = (string)row["u_password"],
                    nickName     = (string)row["u_nickName"],
                    cityName     = (string)(row["u_cityName"] == System.DBNull.Value ? string.Empty : row["u_cityName"]),
                    level        = (int)(row["u_level"] == System.DBNull.Value ? "0" : row["u_level"]),
                    userPoint    = (int)(row["u_userPoint"] == System.DBNull.Value ? "0" : row["u_userPoint"]),
                    email        = (string)(row["u_email"] == System.DBNull.Value ? string.Empty : row["u_email"]),
                    avatar       = (string)(row["u_avatar"] == System.DBNull.Value ? string.Empty : row["u_avatar"]),
                    position     = (int)(row["u_position"] == System.DBNull.Value ? "-1" : row["u_position"]),
                    positionTime = (DateTime)(row["u_positionTime"] == System.DBNull.Value ? "2013-08-12" : row["u_positionTime"]),
                    registerTime = (DateTime)(row["u_registerTime"] == System.DBNull.Value ? "2013-08-12" : row["u_registerTime"])
                };
            }
            return(user);
        }
Example #5
0
        public virtual List <StoreModels> GetStoresByName(string name)//店铺查询
        {
            string             sqlStr     = "select * from m_store where s_storeCName like '%" + name + "%' or s_storeEName like '%" + name + "%' ";
            DataTable          dt         = SqlSeverProvider.ExecuteQuery(sqlStr);
            List <StoreModels> listStores = new List <StoreModels>();
            StoreModels        store      = null;

            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    store = new StoreModels
                    {
                        storeID     = (int)row["s_storeId"],
                        areaKeyID   = (int)row["s_areaKeyId"],
                        storeCName  = (string)(row["s_storeCName"] == DBNull.Value ? string.Empty : row["s_storeCName"]),
                        storeEName  = (string)(row["s_storeEName"] == DBNull.Value ? string.Empty : row["s_storeEName"]),
                        brandsID    = (int)row["s_brandsId"],
                        address     = (string)(row["s_address"] == DBNull.Value ? string.Empty : row["s_address"]),
                        phoneNumber = (string)(row["s_phoneNumber"] == DBNull.Value ? string.Empty : row["s_phoneNumber"]),
                        arrivalNum  = (int)row["s_arrivalNum"]
                    };
                    listStores.Add(store);
                }
                return(listStores);
            }
            return(null);
        }
Example #6
0
        /// <summary>
        /// 分类查询商铺
        /// </summary>
        /// <param name="cateID"></param>
        /// <param name="tradeAreaId"></param>
        /// <returns></returns>
        public virtual List <StoreModels> GetStoresByCategory(int cateID, int tradeAreaId)
        {
            string sqlStr = "dbo.dz_Store_GetSpecialStore";

            SqlParameter[] parm =
            {
                new SqlParameter("@TradeAreaId", tradeAreaId),
                new SqlParameter("@CategoryId",  cateID)
            };
            DataTable          dt         = SqlSeverProvider.ExecuteQuery(sqlStr, CommandType.StoredProcedure, parm);
            List <StoreModels> listStores = new List <StoreModels>();
            StoreModels        store      = null;

            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    store = new StoreModels
                    {
                        storeID     = (int)row["s_storeId"],
                        areaKeyID   = (int)row["s_areaKeyId"],
                        storeCName  = (string)(row["s_storeCName"] == DBNull.Value ? string.Empty : row["s_storeCName"]),
                        storeEName  = (string)(row["s_storeEName"] == DBNull.Value ? string.Empty : row["s_storeEName"]),
                        brandsID    = (int)row["s_brandsId"],
                        address     = (string)(row["s_address"] == DBNull.Value ? string.Empty : row["s_address"]),
                        phoneNumber = (string)(row["s_phoneNumber"] == DBNull.Value ? string.Empty : row["s_phoneNumber"]),
                        arrivalNum  = (int)row["s_arrivalNum"]
                    };
                    listStores.Add(store);
                }
                return(listStores);
            }
            return(null);
        }
Example #7
0
        //Methods of IProvider
        public List <TradeAreaModels> GetAll()
        {
            string sqlString = "select * from m_tradeArea";
            List <TradeAreaModels> trades = new List <TradeAreaModels>();
            DataTable tbl = SqlSeverProvider.ExecuteQuery(sqlString);

            if (tbl == null)
            {
                return(null);
            }
            foreach (DataRow row in tbl.Rows)
            {
                trades.Add(TradeAreaManager.GetTradeAreaByRow(row));
            }
            return(trades);
        }
Example #8
0
        public virtual BrandModels GetById(int id)
        {
            string      sqlStr = string.Format("select * from m_brands where b_brandsId={0}", id);
            BrandModels brand  = null;
            DataTable   dt     = SqlSeverProvider.ExecuteQuery(sqlStr);

            foreach (DataRow row in dt.Rows)
            {
                brand = new BrandModels
                {
                    brandsID    = (int)row["b_brandsId"],
                    chineseName = (string)(row["b_chineseName"] == System.DBNull.Value ?string.Empty : row["b_chineseName"]),
                    englishName = (string)(row["b_englisgName"] == System.DBNull.Value ? string.Empty : row["b_englisgName"]),
                    logo        = (string)(row["b_logo"] == System.DBNull.Value ? string.Empty : row["b_logo"])
                };
            }
            return(brand);
        }
Example #9
0
        public virtual List <BrandModels> GetAll()
        {
            string             sqlStr = "select * from m_brands";
            List <BrandModels> brands = new List <BrandModels>();
            DataTable          dt     = SqlSeverProvider.ExecuteQuery(sqlStr);
            BrandModels        brand  = null;

            foreach (DataRow row in dt.Rows)
            {
                brand = new BrandModels
                {
                    brandsID    = (int)row["b_brandsId"],
                    chineseName = (string)(row["b_chineseName"] == System.DBNull.Value ? string.Empty : row["b_chineseName"]),
                    englishName = (string)(row["b_englishName"] == System.DBNull.Value ? string.Empty : row["b_englishName"]),
                    logo        = (string)row["b_logo"]
                };
                brands.Add(brand);
            }
            return(brands);
        }