Example #1
0
 /// <summary>
 ///  补录数据(报表)
 /// </summary>
 /// <param name="parkcode"></param>
 /// <returns></returns>
 public List <AddRecordModel> AllAddRecord(RecordInSearch model)
 {
     //批量数据都从数据库获取 redis并不缓存此实体
     try
     {
         List <AddRecordModel> list = _iReportContext.AllAddRecord(model) as List <AddRecordModel>;
         return(list);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Example #2
0
 /// <summary>
 ///  补录数据(报表)
 /// </summary>
 /// <param name="parkcode"></param>
 /// <returns></returns>
 public List <AddRecordModel> AllAddRecord(RecordInSearch model)
 {
     //批量数据都从数据库获取 redis并不缓存此实体
     try
     {
         List <AddRecordModel> list = recorddatabaseoperate.GetFromDataBaseByPage(model) as List <AddRecordModel>;
         return(list);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Example #3
0
        public IHttpActionResult SearchRecordInRecord(RecordInRequest requestModel)
        {
            ResponseBasePaper <AddRecordModel> response = new ResponseBasePaper <AddRecordModel>()
            {
                IsSuccess      = true,
                MessageCode    = (int)ApiBaseErrorCode.API_SUCCESS,
                MessageContent = ApiBaseErrorCode.API_SUCCESS.ToString(),
                Result         = new List <AddRecordModel>()
            };

            if (string.IsNullOrWhiteSpace(requestModel.ProjectGuid) ||
                string.IsNullOrWhiteSpace(requestModel.ParkingCode) ||
                requestModel.PageIndex <= 0 || requestModel.PageSize <= 0)
            {
                response.IsSuccess      = false;
                response.MessageCode    = (int)ApiBaseErrorCode.API_PARAM_ERROR;
                response.MessageContent = "必要参数格式不对,请检查";
                return(Ok(response));
            }

            try
            {
                RecordInSearch searchModel = new RecordInSearch();
                searchModel.PageIndex   = requestModel.PageIndex;
                searchModel.PageSize    = requestModel.PageSize;
                searchModel.ProjectGuid = requestModel.ProjectGuid;
                searchModel.ParkingCode = requestModel.ParkingCode;
                searchModel.CarTypeGuid = requestModel.CarTypeGuid;
                searchModel.CarNo       = requestModel.CarNo;
                searchModel.Operator    = requestModel.Operator;
                searchModel.StrTime     = requestModel.StrTime;
                searchModel.EndTime     = requestModel.EndTime;

                List <AddRecordModel> list = _reportManager.AllAddRecord(searchModel);
                response.Result     = list;
                response.TotalCount = searchModel.TotalCount;
            }
            catch (Exception ex)
            {
                response.IsSuccess      = false;
                response.MessageCode    = (int)ApiBaseErrorCode.API_FAIL;
                response.MessageContent = "请检查参数格式是否符合";
            }
            return(Ok(response));
        }
Example #4
0
        public IList <AddRecordModel> GetFromDataBaseByPage <T>(T model)
        {
            RecordInSearch searchModel = model as RecordInSearch;

            List <AddRecordModel> list     = null;
            MysqlHelper           dbhelper = new MysqlHelper("name=parklotManager", "MySql.Data.MySqlClient");
            DataTable             table    = new DataTable();
            //入场补录列表
            string cmdText = " SELECT * FROM t_admissionrecord INNER JOIN (SELECT id FROM t_admissionrecord  {0}"
                             + $" ORDER BY id DESC LIMIT {(searchModel.PageIndex - 1) * searchModel.PageSize},{searchModel.PageSize}) AS page USING(id); ";
            //查询条件cmd
            string whereText = $" WHERE projectGuid = '{searchModel.ProjectGuid}' and parkCode = '{searchModel.ParkingCode}' ";

            if (!string.IsNullOrEmpty(searchModel.CarNo))
            {
                whereText += $" and (carNo = '{searchModel.CarNo}' or carNo like '%{searchModel.CarNo}%') ";
            }
            if (!string.IsNullOrEmpty(searchModel.CarTypeGuid))
            {
                whereText += $" and carTypeGuid = '{searchModel.CarTypeGuid}' ";
            }
            if (!string.IsNullOrEmpty(searchModel.Operator))
            {
                whereText += $" and operator = '{searchModel.Operator}' ";
            }
            if (searchModel.StrTime != null && searchModel.StrTime != DateTime.MinValue)
            {
                whereText += $" and recordTime >= '{searchModel.StrTime}' ";
            }
            if (searchModel.EndTime != null && searchModel.EndTime != DateTime.MinValue)
            {
                whereText += $" and recordTime <= '{searchModel.StrTime}' ";
            }
            cmdText = string.Format(cmdText, whereText);

            //总条数cmd
            string cmdTextCount = "SELECT COUNT(*) FROM t_admissionrecord " + whereText;

            long count = (long)dbhelper.ExecuteScalar(cmdTextCount);

            if (count <= 0)
            {
                return(list);
            }
            searchModel.TotalCount = count;

            table = dbhelper.ExecuteDataTable(cmdText);
            if (table == null || table.Rows.Count <= 0)
            {
                return(list);
            }
            list = new List <AddRecordModel>();
            foreach (DataRow item in table.Rows)
            {
                AddRecordModel csm = new AddRecordModel()
                {
                    ProjectGuid = item["projectGuid"].ToString(),
                    ParkingCode = item["parkCode"].ToString(),
                    CarNo       = item["carNo"].ToString(),
                    CarTypeGuid = item["carTypeGuid"].ToString(),
                    Entrance    = item["entrance"].ToString(),
                    InTime      = Convert.ToDateTime(item["entranceTime"].ToString()),
                    RecordTime  = Convert.ToDateTime(item["recordTime"].ToString()),
                    Operator    = item["operator"].ToString()
                };

                list.Add(csm);
            }
            table.Clear();
            return(list);
        }