예제 #1
0
        public IActionResult Post(SolverViewModel solution)
        {
            var alreadyDone = false;

            if (!string.IsNullOrWhiteSpace(solution.CaptchaSolution.Name) && !string.IsNullOrWhiteSpace(solution.CaptchaSolution.Solution))
            {
                var jsonFile         = _env.ContentRootPath + "/solutions.json";
                var jsonData         = System.IO.File.ReadAllText(jsonFile);
                var captchaSolutions = JsonConvert.DeserializeObject <CaptchaSolutionWrapper>(jsonData);
                foreach (CaptchaSolution solutions in captchaSolutions.Solutions)
                {
                    if (solutions.Name == solution.CaptchaItem.Name)
                    {
                        alreadyDone = true;
                    }
                }
                if (!alreadyDone)
                {
                    captchaSolutions.Solutions.Add(solution.CaptchaSolution);
                    jsonData = JsonConvert.SerializeObject(captchaSolutions);
                    System.IO.File.WriteAllText(jsonFile, jsonData);
                }
                DeleteCaptchaFromCaptchasJson(solution.CaptchaSolution.Name);
            }
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public IActionResult Index()
        {
            CaptchaRequester requester     = new CaptchaRequester();
            var             captchaResults = requester.ParseJson(_env.ContentRootPath + "/captchas.json");
            SolverViewModel viewModel      = new SolverViewModel
            {
                CaptchaItem     = captchaResults.Captchas[0],
                CaptchaSolution = new CaptchaSolution()
                {
                    Name = captchaResults.Captchas[0].Name
                }
            };

            return(View(viewModel));
        }
예제 #3
0
        public ActionResult Index()
        {
            LocationsViewModel locationsModel = new LocationsViewModel
            {
                PointsOfDelivery = this.db.PointsOfDeliveries.ToList(),
                Vehicles         = this.db.Vehicles.ToList()
            };

            SolverViewModel solverViewModel = new SolverViewModel
            {
                LocationsViewModel = locationsModel,
                ProductPacks       = this.db.ProductPacks.ToList()
            };

            this.ViewBag.Vehicles =
                this.db.Vehicles.Select(v => new SelectListItem {
                Text = v.Name, Value = v.ID.ToString()
            }).ToList();

            return(this.View(solverViewModel));
        }
예제 #4
0
        // CONSTRUCTORS
        public CalculatorTab(string tabTitle)
        {
            ConductorBase = ConductorDataManager.Instance;
            _conductorAdvencedDisplayMode = false;
            _categoryOverview             = new ObservableCollection <string>(ConductorBase.GetAvailableCategories());
            _selectedCategory             = _categoryOverview[0];

            _conductorSearchMode    = false;
            _searchedPhrase         = "";
            _conductorSearchResults = new ObservableCollection <Conductor>();

            UserSection = new UserSection();
            UserSection.SpatialModelUpdate += OnSpatialModelUpdate;
            PresentedResultantSection       = new PresentedResultantSection();
            Solver = new SolverViewModel(MainSettings.Instance.MainEPS, MainSettings.Instance.GravitionalAcceleration);
            Solver.SubscribeOn_SolverCalculationsReportSent_Event(OnSolverCalculationsReportSent);
            Solver.PropertyChanged += OnSolverPropertyChanged;
            TabTitle = tabTitle;

            LoadSectionModelFromCsvCommand = new CommandRelay(UserSection.LoadSectionModelFromCsv, () => true);
            SaveSectionModelAsCsvCommand   = new CommandRelay(UserSection.SaveSectionModelAsCsv, () => true);

            JustAddSpan    = new CommandRelay(UserSection.JustAddSpan, () => true);
            JustRemoveSpan = new CommandRelay(UserSection.JustRemoveSpan, CanExecute_JustRemoveSpanCommand);
            AddSpanBefore  = new CommandRelay(UserSection.AddSpanBeforeSelectedSpan, CanExecute_BasicSectionCommand);
            AddSpanAfter   = new CommandRelay(UserSection.AddSpanAfterSelectedSpan, CanExecute_BasicSectionCommand);
            ClearSpan      = new CommandRelay(UserSection.ClearSelectedSpan, CanExecute_BasicSectionCommand);
            RemoveSpan     = new CommandRelay(UserSection.RemoveSelectedSpan, CanExecute_RemoveSpanCommand);
            ClearAll       = new CommandRelay(UserSection.ClearBackToBasicSection, CanExecute_ClearAllSectionCommand);
            ManuallyCheckUserSectionIntegrity = new CommandRelay(UserSection.ManualIntegrityCheck, () => true);
            ToggleXAxisDataInputModeCommand   = new CommandRelay(ToggleXAxisDataInputMode, () => true);

            CloseReportCommand = new CommandRelay(UserSection.HideReport, UserSection.CanExecute_HideReport);

            ToggleConductorDetailsCommand = new CommandRelay(ToggleConductorDetails, () => true);
        }