// // GET: /Comm/ public ActionResult Select(string type) { string keywords = Request.Params["keywords"] ?? ""; ViewBag.type = (type ?? "").Trim().ToLower(); object model = null; switch (type) { case "manager": model = new Ruanal.WebDomain.BLL.ManagerBll().GetManagerTop(1000); break; case "node": model = new Ruanal.WebDomain.BLL.NodeBll().GetAllNode(); break; case "task": model = new Ruanal.WebDomain.BLL.TaskBll().GetAllTask(); break; case "enterprise": model = new Ruanal.WebDomain.BLL.BusinessBll().GetEnterprise(100, keywords); break; } ViewBag.model = model; return(View(model)); }
protected override void OnAuthorization(AuthorizationContext filterContext) { var value = filterContext.RequestContext.HttpContext.Request.Headers.Get("Authorization"); if (string.IsNullOrWhiteSpace(value)) { filterContext.Result = ApiError("请登录!"); return; } var kv = value.Split(" ".ToArray(), 2); if (kv.Length != 2 || kv[0] != "Basic") { filterContext.Result = ApiError("请登录!"); return; } kv = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(kv[1])).Split(":".ToArray(), 2); if (kv.Length != 2) { filterContext.Result = ApiError("请登录!"); return; } Ruanal.WebDomain.BLL.ManagerBll managerbll = new Ruanal.WebDomain.BLL.ManagerBll(); var model = managerbll.LoginIn(kv[0], kv[1]); if (model == null) { filterContext.Result = ApiError("登录失败!"); return; } base.OnAuthorization(filterContext); }
public ActionResult Login(string loginname, string loginpwd) { try { ViewBag.loginname = loginname; if (string.IsNullOrEmpty(loginname)) { throw new Exception("请输入登录名"); } Ruanal.WebDomain.BLL.ManagerBll managerbll = new Ruanal.WebDomain.BLL.ManagerBll(); var model = managerbll.LoginIn(loginname, loginpwd); if (model == null) { throw new Exception("登录失败!"); } LoginTokenModel tokenmodel = new LoginTokenModel() { Id = model.ManagerId, Name = model.Name, SubName = model.SubName ?? "" }; string name = Utils.SerializeObject(tokenmodel); FormsAuthentication.SetAuthCookie(name, false, "/"); return(RedirectToAction("index", "home")); } catch (Exception ex) { ViewBag.msg = ex.Message; return(View()); } }
public ActionResult Profile() { Ruanal.WebDomain.BLL.ManagerBll bll = new Ruanal.WebDomain.BLL.ManagerBll(); var model = bll.GetManagerDetail(Token.Id); ViewBag.manager = model; return(View()); }
public ActionResult Profile(string oldpwd, string newpwd, string newpwd2) { oldpwd = (oldpwd ?? "").Trim(); newpwd = (newpwd ?? "").Trim(); newpwd2 = (newpwd2 ?? "").Trim(); if (newpwd != newpwd2) { ViewBag.msg = "两次密码不一致!"; return(View()); } Ruanal.WebDomain.BLL.ManagerBll bll = new Ruanal.WebDomain.BLL.ManagerBll(); try { bool isok = bll.ChangePwd(Token.Id, oldpwd, newpwd); ViewBag.msg = "修改成功"; return(View()); } catch (Exception ex) { ViewBag.msg = ex.Message; return(View()); } }