Exemple #1
0
        public string GetCondition(GetFactoryListReq req, string search)
        {
            var condition = $" factoryNo not in ('02','03','04','05','06','07') ";

            if (!search.IsNullOrEmpty())
            {
                //condition += " and (companyName like @search or phoneNumber like @search )";
                condition += " and factoryName like @search ";
            }
            return(condition);
        }
Exemple #2
0
        public int GetListCount(GetFactoryListReq req)
        {
            var search = req.search ?? "";
            var dict   = new Dictionary <string, string>
            {
                { "@search", $"%{search}%" },
                { "@search2", search },
            };

            var condition = GetCondition(req, search);

            var list = SqlHelper.Instance.GetMutiViewCount <FactoryType>("factoryno", condition, dict);

            //var list = SqlHelper.Instance.GetDistinctCount<FactoryType>("FactoryType", condition, dict);
            return(list.Count);
        }
Exemple #3
0
        public List <FactoryType> GetFactoryList(GetFactoryListReq req, int size)
        {
            var search = req.search ?? "";
            var order  = req.orderField;
            var desc   = Convert.ToBoolean(req.isDesc);
            var index  = Convert.ToInt32(req.pageIndex);

            var orderStr = $"order by {order} ";

            if (desc)
            {
                orderStr += " desc ";
            }
            else
            {
                orderStr += " asc ";
            }
            var dict = new Dictionary <string, string>
            {
                { "@search", $"%{search}%" },
                { "@search2", search },
            };

            var fields = "factoryno";

            if (order != fields)
            {
                fields += "," + order;
            }

            var condition = GetCondition(req, search);

            return(SqlHelper.Instance.GetMutiView <FactoryType>("factoryno", fields, condition, index, size, orderStr, dict));

            //return SqlHelper.Instance.GetViewPaging<FactoryType>("FactoryType", @"select * from FactoryType ", condition, index, size, orderStr, dict);
        }
Exemple #4
0
        public string GetFactoryList(GetFactoryListReq req)
        {
            var r = AllFunc.Instance.GetFactoryList(req);

            return(JsonConvert.SerializeObject(r));
        }