Esempio n. 1
0
        public BsTableDataSource <StaticsVillageGroup> QRGroupOne(QRGroupOne request)
        {
            using (var db = DbFactory.Open())
            {
                if (string.IsNullOrEmpty(request.adcd))
                {
                    throw new Exception("参数异常!");
                }
                var builder = db.From <VillageWorkingGroup>();
                builder.LeftJoin <VillageWorkingGroup, Model.Post.Post>((x, y) => x.Post == y.PostName);
                var _year = null != request.year ? request.year : System.DateTime.Now.Year;
                builder.Where <VillageWorkingGroup>(x => x.Year == _year && x.VillageADCD == request.adcd);
                builder.Where <Model.Post.Post>(w => w.PostType == "行政村防汛防台工作组");
                builder.Select("VillageWorkingGroup.*,Post.ID as Pid");
                var count = db.Count(builder);
                builder.OrderBy <Model.Post.Post>(o => o.orderId);

                var PageSize  = request.PageSize == 0 ? 15 : request.PageSize;
                var PageIndex = request.PageIndex == 0 ? 0 : (request.PageIndex) * PageSize;
                builder.Limit(PageIndex, PageSize);
                var RList  = db.Select <VillageWorkingGroupViewModel>(builder);
                var RList1 = RList.Select(w => w.Post).Distinct().ToList();
                try
                {
                    List <StaticsVillageGroup> lsvg = new List <StaticsVillageGroup>();
                    RList1.ForEach(w =>
                    {
                        StaticsVillageGroup svg = new StaticsVillageGroup();
                        svg.post = w;
                        //var fpid = RList.Where(x => x.Post == w);
                        var R      = RList.Where(x => x.Post == w).Distinct().ToList();
                        svg.postid = R.FirstOrDefault().PId;
                        List <PersonLiabel> lpl = new List <PersonLiabel>();
                        R.ForEach(y =>
                        {
                            PersonLiabel p = new PersonLiabel();
                            p.adcd         = y.VillageADCD;
                            p.name         = y.PersonLiable;
                            p.position     = y.Position;
                            p.mobile       = y.HandPhone;
                            lpl.Add(p);
                        });
                        svg.datas = lpl;
                        lsvg.Add(svg);
                    });
                    return(new BsTableDataSource <StaticsVillageGroup>()
                    {
                        rows = lsvg, total = count
                    });
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
        }
Esempio n. 2
0
 public BsTableDataSource <StaticsVillageGroup> GET(QRGroupOne request)
 {
     return(QRCodeManager.QRGroupOne(request));
 }