Ejemplo n.º 1
0
        public ActionResult GetGateSentryRecord(GateSentryRecordSearchModel model, int searchPage)
        {
            SearchDataWithPagedDatas <GateSentryRecordSearchModel, GateSentryRecordListModel> result = new SearchDataWithPagedDatas <GateSentryRecordSearchModel, GateSentryRecordListModel>();

            result.SearchModel = model;
            result.PagedDatas  = GateSentryRecordBLL.GetPagedGateSentryRecord(result.SearchModel, searchPage, this.PageSize, CurrentStrucID);
            return(PartialView("_GateSentryRecordPagedGrid", result));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取当前单位及其子单位下的保养记录
        /// </summary>
        /// <returns></returns>
        public static AsiatekPagedList <GateSentryRecordListModel> GetPagedGateSentryRecord(GateSentryRecordSearchModel model, int searchPage, int pageSize, int currentStrucID)
        {
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@tableName", "dbo.GateSentryRecord "),
                new SqlParameter("@pageSize", pageSize),
                new SqlParameter("@currentPage", searchPage),
                new SqlParameter("@orderBy", "InOrOutTime ASC "),
                new SqlParameter("@showColumns", @" [ID] 
      ,[CarNumber] AS PlateNum
      ,[PassGate]
      ,[InOrOut]
      ,[InOrOutTime] "),
            };

            #region 筛选条件
            string conditionStr = " ";
            if (!string.IsNullOrWhiteSpace(model.PlateNum))
            {
                conditionStr += " 1=1 AND CarNumber LIKE '%" + FontHelper.StringConvert(model.PlateNum, "1") + "%'";
            }
            else
            {
                conditionStr += " 1!=1 ";
            }
            if (!string.IsNullOrWhiteSpace(model.StartTime))
            {
                conditionStr += " AND InOrOutTime >= '" + Convert.ToDateTime(model.StartTime) + "' ";
            }
            if (!string.IsNullOrWhiteSpace(model.EndTime))
            {
                conditionStr += " AND InOrOutTime <='" + Convert.ToDateTime(model.EndTime) + "' ";
            }
            if (!string.IsNullOrWhiteSpace(conditionStr))
            {
                paras.Add(new SqlParameter("@conditionStr", conditionStr));
            }
            #endregion

            paras.Add(new SqlParameter()
            {
                ParameterName = "@totalItemCount",
                Direction     = ParameterDirection.Output,
                SqlDbType     = SqlDbType.Int
            });
            paras.Add(new SqlParameter()
            {
                ParameterName = "@newCurrentPage",
                Direction     = ParameterDirection.Output,
                SqlDbType     = SqlDbType.Int
            });
            List <GateSentryRecordListModel> list = ConvertToList <GateSentryRecordListModel> .Convert(MSSQLHelper.ExecuteDataTable(CommandType.StoredProcedure, "Proc_GetPagedDatas", paras.ToArray()));

            int totalItemCount = Convert.ToInt32(paras[paras.Count - 2].Value);
            int newCurrentPage = Convert.ToInt32(paras[paras.Count - 1].Value);
            return(list.ToPagedList(newCurrentPage, pageSize, totalItemCount));
        }