//логин public JsonResult LogIn(string login, string pass) { var res = CoreLogic.securityManager.checkUser(login, pass); if (res.Item1) { int usid = res.Item2.Id; var bid = CoreLogic.ConvertVal(usid); if (Request != null) { Request.HttpContext.Session.Set("UsId", bid); } } return(Json(res.Item1)); }
public IActionResult Login(LoginViewModel model) { if (ModelState.IsValid) { var res = CoreLogic.securityManager.checkUser(model.Username, model.Password); if (res.Item1) { int usid = res.Item2.Id; var bid = CoreLogic.ConvertVal(usid); string sessid = HttpContext.Session.Id; HttpContext.Session.Set("userInfo", bid); ModelState.Clear(); return(Redirect(Url.Content("~/"))); } } ModelState.AddModelError("", "Неверный логин или пароль"); return(View(model)); }
public JsonResult SetReportParams(string dates, string datef, int classid, int valueid) { JSEnvelope ret = new JSEnvelope(); ret.ReturnObject = false; try { if (Request != null) { if (dates != null && datef != null) { var cid = CoreLogic.ConvertVal(classid); var vid = CoreLogic.ConvertVal(valueid); var ds = CoreLogic.GetBytes(dates); var df = CoreLogic.GetBytes(datef); Request.HttpContext.Session.Set("report_dates", ds); Request.HttpContext.Session.Set("report_datef", df); Request.HttpContext.Session.Set("report_classid", cid); Request.HttpContext.Session.Set("report_valueid", vid); ret.ReturnObject = true; } else { ret.ReturnObject = false; } } } catch (E24Exception e) { ret.Message.IsError = true; ret.Message.MessageText = e.Message; ret.Message.MessageCode = e.ExceptionCode.ToString(); } catch (Exception e) { ret.Message.IsError = true; ret.Message.MessageText = e.Message; } return(Json(ret)); }