Esempio n. 1
0
        public ActionResult Search(ApplyQualifySearchModel searchModel)
        {
            var data = GetSearchResult(searchModel);

            DhtmlxGrid grid = new DhtmlxGrid();
            int        pos  = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0;

            grid.AddPaging(data.TotalCount, pos);
            var buttons         = GetCurrentUserPathActions();
            var currentUserRole = GetCurrentUserRole();

            for (int i = 0; i < data.Results.Count; i++)
            {
                var           custom = data.Results[i];
                DhtmlxGridRow row    = new DhtmlxGridRow(custom.ID.ToString());
                row.AddCell(string.Empty);
                row.AddCell((pos + i + 1).ToString());//序号

                row.AddLinkJsCell(custom.UNITNAME + "/" + custom.NAME, "DetailQualifyOne(\"{0}\")".Fmt(custom.ID));
                row.AddLinkJsCell("[查看]", "DetailQualifyTwo(\"{0}\",\"{1}\")".Fmt(custom.ID, custom.UNITCODE));   //机构基本情况表
                row.AddLinkJsCell("[查看]", "DetailQualifyThree(\"{0}\",\"{1}\")".Fmt(custom.ID, custom.UNITCODE)); //法定代表人基本情况
                row.AddLinkJsCell("[查看]", "DetailQualifyFour(\"{0}\",\"{1}\")".Fmt(custom.ID, custom.UNITCODE));  //技术负责人基本情况
                row.AddLinkJsCell("[查看]", "DetailQualifyFive(\"{0}\")".Fmt(custom.ID));                           //检测类别、内容、具备相应注册工程师资格人员情况
                row.AddLinkJsCell("[查看]", "DetailQualifySix(\"{0}\")".Fmt(custom.ID));                            //专业技术人员情况总表
                row.AddLinkJsCell("[查看]", "DetailQualifySeven(\"{0}\",\"{1}\")".Fmt(custom.ID, custom.UNITCODE)); //主要仪器设备(检测项目)及其检定/校准一览表

                row.AddCell(custom.Type == "0" ? "新申请" : (custom.Type == "1" ? "资质增项" : "资质延续"));                 //申请类型

                //对机构进行修改后,进行审核操作
                if (HaveButtonFromAll(buttons, "Approval"))
                {
                    var ueu = repExp.GetByCondition(r => r.pid == Convert.ToInt32(custom.ID) && r.userid == GetCurrentUserId()).FirstOrDefault();
                    if (ueu != null && ueu.needUnitBuildingQualify == 1)
                    {
                        if (ueu.qualifystatus != 1)
                        {
                            row.AddLinkJsCell("[建设工程质量检测机构资质审核表]", "ApprovalUnitBuildingQualify(\"{0}\")".Fmt(custom.ID));
                        }
                        else
                        {
                            row.AddLinkJsCell("[建设工程质量检测机构资质审核表-已提交]", "DetailUnitBuildingQualify(\"{0}\",\"{1}\")".Fmt(ueu.shid, custom.ID));
                        }
                    }
                    else
                    {
                        row.AddCell(string.Empty);
                    }

                    if (ueu != null && ueu.needSpecialQualify == 1)
                    {
                        if (ueu.speicalstatus != 1)
                        {
                            row.AddLinkJsCell("[专项检测备案审核表]", "ApprovalSpecialQualify(\"{0}\")".Fmt(custom.ID));
                        }
                        else
                        {
                            row.AddLinkJsCell("[专项检测备案审核表-已提交]", "DetailSpecialQualify(\"{0}\",\"{1}\")".Fmt(ueu.scid, custom.ID));
                        }
                    }
                    else
                    {
                        row.AddCell(string.Empty);
                    }
                }
                else
                {
                    row.AddCell(string.Empty);
                }

                grid.AddGridRow(row);
            }

            string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting);

            return(Content(str, "text/xml"));
        }
Esempio n. 2
0
        private SearchResult <ApplyQualityUIModel> GetSearchResult(ApplyQualifySearchModel searchModel)
        {
            var predicate = PredicateBuilder.True <t_D_UserTableOne>();

            //获取分配给当前用户专家审批的资质机构
            var expertUnits = repExp.GetByCondition(p => p.userid == GetCurrentUserId());

            #region 动态查询

            if (expertUnits != null && expertUnits.Count > 0)
            {
                var pids = expertUnits.Select(e => e.pid).ToList();
                predicate = predicate.And(t => pids.Contains(t.id));
            }

            if (searchModel.Area != "-1" && !string.IsNullOrWhiteSpace(searchModel.Area))
            {
                predicate = predicate.And(t => t.area == searchModel.Area);
            }
            if (!string.IsNullOrWhiteSpace(searchModel.CheckUnitName))
            {
                predicate = predicate.And(t => t.unitCode == searchModel.CheckUnitName);
            }
            if (searchModel.CMADStartDt.HasValue)
            {
                predicate = predicate.And(t => t.time >= searchModel.CMADStartDt.Value);
            }
            if (searchModel.CMADEndDt.HasValue)
            {
                predicate = predicate.And(t => t.time <= searchModel.CMADEndDt.Value);
            }

            #endregion

            int pos   = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0;
            int count = searchModel.count.HasValue ? searchModel.count.Value : 30;

            string[] columns      = { "CheckBox", "SeqNo", "NAME", "UNITNAME" };
            string   orderby      = string.Empty;
            string   orderByAcs   = string.Empty;
            bool     isDes        = true;
            string   sortProperty = "addtime";

            PagingOptions <t_D_UserTableOne> pagingOption = new PagingOptions <t_D_UserTableOne>(pos, count, sortProperty, isDes);

            var customs = repOne.GetByConditionSort <ApplyQualityUIModel>(predicate, r => new
            {
                r.id,
                r.name,
                r.unitname,
                r.unitCode,
                r.onepath_zl,
                r.twopath_zl,
                r.threepath_zl,
                r.Fourpath_zl,
                r.fivepath_zl,
                r.Sixpath_zl,
                r.Sevenpath_zl,
                r.type
            },
                                                                          pagingOption);

            return(new SearchResult <Models.ApplyQualityUIModel>(pagingOption.TotalItems, customs));
        }