Exemplo n.º 1
0
        /// <summary>
        /// 商铺信息下拉刷新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public Dictionary <string, object> GetMerchantList(wy_houseinfo model, string userID, URole role)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            try
            {
                var list = _Db.Db().Queryable <wy_houseinfo>().Where(a => a.IS_DELETE == 0);
                if (role == URole.Admin)
                {
                    list = _Db.Db().Queryable <wy_houseinfo, ts_uidp_org, ts_uidp_org_user>((a, b, c) => new object[] {
                        JoinType.Inner, a.ORG_CODE.StartsWith(b.ORG_CODE),
                        JoinType.Inner, b.ORG_ID == c.ORG_ID && c.USER_ID == userID
                    }).Where((a, b, c) => a.IS_DELETE == 0);
                }
                else if (role == URole.Inspector)
                {
                    list = _Db.Db().Queryable <wy_houseinfo, wy_region_director>((a, b) => new object[] {
                        JoinType.Inner, a.SSQY == b.SSQY && b.RD_ID == userID,
                    }).Where((a, b) => a.IS_DELETE == 0);
                }
                if (!string.IsNullOrWhiteSpace(model.FWBH))
                {
                    list = list.Where(a => a.FWBH.Contains(model.FWBH));
                }
                if (model.FWSX != null && model.FWSX != -1)
                {
                    list = list.Where(a => a.FWSX == model.FWSX);
                }
                if (!string.IsNullOrWhiteSpace(model.SSQY))
                {
                    list = list.Where(a => a.SSQY == model.SSQY);
                }
                if (!string.IsNullOrWhiteSpace(model.LSFGS))
                {
                    list = list.Where(a => a.LSFGS == model.LSFGS);
                }
                var _list       = list.ToList();
                var count       = from p in _list where p.FWSX == 2 select p;
                var greenCount  = (from p in _list where p.FWSX == 2 select p).Count();
                var grayCount   = (from p in _list where p.FWSX == 0 select p).Count();
                var yellowCount = (from p in _list where p.FWSX == 1 select p).Count();

                var listNnew = list.Select(a => new { a.FWBH, a.FWMC, a.FWID, a.FWSX }).OrderBy(a => a.FWBH).Take(20).ToList();

                dic.Add("list", listNnew);
                dic.Add("greenCount", greenCount);
                dic.Add("grayCount", grayCount);
                dic.Add("yellowCount", yellowCount);
            }
            catch (Exception ex)
            {
                dic.Add("list", null);
                dic.Add("greenCount", 0);
                dic.Add("grayCount", 0);
                dic.Add("yellowCount", 0);
            }
            return(dic);
        }
Exemplo n.º 2
0
        public IActionResult GetMerchantList(wy_houseinfo model)
        {
            Dictionary <string, object> dic = _machantSvc.GetMerchantList(model, UserID, URoleE.Value);

            return(Json(dic));
        }