Esempio n. 1
0
        public ActionResult Search(STCheckEquipModels model)
        {
            var        data = GetSearchResult(model);
            DhtmlxGrid grid = new DhtmlxGrid();
            int        pos  = model.posStart.HasValue ? model.posStart.Value : 0;

            grid.AddPaging(data.TotalCount, pos);
            var buttons     = GetCurrentUserPathActions();
            var allSTUnit   = GetCurrentInstsST();
            var compayTypes = sysDictServcie.GetDictsByKey("customStatus");

            for (int i = 0; i < data.Results.Count; i++)
            {
                var           equip = data.Results[i];
                var           start = equip.timestart.HasValue? GetUIDtString(equip.timestart.Value, "yyyy-MM-dd"):"";
                var           end   = equip.timeend.HasValue? GetUIDtString(equip.timeend.Value, "yyyy-MM-dd"): "";
                DhtmlxGridRow row   = new DhtmlxGridRow(equip.id.ToString());
                row.AddCell("");
                row.AddCell(pos + i + 1);
                row.AddCell(equip.EquName + equip.Equtype + equip.Equspec);
                row.AddCell(sTCustomService.GetSTUnitByIdFromAll(allSTUnit, equip.customid));
                if (start != "" && end != "")
                {
                    row.AddCell(start + "至" + end);
                }
                else
                {
                    row.AddCell(string.Empty);
                }

                row.AddCell(SysDictUtility.GetKeyFromDic(compayTypes, equip.approvalstatus));
                Dictionary <string, string> dict = new Dictionary <string, string>();
                if (HaveButtonFromAll(buttons, "ApplyChange") && sTCheckEquipService.CanApplyChangeCustom(equip.approvalstatus))
                {
                    dict.Add("[申请修改]", "applyChange({0},\"{1}\")".Fmt(equip.id, equip.EquName));
                }

                if (HaveButtonFromAll(buttons, "ConfirmApplyChange") && (equip.approvalstatus == "5"))
                {
                    dict.Add("[审核申请修改]", "confirmApplyChange({0},\"{1}\")".Fmt(equip.id, equip.EquName));
                }
                row.AddLinkJsCells(dict);
                if (HaveButtonFromAll(buttons, "Edit") && (equip.approvalstatus == "0" || equip.approvalstatus == "5"))// && checkUnitService.CanEditCustom(custom.APPROVALSTATUS))
                {
                    row.AddCell(new DhtmlxGridCell("编辑", false).AddCellAttribute("title", "编辑"));
                }
                else
                {
                    row.AddCell(string.Empty);
                }
                row.AddCell(new DhtmlxGridCell("查看", false).AddCellAttribute("title", "查看"));
                grid.AddGridRow(row);
            }
            string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting);

            return(Content(str, "text/xml"));
        }
        public ActionResult Search(STCheckPeopleSearchModel model)
        {
            var        data = GetSearchResult(model);
            DhtmlxGrid grid = new DhtmlxGrid();
            int        pos  = model.posStart.HasValue ? model.posStart.Value : 0;

            grid.AddPaging(data.TotalCount, pos);
            var buttons     = GetCurrentUserPathActions();
            var allSTUnit   = GetCurrentInstsST();
            var compayTypes = sysDictServcie.GetDictsByKey("customStatus");

            for (int i = 0; i < data.Results.Count; i++)
            {
                var           people = data.Results[i];
                DhtmlxGridRow row    = new DhtmlxGridRow(people.Id.ToString());
                row.AddCell("");
                row.AddCell(pos + i + 1);
                row.AddCell(people.Name);
                row.AddCell(sTCustomService.GetSTUnitByIdFromAll(allSTUnit, people.Customid));
                row.AddCell(people.SelfNum);
                row.AddCell(people.PostNum);
                row.AddCell(people.Tel);
                row.AddCell(SysDictUtility.GetKeyFromDic(compayTypes, people.Approvalstatus));
                Dictionary <string, string> dict = new Dictionary <string, string>();
                if (HaveButtonFromAll(buttons, "ApplyChange") && sTCheckPeopleService.CanApplyChangeCustom(people.Approvalstatus))
                {
                    dict.Add("[申请修改]", "applyChange({0},\"{1}\")".Fmt(people.Id, people.Name));
                }

                if (HaveButtonFromAll(buttons, "ConfirmApplyChange") && (people.Approvalstatus == "5"))
                {
                    dict.Add("[审核申请修改]", "confirmApplyChange({0},\"{1}\")".Fmt(people.Id, people.Name));
                }
                row.AddLinkJsCells(dict);
                if (HaveButtonFromAll(buttons, "Edit") && (people.Approvalstatus == "0" || people.Approvalstatus == "6"))// && checkUnitService.CanEditCustom(custom.APPROVALSTATUS))
                {
                    row.AddCell(new DhtmlxGridCell("编辑", false).AddCellAttribute("title", "编辑"));
                }
                else
                {
                    row.AddCell(string.Empty);
                }
                row.AddCell(new DhtmlxGridCell("查看", false).AddCellAttribute("title", "查看"));
                grid.AddGridRow(row);
            }
            string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting);

            return(Content(str, "text/xml"));
        }
Esempio n. 3
0
        private string GetGridXmlString(List <Role> roles)
        {
            DhtmlxGrid grid = new DhtmlxGrid();

            int index = 1;

            foreach (var item in roles)
            {
                DhtmlxGridRow row = new DhtmlxGridRow(item.Id.ToString());
                row.AddCell(index.ToString());
                row.AddCell(item.Name);
                row.AddCell(item.Description);
                row.AddCell(item.Code);
                row.AddLinkJsCells(GetOpDicts(item.Id.ToString()));
                row.AddCell(new DhtmlxGridCell("编辑", false).AddCellAttribute("title", "编辑"));
                row.AddCell(new DhtmlxGridCell("删除", false).AddCellAttribute("title", "删除"));
                grid.AddGridRow(row);

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

            return(str);
        }
        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"));
        }
Esempio n. 5
0
        public ActionResult Search(SysViewSearchModels searchModel)
        {
            var predicate     = PredicateBuilder.True <UserAsRole>();
            var predicateRole = PredicateBuilder.True <UserInRole>();

            if (!string.IsNullOrWhiteSpace(searchModel.CheckUnitName))
            {
                predicate = predicate.And(t => t.CustomId == searchModel.CheckUnitName);
            }
            if (!string.IsNullOrWhiteSpace(searchModel.UserDisplayName))
            {
                predicate = predicate.And(t => t.UserDisplayName.Contains(searchModel.UserDisplayName));
            }
            if (!string.IsNullOrWhiteSpace(searchModel.UserName))
            {
                predicate = predicate.And(t => t.UserName == searchModel.UserName);
            }
            if (!string.IsNullOrWhiteSpace(searchModel.CheckStatus))
            {
                predicate = predicate.And(t => t.CheckStatus == searchModel.CheckStatus);
            }
            if (!string.IsNullOrEmpty(searchModel.RoleNames))
            {
                var allRoles = roleRep.GetByCondition(r => searchModel.RoleNames.Split(',').ToList().Contains(r.Name)).Select(s => s.Id).ToList();
                predicate = predicate.And(t => allRoles.Contains(t.RoleId));
            }
            else
            {
                var allRoles = roleRep.GetByCondition(t => t.Code != "QYY" && t.Code != "JYY").Select(s => s.Id).ToList();
                predicate = predicate.And(t => allRoles.Contains(t.RoleId));
            }
            //if(string.IsNullOrWhiteSpace(searchModel.Valie))
            //{
            //    predicate = predicate.And(t => t.Valie == searchModel.Valie);
            //}
            int pos   = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0;
            int count = searchModel.count.HasValue ? searchModel.count.Value : 30;


            PagingOptions <UserAsRole> pagingOption = new PagingOptions <UserAsRole>(pos, count, u => new { u.Id });
            var users      = userAsRoleRep.GetByConditonPage(predicate, pagingOption);
            var userTypes  = sysDictService.GetDictsByKey("UserType");
            var userStatus = sysDictService.GetDictsByKey("UserStatus");
            var allInsts   = checkUnitService.GetAllCheckUnit();
            var userValie  = sysDictService.GetDictsByKey("Valid");
            var allRole    = roleRep.GetByCondition(u => true);

            DhtmlxGrid grid = new DhtmlxGrid();

            grid.AddPaging(pagingOption.TotalItems, pos);
            for (int i = 0; i < users.Count; i++)
            {
                var           oneUser = users[i];
                DhtmlxGridRow row     = new DhtmlxGridRow(oneUser.Id);
                row.AddCell((pos + i + 1).ToString());
                row.AddCell(oneUser.UserDisplayName);
                if (oneUser.RoleId == 3 || oneUser.RoleId == 5)
                {
                    row.AddCell(oneUser.UnitName);
                }
                else if (string.IsNullOrWhiteSpace(oneUser.CustomId) || !allInsts.ContainsKey(oneUser.CustomId.ToUpper()))
                {
                    row.AddCell("系统用户");
                }
                else
                {
                    row.AddCell(allInsts[oneUser.CustomId]);
                }

                row.AddCell(oneUser.UserName);
                row.AddCell(SysDictUtility.GetKeyFromDic(userValie, oneUser.Valie));
                row.AddCell(SysDictUtility.GetKeyFromDic(userStatus, oneUser.Status, "禁止"));
                var a = allRole.Where(u => u.Id == oneUser.RoleId);
                row.AddCell(allRole.Where(u => u.Id == oneUser.RoleId).Select(u => u.Name).FirstOrDefault().ToString());
                //row.AddCell(oneUser.CheckStatus == "1" ? "已审核" : "未审核");

                row.AddLinkJsCell("自定义模块", "personModule({0})".Fmt(oneUser.Id));
                row.AddLinkJsCell("自定义按钮", "personAction({0})".Fmt(oneUser.Id));
                if (superVisorRoleCode.Contains(userService.GetUserRole(oneUser.Id).Code))
                {
                    row.AddLinkJsCell("自定义机构", "personInst({0},\"{1}\")".Fmt(oneUser.Id, oneUser.UserDisplayName));
                }
                else
                {
                    row.AddCell(string.Empty);
                }
                row.AddLinkJsCell("密码重置", "PaswordRest({0})".Fmt(oneUser.Id));
                row.AddLinkJsCells(GetOpDicts(oneUser));
                grid.AddGridRow(row);
            }
            string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting);

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