protected PathModel GetPathModel(PathViewModel pathModel)
        {
            PathModel result;

            if (Session[Constants.SessionKeys.IsCustomizedModel] != null && bool.Parse(Session[Constants.SessionKeys.IsCustomizedModel].ToString()))
            {
                result = Session[Constants.SessionKeys.UserKey] as PathModel;
                Session[Constants.SessionKeys.IsCustomizedModel] = false;
            }
            else
            {
                result           = mapper.Map <PathViewModel, PathModel>(pathModel);
                result.Education = new EducationModel(true);
            }
            if (pathModel.EducationDegrees?.Degrees?.Any(x => x.IsReached) ?? false)
            {
                result.Education = new EducationModel(pathModel.EducationDegrees.IsHidden);
                result.Education.EducationDegrees = new List <EducationDegreeModel>();
                foreach (var degree in pathModel.EducationDegrees.Degrees.Where(x => x.IsReached))
                {
                    result.Education.EducationDegrees.Add(new EducationDegreeModel(degree.Title, degree.ReachedIn, degree.IncomePercent));
                }
            }
            if (result?.Id?.Equals(Constants.SessionKeys.UserKey) ?? false)
            {
                Session[Constants.SessionKeys.UserKey] = result;
            }
            return(result);
        }
Beispiel #2
0
        public ActionResult AddTutorialToPath(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Tutorial tutorial = db.Tutorials.Find(id);

            if (tutorial == null)
            {
                return(HttpNotFound());
            }
            if (tutorial != null)
            {
                try
                {
                    var currentUser = db.Users.Find(User.Identity.GetUserId());
                    ViewData["PathSelection"] = new SelectList(currentUser.Paths.ToList(), "PathName", "PathName");
                    PathViewModel pathModel = new PathViewModel()
                    {
                        TutorialId = tutorial.ID
                    };
                    return(View(pathModel));
                }
                catch (InvalidOperationException)
                {
                    return(View());
                }
            }
            return(View());
        }
Beispiel #3
0
        public DesignerViewModel(int width, int height)
        {
            Width           = width;
            Height          = height;
            Selection       = new SelectionViewModel(Guid.NewGuid(), Vector2.Zero, Vector2.Zero);
            CreateSelection = new SelectionViewModel(Guid.NewGuid(), Vector2.Zero, Vector2.Zero)
            {
                BorderColor = Color.Green
            };

            NewConnectionPath = new PathViewModel();
            MousePoint        = new PointViewModel(Guid.NewGuid(), Vector2.Zero)
            {
                IsShown = false
            };

            ResizeDirection = ResizeDirection.None;

            Interactor.AddPoint      += UserInteractionManager_AddPoint;
            Interactor.CreateAt      += UserInteractionManager_CreateAt;
            Interactor.DeleteAt      += UserInteractionManager_DeleteAt;
            Interactor.SelectAt      += UserInteractionManager_SelectAt;
            Interactor.MouseMoved    += UserInteractionManager_MouseMoved;
            Interactor.MouseReleased += UserInteractionManager_MouseReleased;

            Interactor.MouseClicked       += Interactor_MouseClicked;
            Interactor.MouseDoubleClicked += Interactor_MouseDoubleClicked;
            Interactor.KeyPressed         += Interactor_KeyPressed;
        }
Beispiel #4
0
 public ActionResult DeleteSalaryPeriod(PathViewModel path)
 {
     if (ModelState.IsValid && path.Salary.SalaryPeriods.Count > 1)
     {
         path.Salary.SalaryPeriods.RemoveAt(path.Salary.SalaryPeriods.Count - 1);
     }
     return(View("~/Views/Home/Index.cshtml", path));
 }
Beispiel #5
0
        protected void InitPathVM(string relativeRequestDir)
        {
            var splitedDirs = DirectoryHelper.SplitDir(relativeRequestDir);

            PathVM = new PathViewModel(
                parentDirectories: splitedDirs.Item1,
                currentPath: splitedDirs.Item2);
        }
 public ActionResult GetChartLines(PathViewModel pathModel)
 {
     if (pathModel.IsValid())
     {
         var path       = GetPathModel(pathModel);
         var chartLines = GetChartLines(path);
         return(Json(new { lines = chartLines, model = path }));
     }
     return(Json(0));
 }
Beispiel #7
0
 public ActionResult GetSalaryPeriod(PathViewModel path)
 {
     if (ModelState.IsValid)
     {
         var lastPeriod   = path.Salary.SalaryPeriods.Last();
         var salaryPeriod = new SalaryPeriodViewModel(lastPeriod.Amount, lastPeriod.From);
         salaryPeriod.From++;
         path.Salary.SalaryPeriods.Add(salaryPeriod);
     }
     return(View("~/Views/Home/Index.cshtml", path));
 }
Beispiel #8
0
        public ConnectionViewModel(
            DesignerViewModel designer,
            ConnectionPointViewModel point1,
            ConnectionPointViewModel point2)
        {
            Point1 = point1;
            Point2 = point2;

            Path     = new PathViewModel();
            Designer = designer;
        }
Beispiel #9
0
 public ActionResult CreateStation(PathViewModel model)
 {
     try {
         ss.CreateStation(model.Station);
         Unit.Save();
         Unit.Dispose();
         return(RedirectToAction("CreatePath"));
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }
 public ActionResult GetDegrees(PathViewModel path)
 {
     if (ModelState.IsValid)
     {
         ModelState.Clear();
         if (path.EducationDegrees == null)
         {
             path.EducationDegrees = new EducationDegreesViewModel();
         }
         path.EducationDegrees.Degrees = CreateDegreesModel(path.ProfessionSelection.SelectedProfession);
     }
     return(View("~/Views/Home/Index.cshtml", path));
 }
Beispiel #11
0
        //Форма для создания маршрута

        public ActionResult CreatePath()
        {
            try
            {
                var sts   = ss.AllStations().ToList();
                var model = new PathViewModel(sts.Select(s => s.StationName));
                TempData["PathList"] = rs.RouteScaf().Select(p => new PathViewModel {
                    RouteName = p.RouteName, Distance = p.Distance
                }).ToList();
                return(View(model));
            }
            catch (Exception ex) {
                return(View(ex.Message));
            }
        }
Beispiel #12
0
        public ActionResult AddTutorialToPath([Bind(Include = "TutorialId,PathSelection")] PathViewModel model)
        {
            var currentUser = db.Users.Find(User.Identity.GetUserId());

            if (ModelState.IsValid)
            {
                Path     selectedPath = currentUser.Paths.First(x => x.PathName == model.PathSelection);
                Tutorial tutorial     = db.Tutorials.First(x => x.ID == model.TutorialId);
                selectedPath.Tutorials.Add(tutorial);
                db.Entry(currentUser).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "Tutorials"));
            }
            ViewData["PathSelection"] = new SelectList(currentUser.Paths.ToList(), "PathName", "PathName");
            return(View(model));
        }
Beispiel #13
0
 //Форма для редактирования маршрута
 public ActionResult EditPath(string pathName)
 {
     try {
         var data  = rs.RouteScaf().FirstOrDefault(p => p.RouteName == pathName);
         var model = new PathViewModel(data.Stops.Select(s => s.StationName))
         {
             OldName   = data.RouteName,
             RouteName = data.RouteName,
             Distance  = data.Distance,
             Stops     = data.Stops.Select(s => s.StationName).ToList()
         };
         return(View(model));
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }
Beispiel #14
0
        protected override void ConfigureContainerBuilder(ContainerBuilder builder)
        {
            base.ConfigureContainerBuilder(builder);

            var eventAggregator = new EventAggregator();

            builder.RegisterInstance <IEventAggregator>(eventAggregator).As <IEventAggregator>().SingleInstance();

            var uiSprints         = new UISprints();
            var databaseViewModel = new DatabaseSchemaViewModel(eventAggregator);
            var mainViewModel     = new MainViewModel(eventAggregator, uiSprints, databaseViewModel);
            var pathViewModel     = new PathViewModel(eventAggregator, mainViewModel);

            // just one instance in all application - combos etc..
            builder.RegisterInstance <UISprints>(uiSprints).As <UISprints>().SingleInstance();
            builder.RegisterInstance <DatabaseSchemaViewModel>(databaseViewModel).As <DatabaseSchemaViewModel>().SingleInstance();
            builder.RegisterInstance <MainViewModel>(mainViewModel).As <MainViewModel>().SingleInstance();
            builder.RegisterInstance <PathViewModel>(pathViewModel).As <PathViewModel>().SingleInstance();
        }
Beispiel #15
0
 public ActionResult EditPath(PathViewModel model)
 {
     try {
         var rt = new RouteDTO
         {
             RouteName = model.RouteName,
             Distance  = model.Distance,
         };
         rs.EditPath(rt, model.OldName);
         Unit.Save();
         Unit.Dispose();
         var data = rs.RouteScaf().Select(p => new PathViewModel {
             RouteName = p.RouteName, Distance = p.Distance
         }).ToList();
         return(RedirectToAction("CreatePath"));
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }
Beispiel #16
0
 /// <summary>
 /// Determines if the player is in the given path
 /// </summary>
 /// <param name="path">The path to check</param>
 /// <returns>True if the player is in the given path, else false</returns>
 private bool IsPlayerInPath(PathViewModel path)
 {
     if (path.PathModel.IdentifyingPoints.Count > 0)
     {
         bool isInRange = false;
         foreach (var point in path.PathModel.IdentifyingPoints)
         {
             isInRange |= CalcUtil.IsInRadius(point, this.playerService.PlayerPosition, point.Radius);
             if (isInRange)
             {
                 break;
             }
         }
         return(isInRange);
     }
     else
     {
         // No identifying points, so use the mapID only
         return(this.playerService.MapId == path.PathModel.InstanceMapID);
     }
 }
Beispiel #17
0
 public ActionResult PathAdd(PathViewModel model)
 {
     try {
         var rt = new RouteDTO
         {
             RouteName = model.RouteName,
             Distance  = model.Distance,
             Stops     = model.Stops.Select(s => new StationDTO {
                 StationName = s
             }).ToList()
         };
         rs.AddPath(rt);
         Unit.Save();
         Unit.Dispose();
         var data = rs.RouteScaf().Select(p => new PathViewModel {
             RouteName = p.RouteName, Distance = p.Distance
         }).ToList();
         return(PartialView(data));
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }
Beispiel #18
0
        public ExplorerViewModel(ILog log, IDispatcherSchedulerProvider scheduler, IStandardDialog standardDialog,
                                 IExplorerService service,
                                 DataSourceSelectorViewModel dataSourceSelectorViewModel,
                                 SearchViewModel searchViewModel,
                                 DataViewModel dataViewModel,
                                 FilterViewModel filterViewModel,
                                 PathViewModel pathViewModel,
                                 Func <PathItemViewModel> pathItemViewModelFactory)
            : base(log, scheduler, standardDialog)
        {
            _service = service;
            _pathItemViewModelFactory = pathItemViewModelFactory;

            Disposables.Add(service);

            this.SetupHeader(Scheduler, "Explorer");

            DataSourceSelectorViewModel = dataSourceSelectorViewModel;
            this.SyncViewModelActivationStates(DataSourceSelectorViewModel).AddDisposable(Disposables);
            this.SyncViewModelBusy(DataSourceSelectorViewModel).AddDisposable(Disposables);

            SearchViewModel = searchViewModel;
            this.SyncViewModelActivationStates(SearchViewModel).AddDisposable(Disposables);
            this.SyncViewModelBusy(SearchViewModel).AddDisposable(Disposables);

            DataViewModel = dataViewModel;
            this.SyncViewModelActivationStates(DataViewModel).AddDisposable(Disposables);
            this.SyncViewModelBusy(DataViewModel).AddDisposable(Disposables);

            FilterViewModel = filterViewModel;
            this.SyncViewModelActivationStates(FilterViewModel).AddDisposable(Disposables);
            this.SyncViewModelBusy(FilterViewModel).AddDisposable(Disposables);

            PathViewModel = pathViewModel;
            this.SyncViewModelActivationStates(PathViewModel).AddDisposable(Disposables);
            this.SyncViewModelBusy(PathViewModel).AddDisposable(Disposables);

            // When the selected DataSource changes, keep the Search upto date.
            DataSourceSelectorViewModel.DataSources.SelectedItemChanged
            .Where(x => x != null)
            .SelectMany(dataSource => SearchViewModel.Reset(dataSource).ToObservable())
            .TakeUntil(ClosingStrategy.Closed)
            .Subscribe(_ => { });

            // When the selected Dimension changes, create a new root level path node with the correct query.
            SearchViewModel.Dimension.SelectedItemChanged
            .Where(x => x != null)
            .TakeUntil(ClosingStrategy.Closed)
            .ObserveOn(Scheduler.Dispatcher.RX)
            .Subscribe(_ =>
            {
                var query = new Query
                {
                    DataSource         = DataSourceSelectorViewModel.DataSources.SelectedItem,
                    Entity             = SearchViewModel.Entity.SelectedItem,
                    GroupingDimensions = new[] { SearchViewModel.Dimension.SelectedItem },
                    ParentQuery        = null
                };

                var pathItem         = _pathItemViewModelFactory();
                pathItem.DisplayText = query.GroupingDimensions.First().Name;
                pathItem.Query       = query;

                PathViewModel.Path.Items.Add(pathItem);
                PathViewModel.Path.SelectedItem = pathItem;
            });

            // When a DrillDownDimensionRequest is recieved, create a new path node under the currectly selected
            // node.
            DataViewModel.DrillDownDimensionRequest
            .Where(x => x != null)
            .TakeUntil(ClosingStrategy.Closed)
            .ObserveOn(Scheduler.Dispatcher.RX)
            .Subscribe(query =>
            {
                var pathItem         = _pathItemViewModelFactory();
                pathItem.DisplayText = query.GroupingDimensions.First().Name;
                pathItem.Query       = query;

                PathViewModel.Path.SelectedItem.AddChild(pathItem);
                PathViewModel.Path.SelectedItem = pathItem;
            });

            // As the SelectedPathItem changes, keep the Data upto date.
            PathViewModel.Path.SelectedItemChanged
            .Where(x => x != null)
            .SelectMany(x => GetData(x.Query))
            .TakeUntil(ClosingStrategy.Closed)
            .Subscribe(_ => { });
        }
Beispiel #19
0
 /// <summary>
 /// Parameterized constructor
 /// </summary>
 /// <param name="pathData">The Path data view model object</param>
 public PathCompletionData(PathViewModel pathData)
 {
     this.PathID   = pathData.PathId;
     this.PathData = pathData;
 }
Beispiel #20
0
        public IActionResult Index(string _EmpSage, string _Ano)
        {
            //PlanoContasViewModelPath planoContasView
            int    idGabContab      = SessionHelper.GetObjectFromJson <int>(HttpContext.Session, "sessionIDGabContab");
            int    idEmpresaContab  = SessionHelper.GetObjectFromJson <int>(HttpContext.Session, "sessionIDEmpresaContab");
            string AnoEmpresaContab = SessionHelper.GetObjectFromJson <string>(HttpContext.Session, "sessionIDAnoEmpresaContab");

            if (idGabContab == 0)
            {
                logger.LogError($"Gabinete de contabilidade não foi selecionado!");
                ViewBag.Signal       = "notok";
                ViewBag.ErrorTitle   = "Gabinete de Contabilidade !";
                ViewBag.ErrorMessage = "Um gabinete de contabilidade não foi selecionado!" +
                                       " Selecione uma empresa de contabilidade para prosseguir com a operação!";
                return(this.PartialView("~/Views/Error/GeneralError.cshtml"));
            }

            if (idEmpresaContab == 0)
            {
                logger.LogError($"Empresa não foi selecionada!");
                ViewBag.Signal       = "notok";
                ViewBag.ErrorTitle   = "Empresa não foi selecionada !";
                ViewBag.ErrorMessage = "A Empresa não foi selecionada!" +
                                       " Selecione uma empresa para prosseguir com a operação!";
                return(this.PartialView("~/Views/Error/GeneralError.cshtml"));
            }

            if (AnoEmpresaContab == "" || AnoEmpresaContab == null)
            {
                logger.LogError($"Ano fiscal não foi selecionado!");
                ViewBag.Signal       = "notok";
                ViewBag.ErrorTitle   = "Ano fiscal não foi selecionado!";
                ViewBag.ErrorMessage = "Ano fiscal não foi selecionado!" +
                                       " Selecione ano fiscal da empresa para prosseguir com a operação!";
                return(this.PartialView("~/Views/Error/GeneralError.cshtml"));
            }

            List <ConConfigViewModel> conConfigViewModel = conConfig.FindByEmpresaId(idEmpresaContab).ToList();

            if (conConfigViewModel.Count == 0)
            {
                GeneralErrorViewModel generalErrorViewModel = new GeneralErrorViewModel
                {
                    Signal        = "notok",
                    ErrorTitle    = "Conexão nao configurada!",
                    ErrorMessage  = "A empresa não tem uma conexão configurada!",
                    StringButton  = "Configurar conexão",
                    UrlToRedirect = "/ConConfig/IndexJson/",
                    optionalData  = idEmpresaContab.ToString()
                };
                return(this.PartialView("~/Views/Error/GeneralErrorModel.cshtml", generalErrorViewModel));

                //ViewBag.Signal = "notok";
                //ViewBag.ErrorTitle = "Conexão nao configurada!";
                //ViewBag.ErrorMessage = "A empresa não tem uma conexão configurada!";
                //return this.PartialView("~/Views/Error/GeneralError.cshtml");
            }

            DadosEmpresaImportada empViewModel = dadosEmpresaViewModel.ReturnModelByEmpresaAno(idEmpresaContab, Int16.Parse(AnoEmpresaContab));

            string _servidorSQL  = conConfigViewModel[0].NomeServidor;
            string _instanciaSQL = conConfigViewModel[0].InstanciaSQL;

            string _path = "";

            /*
             *         AGesLocEn  _AGesLocEn = empresaAGes.GetAGesLocEn();
             *        string _path = _AGesLocEn.GesSharedDir + _servidorSQL + "\\" + _instanciaSQL;
             *
             */

            if (_path == "" || _path == null)
            {
                _path = "C:\\Sage Data\\Sage Accountants\\";
            }

            _path += (_path.EndsWith("\\") ? "" : "\\") + empViewModel.CodeEmpresa + _Ano + empViewModel.CodeAplicacao + "\\Sync\\toCLAB";

            if (!Directory.Exists(_path))
            {
                Directory.CreateDirectory(_path);
            }

            PathViewModel model = new PathViewModel
            {
                Path      = _path,
                EmpresaID = idEmpresaContab,
                Ano       = Int16.Parse(AnoEmpresaContab)
            };

            return(this.PartialView("~/Views/ExportDocs/Index.cshtml", model));
        }