Пример #1
0
        public async Task <IActionResult> Create(int companyId, [Bind("Id,Name,Amount,CompanyId,CountryId")] Filials filial)
        {
            filial.CompanyId = companyId;
            if (ModelState.IsValid)
            {
                _context.Add(filial);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("Index", "Filials", new { id = companyId, name = _context.Companies.Where(c => c.Id == companyId).FirstOrDefault().Name }));
            }
            //ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "Id", filials.CompanyId);
            ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Id", filial.CountryId);
            //return View(filials);
            return(RedirectToAction("Index", "Filials", new { id = companyId, name = _context.Companies.Where(c => c.Id == companyId).FirstOrDefault().Name }));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Amount,CompanyId,CountryId")] Filials filials)
        {
            int?   companyId   = filials.CompanyId;
            string?companyName = _context.Companies.Where(c => c.Id == companyId).FirstOrDefault().Name;

            if (id != filials.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(filials);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FilialsExists(filials.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Filials", new { id = companyId, name = companyName }));
            }
            ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "Id", filials.CompanyId);
            ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Id", filials.CountryId);
            return(RedirectToAction("Index", "Filials", new { id = companyId, name = companyName }));

            //return View(filials);
        }
Пример #3
0
        public MainWindow()
        {
            InitializeComponent();

            Filials.Add(new ItemFilial("Сретенка")
            {
                InfoscreenSettingsFolder          = @"\\mspo-fs-02\Infoscreen",
                LoyaltyViewerAdvertisementsFolder = @"\\mspo-infomon-2\Advertisements",
                Prefix = "mspo"
            });

            Filials.Add(new ItemFilial("Сущевка")
            {
                InfoscreenSettingsFolder          = @"\\mssu-fs-01\Infoscreen",
                LoyaltyViewerAdvertisementsFolder = @"\\mssu-plaz-r1\Advertisements",
                Prefix = "mssu"
            });

            Filials.Add(new ItemFilial("Сущевка детство")
            {
                InfoscreenSettingsFolder          = @"\\mssu-fs-01\Infoscreen",
                LoyaltyViewerAdvertisementsFolder = @"\\mssu-plaz-r2\Advertisements",
                Prefix = "mssu"
            });

            Filials.Add(new ItemFilial("Фрунзенская")
            {
                InfoscreenSettingsFolder          = @"\\mskm-fs-01\Infoscreen",
                LoyaltyViewerAdvertisementsFolder = @"\\mskm-infomon-2\Advertisements",
                Prefix = "mskm"
            });

            Filials.Add(new ItemFilial("Краснодар")
            {
                InfoscreenSettingsFolder          = @"\\kdtt-fs-01\Infoscreen",
                LoyaltyViewerAdvertisementsFolder = @"\\kdtt-infomon-02\Advertisements",
                Prefix = "kdtt"
            });

            Filials.Add(new ItemFilial("Казань")
            {
                InfoscreenSettingsFolder          = @"\\kzkk-fs-01\Infoscreen",
                LoyaltyViewerAdvertisementsFolder = @"\\kzkk-infomon-2\Advertisements",
                Prefix = "kzkk"
            });

            Filials.Add(new ItemFilial("Каменск-Уральский")
            {
                InfoscreenSettingsFolder = @"\\yekuk-fs-01\Infoscreen",
                Prefix = "yekuk"
            });

            Filials.Add(new ItemFilial("Санкт-Петербург")
            {
                InfoscreenSettingsFolder          = @"\\splp-fs-01\Infoscreen",
                LoyaltyViewerAdvertisementsFolder = @"\\splp-infomon-2\Advertisements",
                Prefix = "splp"
            });

            Filials.Add(new ItemFilial("Сочи")
            {
                InfoscreenSettingsFolder          = @"\\sctrk-fs-01\Infoscreen",
                LoyaltyViewerAdvertisementsFolder = @"\\sctrk-loyal-mon\Advertisements",
                Prefix = "sctrk"
            });

            Filials.Add(new ItemFilial("Уфа")
            {
                InfoscreenSettingsFolder          = @"\\ufkk-fs-01\Infoscreen",
                LoyaltyViewerAdvertisementsFolder = @"\\ufkk-infomon-2\Advertisements",
                Prefix = "ufkk"
            });

            foreach (ItemFilial filial in Filials)
            {
                if (Environment.MachineName.ToLower().Contains(filial.Prefix.ToLower()))
                {
                    SelectedFilial = filial;
                    break;
                }
            }

            if (SelectedFilial == null)
            {
                SelectedFilial = Filials[selectedIndex++];
            }

            DataContext = this;

            Infoscreen.Logging.ToLog(new string('-', 40));
            Infoscreen.Logging.ToLog("Запуск приложения Advertisement Manager, пользователь: " + Environment.UserName);

            Loaded  += MainWindow_Loaded;
            Closing += MainWindow_Closing;

            if (Debugger.IsAttached)
            {
                DispatcherTimer timer = new DispatcherTimer();
                timer.Interval = new TimeSpan(0, 0, 6);
                timer.Tick    += (s, a) => {
                    Console.WriteLine(DateTime.Now.ToLongTimeString() + ": " + selectedIndex);
                    if (selectedIndex == Filials.Count)
                    {
                        selectedIndex = 0;
                    }

                    SelectedFilial = Filials[selectedIndex++];
                };
                timer.Start();
            }
        }
Пример #4
0
 private void AddFilials(object obj)
 {
     Filials.Add(new FilialClass(Firmnames, FirmAddress, int.Parse(CountSotrs)));
 }