Beispiel #1
0
        public HttpResponseMessage GetDeviceList([FromBody] Model.dt_item_adq param)
        {
            param.user_id = CurrentUser.USERID;
            int startIdx = (param.pagenum - 1) * param.pagesize;
            int endIdx   = startIdx + param.pagesize;

            resObj.data = new BLL.dt_item().GetListByPage2(param, " addtime desc", startIdx, endIdx);
            return(Json(resObj));
        }
Beispiel #2
0
        /// <summary>
        /// LIST result
        /// </summary>
        /// <param name="strWhere"></param>
        /// <param name="orderby"></param>
        /// <param name="startIndex"></param>
        /// <param name="endIndex"></param>
        /// <returns></returns>
        public List <Model.dt_item> GetListByPage2(Model.dt_item_adq adq, string orderby, int startIndex, int endIndex)
        {
            string strWhere = string.Empty;

            if (adq.user_id.HasValue)
            {
                strWhere += " and user_id=" + adq.user_id;
            }
            if (!string.IsNullOrWhiteSpace(adq.devicename))
            {
                strWhere += $" and (name like '%{adq.devicename}%' or addr like '%{adq.devicename}%')";
            }
            var ds   = dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
            var data = (from DataRow dr in ds.Tables[0].Rows select new DBRowConvertor(dr).ConvertToEntity <Model.dt_item>()).ToList();

            return(data);
        }