示例#1
0
        public List <AppParameter> AppGetParameter(int companyId)
        {
            waterdataEntities      entity    = new waterdataEntities();
            IQueryable <parameter> query     = entity.parameter.Where(s => s.company_id == companyId);
            List <AppParameter>    parameter = new List <AppParameter>();
            string           parametername   = null;
            WaterDataService service         = new WaterDataService();

            foreach (var item in query)
            {
                parametername = service.ToChinese(item.parameter_name);
                parameter.Add(new AppParameter()
                {
                    ParameterId   = item.parameter_id.ToString(),
                    ParameterName = parametername
                });
            }
            return(parameter);
        }
示例#2
0
        public List <Parameter> GetParameter(string loginName)
        {
            waterdataEntities      entity      = new waterdataEntities();
            users                  user        = entity.users.FirstOrDefault(s => s.login_name == loginName);
            IQueryable <parameter> query       = entity.parameter.Where(s => s.company_id == user.company_id);
            List <Parameter>       paramaters  = new List <Parameter>();
            string                 chparameter = null;

            foreach (var item in query)
            {
                chparameter = new WaterDataService().ToChinese(item.parameter_name);
                paramaters.Add(new Parameter()
                {
                    ParameterId   = item.parameter_id.ToString(),
                    ParameterName = chparameter,
                    CompanyId     = item.company_id.ToString(),
                    UpLimit       = item.uplimit.ToString(),
                    LowLimit      = item.lowlimit.ToString()
                });
            }
            return(paramaters);
        }
示例#3
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="loginName"></param>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        public List <WaterData> GetPagingExData(string loginName, int page, int limit)
        {
            waterdataEntities entity           = new waterdataEntities();
            users             objuser          = entity.users.SingleOrDefault(s => s.login_name == loginName);
            IQueryable <task> taskquery        = entity.task.Where(s => s.user_id == objuser.user_id);
            List <WaterData>  datas            = new List <WaterData>();
            WaterDataService  waterdataservice = new WaterDataService();
            string            parameterName    = null;

            foreach (var task in taskquery)
            {
                IQueryable <water_data> dataquery = entity.water_data.Where(s => s.task_id == task.task_id && (s.parameter_value > s.parameter.uplimit || s.parameter_value < s.parameter.lowlimit)).OrderByDescending(s => s.create_time);
                foreach (var data in dataquery)
                {
                    parameterName = ToChinese(data.parameter.parameter_name);
                    datas.Add(new WaterData()
                    {
                        TaskId         = task.task_id.ToString(),
                        TaskName       = task.task_name,
                        ParameterId    = data.parameter_id.ToString(),
                        ParameterName  = parameterName,
                        ParameterValue = data.parameter_value.ToString(),
                        Longitude      = data.longitude.ToString(),
                        Latitude       = data.latitude.ToString(),
                        CreateTime     = data.create_time.ToString(),
                        WaterDataId    = data.watedata_id.ToString()
                    });
                }
            }
            int strat = (page - 1) * limit;
            int end   = strat + limit;
            List <WaterData> newdatas = new List <WaterData>();

            for (int i = strat; i < end && i < datas.Count; i++)
            {
                newdatas.Add(datas[i]);
            }
            return(newdatas);
        }