コード例 #1
0
        private Func <QueryContainerDescriptor <HNKY_CUR>, QueryContainer> FilterQuery(CheckStatisHNKYSearchModel model)
        {
            List <string> customIds = new List <string>();

            if (!model.Area.IsNullOrEmpty())
            {
                var areas = model.Area.Split(',').ToList();
                foreach (var item in areas)
                {
                    var customId = customRep.GetByConditon <string>(t => t.area == item, t => new { t.ID });
                    for (int i = 0; i < customId.Count; i++)
                    {
                        customIds.Add(customId[i]);
                    }
                }
                //customIds = customRep.GetByConditon<string>(t => t.area == model.Area, t => new { t.ID });// = customRep.GetByConditonPage<string>(t => t.area == model.Area, r => new { r.Id }, null, null);
            }
            Func <QueryContainerDescriptor <HNKY_CUR>, QueryContainer> filterQuery = q =>
            {
                QueryContainer initQuery = q.Exists(qe => qe.Field(qef => qef.SYSPRIMARYKEY));

                string dtFormatStr = "yyyy-MM-dd'T'HH:mm:ss";
                string startDtStr  = model.StartDt.HasValue ? model.StartDt.Value.ToString(dtFormatStr) : string.Empty;
                string endDtStr    = model.EndDt.HasValue ? model.EndDt.Value.AddDays(1).ToString(dtFormatStr) : string.Empty;

                if (!startDtStr.IsNullOrEmpty())
                {
                    initQuery = initQuery && +q.DateRange(d => d.Field(f => f.CHECKDATE).GreaterThanOrEquals(DateMath.FromString(startDtStr)));
                }
                if (!endDtStr.IsNullOrEmpty())
                {
                    initQuery = initQuery && +q.DateRange(d => d.Field(f => f.CHECKDATE).LessThan(DateMath.FromString(endDtStr)));
                }
                if (!model.CUSTOMID.IsNullOrEmpty())
                {
                    initQuery = initQuery && q.Term(qt => qt.Field(qtf => qtf.CUSTOMID).Value(model.CUSTOMID));
                }
                if (!model.YANGHUTIAOJIAN.IsNullOrEmpty())
                {
                    initQuery = initQuery && q.Term(qt => qt.Field(qtf => qtf.YANGHUTIAOJIAN).Value(model.YANGHUTIAOJIAN));
                }
                if (!customIds.IsNullOrEmpty())
                {
                    initQuery = initQuery && q.Terms(qt => qt.Field(qtf => qtf.CUSTOMID).Terms(customIds));
                }
                if (!model.SHEJIDENGJI.IsNullOrEmpty())
                {
                    initQuery = initQuery && q.Term(qt => qt.Field(qtf => qtf.SHEJIDENGJI).Value(model.SHEJIDENGJI));
                }
                if (!model.ProjectName.IsNullOrEmpty())
                {
                    initQuery = initQuery && q.QueryString(m => m.DefaultField(f => f.PROJECTNAME).Query("{0}{1}{0}".Fmt("*", model.ProjectName)));
                }
                if (model.qiangduwuxiao.HasValue && model.qiangduwuxiao == 1)
                {
                    initQuery = initQuery && q.Term(t => t.Field(tt => tt.QIANGDUDAIBIAOZHI).Value("无效"));
                }
                if (!model.BAIFENBIStart.IsNullOrEmpty())
                {
                    initQuery = initQuery && q.Range(t => t.Field(tt => tt.BAIFENGBI).GreaterThanOrEquals(double.Parse(model.BAIFENBIStart)));
                }
                if (!model.BAIFENBIEnd.IsNullOrEmpty())
                {
                    initQuery = initQuery && q.Range(t => t.Field(tt => tt.BAIFENGBI).LessThanOrEquals(double.Parse(model.BAIFENBIEnd)));
                }
                if (!model.LINQIStart.IsNullOrEmpty())
                {
                    initQuery = initQuery && q.Range(t => t.Field(tt => tt.LINQI).GreaterThanOrEquals(double.Parse(model.LINQIStart)));
                }
                if (!model.LINQIEnd.IsNullOrEmpty())
                {
                    initQuery = initQuery && q.Range(t => t.Field(tt => tt.LINQI).LessThanOrEquals(double.Parse(model.LINQIEnd)));
                }
                return(initQuery);
            };

            return(filterQuery);
        }
コード例 #2
0
        public ActionResult Search(QualifysixSearchModel model)
        {
            int pos   = model.posStart.HasValue ? model.posStart.Value : 0;
            int count = model.count.HasValue ? model.count.Value : 30;
            PagingOptions <t_D_UserTableSix> pagingOption = new PagingOptions <t_D_UserTableSix>(pos, count, t => new { t.id });
            DhtmlxGrid grid         = new DhtmlxGrid();
            var        userTableSix = repSix.GetByCondition(r => r.pid == model.pid);

            grid.AddPaging(pagingOption.TotalItems, pos);
            int index           = pos + 1;
            var currentUserRole = GetCurrentUserRole();

            List <int?> Ids = new List <int?>();

            foreach (var item in userTableSix)
            {
                if (item.PeopleId.HasValue)
                {
                    Ids.Add(item.PeopleId.Value);
                }
            }

            var fileUrls = peopleRep.GetByConditon <PeopleSearchModel>(t => Ids.Contains(t.id), t => new { t.id, t.educationpath, t.selfnumPath, t.titlepath, t.PostPath });


            foreach (var item in userTableSix)
            {
                var           data  = JsonConvert.DeserializeObject <ApplyQualifSixData>(item.gzjl);
                var           rowId = item.PeopleId.HasValue ? item.PeopleId.Value : item.id;
                DhtmlxGridRow row   = new DhtmlxGridRow(rowId);
                //row.AddCell(index);
                row.AddCell(data.xm);
                row.AddCell(data.xb);
                row.AddCell(data.nl);
                row.AddCell(data.zw);
                row.AddCell(data.xl);
                row.AddCell(data.zy);
                row.AddCell(data.zc);
                row.AddCell(data.sfzhm);
                row.AddCell(data.sgzsh);
                row.AddCell(data.csjflb);
                row.AddCell(data.csjfnx);
                row.AddCell(data.shbxzh);
                row.AddCell(data.xlpath);
                row.AddCell(data.zcpath);
                row.AddCell(data.sfzhmpath);
                row.AddCell(data.sgzshpath);
                if (Ids.Contains(item.PeopleId))
                {
                    var fileUrl = fileUrls.Where(t => t.id == item.PeopleId);
                    if (fileUrl != null && fileUrl.Count() > 0)
                    {
                        var filePath = fileUrl.First();
                        Dictionary <string, string> dict = new Dictionary <string, string>();
                        if (!filePath.educationpath.IsNullOrEmpty())
                        {
                            dict.Add("学历证书", "uploadFile(\"{0}\")".Fmt(filePath.educationpath));
                        }
                        if (!filePath.titlepath.IsNullOrEmpty())
                        {
                            dict.Add("职称证书", "uploadFile(\"{0}\")".Fmt(filePath.titlepath));
                        }
                        if (!filePath.PostPath.IsNullOrEmpty())
                        {
                            dict.Add("上岗证书", "uploadFile(\"{0}\")".Fmt(filePath.PostPath));
                        }
                        if (!filePath.selfnumPath.IsNullOrEmpty())
                        {
                            dict.Add("身份证扫描", "uploadFile(\"{0}\")".Fmt(filePath.selfnumPath));
                        }
                        row.AddLinkJsCells(dict);
                    }
                    else
                    {
                        row.AddCell(string.Empty);
                    }
                }
                else
                {
                    row.AddCell(string.Empty);
                }
                row.AddCell(string.Empty);
                row.AddCell(string.Empty);
                if (currentUserRole.Code == "JCZXYH")
                {
                    row.AddCell(new DhtmlxGridCell("删除", false).AddCellAttribute("title", "删除"));
                }
                else
                {
                    row.AddCell(string.Empty);
                }
                index++;
                grid.AddGridRow(row);
            }
            string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting);

            return(Content(str, "text/xml"));
        }