public ActionResult SSOPoolDisplay(int poolId)
        {
            ISSOPoolService service = new SSOPoolService();
            var displayModel = service.GetDisplayModel(poolId);

            return View(displayModel);
        }
        public ActionResult DomainAdd()
        {
            List<SelectListItem> selectList = new List<SelectListItem>()
            {
                new SelectListItem(){ Text="一级域名",Value="1",Selected=true },
                new SelectListItem(){ Text="二级域名",Value="2"},
                new SelectListItem(){ Text="三级域名",Value="3" }
            };
            ViewData["DomainLevel"] = selectList;
            List<SelectListItem> poolSelectList = new List<SelectListItem>()
            {
                new SelectListItem(){ Text="请选择",Value="0",Selected=true }
            };
            ISSOPoolService service = new SSOPoolService();
            var poolList = service.GetSSOPoolList();
            foreach (var item in poolList)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = item.PoolName,
                    Value = item.PoolId.ToString()
                };
                poolSelectList.Add(selectItem);
            }
            ViewData["SSOPoolPoolId"] = poolSelectList;

            return View();
        }
 public ActionResult SSOPoolDelete(int id)
 {
     ISSOPoolService service = new SSOPoolService();
     var jsonModel = service.DeleteSSOPool(id);
     if (jsonModel.Success)
     {
         return Json(new { success = true, msg = "删除成功" }, JsonRequestBehavior.AllowGet);
     }
     else
     {
         return Json(new { success = false, msg = jsonModel.ErrMsg }, JsonRequestBehavior.AllowGet);
     }
 }
 public ActionResult SSOPoolAdd(SSOPoolAddModel addModel)
 {
     ISSOPoolService service = new SSOPoolService();
     var jsonModel = service.AddSSOPool(addModel);
     if (jsonModel.Success)
     {
         return Json(new { success = true, msg = "添加成功" }, JsonRequestBehavior.AllowGet);
     }
     else
     {
         return Json(new { success = false, msg = jsonModel.ErrMsg }, JsonRequestBehavior.AllowGet);
     }
 }
 public ActionResult ChangePoolEnabled()
 {
     int poolId = DotNet.Utils.Untility.ConvertFactory.ToInt32(HttpUtility.HtmlEncode(Request["poolId"]),0);
     int isEnabled = DotNet.Utils.Untility.ConvertFactory.ToInt32(HttpUtility.HtmlEncode(Request["isEnabled"]),(int)IsEnabledEnum.Enabled);
     ISSOPoolService service = new SSOPoolService();
     var jsonModel = service.ChangeSSOPoolEnabled(poolId,isEnabled);
     if (jsonModel.Success)
     {
         return Json(new { success=true,msg="操作成功" }, JsonRequestBehavior.AllowGet);
     }
     else
     {
         return Json(new { success = true, msg = jsonModel.ErrMsg }, JsonRequestBehavior.AllowGet);
     }
 }
 public ActionResult SSOPoolEdit(int poolId)
 {
     ISSOPoolService service = new SSOPoolService();
     var model = service.GetEditModel(poolId);
     //主要的域名验证的 select
     List<SelectListItem> domainSelectList = new List<SelectListItem>();
     IDomainService domainService = new DomainService();
     var domainList = domainService.GetPoolDomain(poolId);
     domainSelectList.Add(new SelectListItem()
     {
         Text="无",
         Value="0",
         Selected=(model.MainDomainId==0)
     });
     foreach (var domain in domainList)
     {
         SelectListItem item = new SelectListItem()
         {
             Text=domain.DomainName,
             Value=domain.DomainId.ToString(),
             Selected=(domain.DomainId==model.MainDomainId)
         };
         domainSelectList.Add(item);
     }
     this.ViewData["MainDomainId"] = domainSelectList.AsEnumerable();
     return View(model);
 }
 public ActionResult SSOPoolList()
 {
     List<SelectListItem> selectItem = new List<SelectListItem>()
     {
         new SelectListItem(){ Text="全部",Value="0",Selected=true },
         new SelectListItem(){ Text="已启用",Value=((int)Model.Enum.IsEnabledEnum.Enabled).ToString() },
         new SelectListItem(){ Text="未启用",Value=((int)Model.Enum.IsEnabledEnum.Disabled).ToString() }
     };
     ViewBag.Select = selectItem;
     ISSOPoolService service = new SSOPoolService();
     SSOPoolParam parameter = new SSOPoolParam()
     {
         PageIndex = DotNet.Utils.Untility.ConvertFactory.ToInt32(HttpUtility.UrlEncode(Request["page"]), 1),
         PageSize =12,
         IsEnabled = DotNet.Utils.Untility.ConvertFactory.ToInt32(HttpUtility.UrlEncode(Request["isEnabled"]), 0),
         PoolName = HttpUtility.HtmlEncode(Request["poolName"]),
         IsPaging = true,
         PoolId = 0
     };
     var model = service.GetPagingModel(parameter);
     return View(model);
 }
 public ActionResult SSOPoolEdit(SSOPoolEditModel editModel)
 {
     ISSOPoolService service = new SSOPoolService();
     var jsonModel = service.EditSSOPool(editModel);
     if (jsonModel.Success)
     {
         return Json(new { success = true, msg = "修改成功" }, JsonRequestBehavior.AllowGet);
     }
     else
     {
         return Json(new { success = false, msg = jsonModel.ErrMsg }, JsonRequestBehavior.AllowGet);
     }
 }
        public ActionResult DomainEdit(int domainId)
        {
            IDomainService service = new DomainService();
            var model = service.GetEditModel(domainId);
            //域级别select
            List<SelectListItem> levelSelectList = new List<SelectListItem>()
            {
                new SelectListItem(){ Text="一级域名",Value="1",Selected=(model.DomainLevel==1)},
                new SelectListItem(){ Text="二级域名",Value="2",Selected=(model.DomainLevel==2)},
                new SelectListItem(){ Text="三级域名",Value="3",Selected=(model.DomainLevel==3)},
            };
            //上级域名select
            List<SelectListItem> parentSelectList = new List<SelectListItem>()
            {
                new SelectListItem(){ Text="无",Value="0",Selected=(model.ParentDomainId==0)}
            };
            if (model.DomainLevel > 1)
            {
                var domainList = service.GetListDomain(new DomainParam() { DomainLevel = model.DomainLevel - 1 });
                foreach (var domain in domainList)
                {
                    SelectListItem item = new SelectListItem()
                    {
                        Text = domain.DomainName,
                        Value = domain.DomainId.ToString(),
                        Selected = (model.ParentDomainId == domain.DomainId)
                    };
                    parentSelectList.Add(item);
                }
            }
            //单点登录池的select
            List<SelectListItem> poolSelectList = new List<SelectListItem>();
            ISSOPoolService ssoPoolService = new SSOPoolService();
            var poolList = ssoPoolService.GetSSOPoolList();
            foreach (var pool in poolList)
            {
                SelectListItem item = new SelectListItem()
                {
                    Text=pool.PoolName,
                    Value=pool.PoolId.ToString(),
                    Selected=(model.SSOPoolPoolId==pool.PoolId)
                };
                poolSelectList.Add(item);
            }

            this.ViewData["DomainLevel"] = levelSelectList;
            this.ViewData["ParentDomainId"] = parentSelectList;
            this.ViewData["SSOPoolPoolId"] = poolSelectList;
            return View(model);
        }