Exemplo n.º 1
0
 public List <TireSecurityCodeConfig> QuerySecurityCodeConfigModel(TireSecurityCodeConfigQuery query)
 {
     try
     {
         return(handler.QuerySecurityCodeConfigModel(query));
     }
     catch (TuhuBizException)
     {
         throw;
     }
     catch (Exception ex)
     {
         var exception = new DownloadAppException(1, "QuerySecurityCodeConfigModel", ex);
         Logger.Log(Level.Error, exception, "QuerySecurityCodeConfigModel");
         throw ex;
     }
 }
        public PartialViewResult SearchList(TireSecurityCodeConfigQuery query)
        {
            List <TireSecurityCodeConfig> list = new List <TireSecurityCodeConfig>();

            list = TireSecurityCodeConfigManager.QuerySecurityCodeConfigModel(query);

            var pager = new PagerModel(query.PageIndex, query.PageDataQuantity);

            ViewBag.query   = query;
            pager.TotalItem = query.TotalCount;

            return(PartialView(new ListModel <TireSecurityCodeConfig>()
            {
                Pager = pager,
                Source = list
            }));
        }
Exemplo n.º 3
0
        public List <TireSecurityCodeConfig> QuerySecurityCodeConfigModel(TireSecurityCodeConfigQuery query)
        {
            Func <SqlConnection, List <TireSecurityCodeConfig> > action = (connection) => DalTireSecurityCodeConfig.QuerySecurityCodeConfigModel(connection, query);

            return(dbManager.Execute(action));
        }
Exemplo n.º 4
0
        public static List <TireSecurityCodeConfig> QuerySecurityCodeConfigModel(SqlConnection conn, TireSecurityCodeConfigQuery query)
        {
            string countSql = @"SELECT Count(1) 
                            FROM [Configuration].dbo.TireSecurityCodeConfig WITH ( NOLOCK)";
            string sql      = @"SELECT * 
                            FROM [Configuration].dbo.TireSecurityCodeConfig WITH ( NOLOCK)";
            string addsql   = "";

            if (!string.IsNullOrWhiteSpace(query.SecurityCodeCriterion))
            {
                addsql += @" SecurityCode LIKE N'%" + query.SecurityCodeCriterion + "%' ";
            }
            if (!string.IsNullOrWhiteSpace(query.UCodeCriterion))
            {
                if (addsql != "")
                {
                    addsql += " and ";
                }
                addsql += @" UCode LIKE N'%" + query.UCodeCriterion + "%' ";
            }
            if (!string.IsNullOrWhiteSpace(query.FCodeCriterion))
            {
                if (addsql != "")
                {
                    addsql += " and ";
                }
                addsql += @" FCode LIKE N'%" + query.FCodeCriterion + "%' ";
            }
            if (!string.IsNullOrWhiteSpace(query.BarCodeCriterion))
            {
                if (addsql != "")
                {
                    addsql += " and ";
                }
                addsql += @" BarCode LIKE N'%" + query.BarCodeCriterion + "%' ";
            }
            if (!string.IsNullOrWhiteSpace(query.GuidCriterion))
            {
                if (addsql != "")
                {
                    addsql += " and ";
                }
                addsql += @" CodeID LIKE N'%" + query.GuidCriterion + "%'";
            }

            if (addsql != "")
            {
                sql      += " where ";
                countSql += " where ";
            }
            sql = sql + addsql +
                  @" ORDER BY CreateTime DESC OFFSET @pagesdata ROWS FETCH NEXT @pagedataquantity ROWS ONLY";
            countSql = countSql + addsql;

            var sqlParam = new[]
            {
                new SqlParameter("@pagesdata", (query.PageIndex - 1) * query.PageDataQuantity),
                new SqlParameter("@pagedataquantity", query.PageDataQuantity),
            };

            query.TotalCount = (int)SqlHelper.ExecuteScalar(conn, CommandType.Text, countSql, sqlParam);
            return(SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql, sqlParam).ConvertTo <TireSecurityCodeConfig>().ToList());
        }