示例#1
0
        public JsonResult GetData()
        {
            // создадим список данных
            List <Station> stations = HomeContext.Exec(c => c.GetInfoMap()).ToList();

            return(Json(stations, JsonRequestBehavior.AllowGet));
        }
示例#2
0
文件: Startup.cs 项目: Skat32/Task_1
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, HomeContext context)
        {
            var cultureInfo = new CultureInfo("ru-RU");

            CultureInfo.DefaultThreadCurrentCulture   = cultureInfo;
            CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;

            context.Database.Migrate();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseRouting();
            app.UseStaticFiles();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
        public int GetallProjCount()
        {
            HomeContext context = HttpContext.RequestServices.GetService(typeof(RMG.Models.HomeContext)) as HomeContext;

            return(10);
            //context.GetallProjCount();
        }
示例#4
0
        public StatusViewComponent(HomeContext dbContext, IConfiguration configuration, IMemoryCache memoryCache, ILoggerFactory loggerFactory)
        {
            _dbContext   = dbContext;
            _memoryCache = memoryCache;
            _logger      = loggerFactory.CreateLogger <StatusViewComponent>();

            LastfmUserName = configuration["LastfmUser"];
            SteamId        = configuration.GetValue <ulong>("SteamID");
            TwitchUserId   = configuration.GetValue <ulong>("TwitchUserId");
            TwitchClientId = configuration["TwitchClientId"];

            var lastfmApiKey = configuration["LastfmApiKey"];
            var lastfmSecret = configuration["LastfmSharedSecret"];

            if (lastfmApiKey != null && lastfmSecret != null)
            {
                Client = new LastfmClient(lastfmApiKey, lastfmSecret, s_httpClient);
            }

            var steamWebApiKey = configuration["SteamWebApiKey"];

            if (steamWebApiKey != null)
            {
                SteamFactory = new SteamWebInterfaceFactory(steamWebApiKey);
            }
        }
示例#5
0
        public JsonResult GetGraphData()
        {
            // создадим список данных
            List <GraphModel> stations = HomeContext.Exec(c => c.GetDataForGraph()).ToList();

            return(Json(stations, JsonRequestBehavior.AllowGet));
        }
示例#6
0
        public int GetallCustomerCount()
        {
            HomeContext context = HttpContext.RequestServices.GetService(typeof(AtUi.Models.HomeContext)) as HomeContext;

            return(10);
            //context.GetallCustomerCount();
        }
示例#7
0
        public override void Action(HomeContext context)
        {
            //Not a good idea of putting Chewbacca here...

            //Set next state
            context.CurrentState = null;
        }
示例#8
0
 public Usuario Busca(string login, string senha)
 {
     using (var contexto = new HomeContext())
     {
         return(contexto.Usuarios.FirstOrDefault(u => u.Login == login && u.Senha == senha));
     }
 }
示例#9
0
 public Usuario BuscaPorId(int id)
 {
     using (var contexto = new HomeContext())
     {
         return(contexto.Usuarios.Find(id));
     }
 }
示例#10
0
 public CurrencyConverterService(IHttpClientProxy httpClientProxy, CurrencyConverterApi currencyConverter, HomeContext context)
 {
     _httpClientProxy = httpClientProxy;
     _context         = context;
     _apiKey          = currencyConverter.ApiKey;
     _url             = currencyConverter.Url;
 }
示例#11
0
 public void Atualiza(Usuario usuario)
 {
     using (var contexto = new HomeContext())
     {
         contexto.Entry(usuario).State = EntityState.Modified;
         contexto.SaveChanges();
     }
 }
示例#12
0
 public void Adiciona(Usuario usuario)
 {
     using (var context = new HomeContext())
     {
         context.Usuarios.Add(usuario);
         context.SaveChanges();
     }
 }
        public Mahasiswa DetailMahasiswa([FromQuery] string nim)
        {
            Mahasiswa   Res = new Mahasiswa();
            HomeContext obj = new HomeContext();

            Res = obj.DetailMahasiswa(nim);

            return(Res);
        }
        public IActionResult Index()
        {
            List <Mahasiswa> Res = new List <Mahasiswa>();
            HomeContext      obj = new HomeContext();

            Res = obj.GetListMahasiswa();

            return(View(Res));
        }
        public string DeleteMahasiswa([FromQuery] string nim)
        {
            string      Res = "1~Terjadi kesalahan";
            HomeContext obj = new HomeContext();

            Res = obj.DeleteMahasiswa(nim);

            return(Res);
        }
        public string EditMahasiswa([FromBody] Mahasiswa param)
        {
            string      Res = "1~Terjadi kesalahan";
            HomeContext obj = new HomeContext();

            Res = obj.EditMahasiswa(param);

            return(Res);
        }
示例#17
0
        public HomeController(HomeContext context)
        {
            _context = context;

            if (_context.Homes.Count() == 0)
            {
                _context.Homes.Add(new HomeItem());
                _context.SaveChanges();
            }
        }
示例#18
0
        public ActionResult Index()
        {
            ViewBag.con = true;
            HomeContext db   = new HomeContext();
            var         uid  = User.Identity.GetUserId();
            var         data = (from n in db.Transactions
                                where n.ApplicationUsersId == uid
                                select n).OrderByDescending(p => p.TransactionId).Take(5).ToList();

            return(View(data));
        }
        public IActionResult State()
        {
            // var context = new HomeContext(HomeEnum.Skywalker);
            var context = new HomeContext(HomeEnum.Solo);

            while (context.CurrentState != null)
            {
                context.Action();
            }

            Home viewModel = context.Home;

            return(View(viewModel));
        }
示例#20
0
 public AlarmServiceImpl(
     HttpClient client,
     HomeContext homeContext,
     Secrets secrets,
     IMemoryCache cache,
     ILogger <AlarmService> logger)
 {
     _client         = client;
     _db             = homeContext;
     _secrets        = secrets;
     _cache          = cache;
     _logger         = logger;
     _client.Timeout = TimeSpan.FromSeconds(5);
 }
示例#21
0
 public ParserImpl(
     IMemoryCache cache,
     HomeContext homeContext,
     AlarmService alarmService,
     ActiveMeasurePointService activeMeasurePointService,
     ILogger <Parser> logger)
 {
     _cache        = cache;
     _db           = homeContext;
     _alarmService = alarmService;
     _activeMeasurePointService = activeMeasurePointService;
     _logger = logger;
     _cache.TryGetValue(Strings.AlarmIds, out _alarmIds);
 }
示例#22
0
        public HomeProperty()
        {
            this.context = new HomeContext();
            InitializeComponent();

            string connectionString = "data source=.;initial catalog=HomePlatformDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework";

            this.sqlConnection = new SqlConnection(connectionString);

            this.items = new HashSet <Item>();
            foreach (var item in context.Items)
            {
                this.items.Add(item);
            }
        }
示例#23
0
        private void buttonRegister_Click(object sender, EventArgs e)
        {
            var username = this.textBoxUsername.Text;
            var password = this.textBoxPassword.Text;

            if (this.context == null)
            {
                this.buttonRegister.Text      = "Please wait...";
                this.buttonRegister.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                this.timerPleaseWait.Start();
                this.buttonRegister.Enabled = false;
                this.buttonLogin.Enabled    = false;

                this.context = new HomeContext();

                this.buttonRegister.Text      = "Register";
                this.buttonRegister.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                this.timerPleaseWait.Stop();
                //this.buttonRegister.Enabled = true;
                this.buttonLogin.Enabled = true;
            }

            var foundUser = context.Users.FirstOrDefault(l => l.Username == username);

            if (foundUser != null)
            {
                MessageBox.Show("There is user with this name!", "Existing User", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                var result = MessageBox.Show("Do you want to create new user?", "Create User", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    context.Users.Add(new User
                    {
                        Username = username,
                        Password = password
                    });
                    context.SaveChanges();
                    this.buttonLogin.Enabled = true;
                    MessageBox.Show("User successfully created!", "Created User", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
示例#24
0
文件: Program.cs 项目: Skat32/Task_2
        public static void Main(string[] args)
        {
            using (var context = new HomeContext())
            {
                context.ArticleCommonTable.Add(new ArticleCommon
                {
                    Type             = "Any",
                    ArticleTitle     = "Any",
                    ArticleFirstType = new ArticleFirstType
                    {
                        ArticleFirstTypeProperty = "Any2"
                    },
                    ArticleSecondType = new ArticleSecondType
                    {
                        ArticleSecondTypeProperty = "Any3"
                    }
                });

                context.SaveChanges();
            }
        }
示例#25
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            this.buttonLogin.Text       = "Please wait...";
            this.buttonLogin.TextAlign  = System.Drawing.ContentAlignment.MiddleLeft;
            this.buttonLogin.Enabled    = false;
            this.buttonRegister.Enabled = false;
            this.timerPleaseWait.Start();

            var username = this.textBoxUsername.Text;
            var password = this.textBoxPassword.Text;

            if (this.context == null)
            {
                this.context = new HomeContext();
            }

            var foundUser = context.Users.FirstOrDefault(l => l.Username == username && l.Password == password);

            if (foundUser != null || (username == "1" && password == "1"))
            {
                //LoggedUser.Name = foundUser.Username; TODO
                LoggedUser.Name = username;

                var everythingPanel = new Home();
                this.Hide();
                everythingPanel.Show();
                everythingPanel.Focus();
            }
            else
            {
                MessageBox.Show("Wrong credentials! Try again.", "Existing User", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.buttonRegister.Enabled = true;
            }

            this.buttonLogin.Text      = "Login";
            this.buttonLogin.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            this.timerPleaseWait.Stop();
        }
示例#26
0
        internal virtual void BottomUpPopulate(GremlinVariable terminateVariable, string property, string columnName)
        {
            if (terminateVariable == this)
            {
                return;
            }
            if (HomeContext == null)
            {
                throw new Exception();
            }

            HomeContext.PopulateColumn(GetVariableProperty(property), columnName);
            if (!(HomeContext.HomeVariable is GremlinRepeatVariable) && !HomeContext.HomeVariable.ProjectedProperties.Contains(columnName))
            {
                HomeContext.HomeVariable.ProjectedProperties.Add(columnName);
            }

            if (HomeContext.HomeVariable == null)
            {
                throw new Exception();
            }
            HomeContext.HomeVariable.BottomUpPopulate(terminateVariable, columnName, columnName);
        }
 public TruberController(HomeContext context)
 {
     dbContext = context;
 }
 public DotnetController(HomeContext context)
 {
     _context = context;
 }
示例#29
0
 public HomeController(HomeContext context)
 {
     dbContext = context;
 }
示例#30
0
 public DHTController(HomeContext context, IDHTRepository dhtRepository)
 {
     _context       = context;
     _dhtRepository = dhtRepository;
 }
示例#31
0
 //: base("Method has already returned")
 /// <summary>
 /// Create a new block result.
 /// </summary>
 /// <param name="homeContext">HomeContext identifying which mehtod actication created the block.</param>
 /// <param name="value">Value being returned.</param>
 public BlockResult(HomeContext homeContext, object value)
 {
     #if DEBUG
     if (homeContext == null)
         throw new ArgumentNullException("homeContext");
     #endif
     this.HomeContext = homeContext;
     this.Value = value;
 }