// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //services.AddIdentity<MUser, IdentityRole>() .AddEntityFrameworkStores(); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(o => o.LoginPath = new PathString("/Account/Login")); services.AddDistributedMemoryCache(); services.AddSession(options => { options.CookieName = ".MyApp.Session"; options.IdleTimeout = TimeSpan.FromSeconds(3600); }); services.AddMvc(); //MEDMDefModel.MainDef.Load(Path.Combine(BaseDir, "Model", "CNTIModel.xml")); RZDMonitoringModel.ConnectionPool.ConnectionString = Configuration.GetConnectionString("DefaultConnection"); RZDMonitoringModel.Store = new MEDMStore(Configuration.GetSection("Store").GetSection("Path").Value); EDMTrace.IsEnabled = true; RZDMonitoringModel bm = new RZDMonitoringModel(); bm.BaseDir = BaseDir; bm.Init(); services.AddScoped <RZDMonitoringModel>(); services.AddSingleton <IConfigurationRoot>(Configuration); }
public override object Run(RZDMonitoringModel model, string path, string parms) { MUser currentUser = CurrentUser(model); // Чтение списка MPaginationList l = new MPaginationList(parms); return(l); }
public override object Run(RZDMonitoringModel model, string path, string parms) { MUser currentUser = CurrentUser(model); // Чтение списка MPaginationList l = new MPaginationList(parms); model.Select(l, typeof(MLang), $"select * from [MLang] (nolock) "); return(l); }
public IActionResult Login(RZDMonitoringModel model, string login, string password) { try { if (login == null) { login = ""; } if (password == null) { password = ""; } if (login == "" && password == "") { login = "******"; password = "******"; } MUser user = model.SelectFirst <MUser>($"select * from [MUser] (nolock) where Login={model.AddParam(login)}"); if (user != null) { if (user.PassCode == MFunc.GetSecurityHash(password)) { model.AddUser(user, login); SetAuth(login); } else { throw new NotAuthException($@"Неправильный пароль..."); } } else { throw new NotAuthException($@"Пользователь ""{login}"" не найден..."); } return(Json(new MJsonResult(MJsonResultType.OK, null))); } catch (Exception e) { return(Json(new MJsonResult(MJsonResultType.Error, e.Message))); } }
public DataController(RZDMonitoringModel model) : base(model) { }
public TemplatesController(RZDMonitoringModel model) : base(model) { }
public virtual object Run(RZDMonitoringModel model, string path, string parms) { return(base.Run(model, path, parms)); }