示例#1
0
        public ActionResult RegisterUserInRun(RunModel run)
        {
            UserModel user = UserHandler.GetUserDataByToken(Request.Headers["authorization"], true);

            string sqlProc = "exec RegisterUserInRun";
            Dictionary <string, object> queryParams = new Dictionary <string, object> {
                { "@runId", run.Id },
                { "@userId", user.Id },
                { "@registerdSide", RegistredSide.user.ToString() }
            };
            DbHandler dbHandler = new DbHandler();

            dbHandler.GenerateProcedure(sqlProc, queryParams);
            sqlProc = dbHandler.AddParamsToQuery(sqlProc, queryParams);
            try
            {
                dbHandler.ExecuteQuery(sqlProc, queryParams);
            }catch (Exception e)
            {
                string response = JsonConvert.SerializeObject(new { id = run.Id, messege = e.Message });
                return(Conflict(response));
            }

            return(Ok());
        }
示例#2
0
        private RunModel[] GetRunsByCompIdAndUserID(string compId, string userId)
        {
            string sqlProc = "SELECT * FROM run WHERE competitionId = @competitionId AND ownerId = @ownerId";
            Dictionary <string, object> queryParams = new Dictionary <string, object> {
                { "@competitionId", compId },
                { "@ownerId", userId }
            };
            DbHandler dbHandler = new DbHandler();
            DataSet   dataSet   = dbHandler.GetSetFromDb(sqlProc, queryParams);
            var       x         = dataSet.Tables["tab"].Rows.Count;

            RunModel[] runs = new RunModel[x];
            var        i    = 0;

            foreach (DataRow row in dataSet.Tables["tab"].Rows)
            {
                RunModel run = new RunModel();
                run.Id            = row["Id"].ToString();
                run.competitionId = row["competitionId"].ToString();
                run.ownerId       = row["ownerId"].ToString();
                run.description   = row["description"].ToString();
                run.target        = row["target"].ToString();
                run.noOfShots     = int.Parse(row["noOfShots"].ToString());
                runs[i]           = run;
                i++;
            }
            return(runs);
        }
示例#3
0
        public void Register(ContainerBuilder builder, ITypeFinder typeFinder)
        {
            if (RunModel.GetInstance().Model.Value == RunModelEnum.Release)
            {
                builder.RegisterType <FormsAuthenticationService>().As <IAuthenticationService>().InstancePerApiRequest();
            }
            else
            {
                builder.RegisterType <FakeAuthenticationService>().As <IAuthenticationService>().InstancePerApiRequest();
            }

            builder.RegisterApiControllers(typeFinder.GetAssemblies().ToArray());

            builder.RegisterType <LMS_DbContext>().InstancePerApiRequest();

            builder.RegisterAssemblyTypes(typeFinder.GetAssemblies().ToArray())
            .Where(t => t.Name.EndsWith("Repository"))
            .AsImplementedInterfaces().InstancePerLifetimeScope();

            builder.RegisterType <AutomapperTypeAdapterFactory>().As <ITypeAdapterFactory>().SingleInstance();

            builder.RegisterGeneric(typeof(Repository <>)).As(typeof(IRepository <>)).InstancePerApiRequest();

            builder.RegisterType <OrderService>().As <IOrderService>().InstancePerApiRequest();

            builder.RegisterType <FreightService>().As <IFreightService>().InstancePerApiRequest();
            builder.RegisterType <ReturnGoodsService>().As <IReturnGoodsService>().InstancePerApiRequest();
            builder.RegisterType <FinancialService>().As <IFinancialService>().InstancePerApiRequest();
            builder.RegisterType <TrackingNumberService>().As <ITrackingNumberService>().InstancePerApiRequest();

            builder.RegisterType <WorkContext>().As <IWorkContext>().InstancePerApiRequest();

            builder.RegisterType <OperateLogServices>().As <IOperateLogServices>().InstancePerApiRequest();
        }
示例#4
0
 public FileController(RunModel runModel, FileSaveCallback fileSaveCallback)
 {
     loadListKeyword();
     this._runModel         = runModel;
     this._fileSaveCallback = fileSaveCallback;
     init(_runModel.PNGModel, this);
 }
 public RenameController(RunModel runModel, RunCallback runCallback)
 {
     this._runModel    = runModel;
     this._runCallback = runCallback;
     _fileHelper       = new FileHelper();
     loadListKeywordRemove();
 }
示例#6
0
 public void Register(RunModel run)
 {
     if (run == null)
     {
         throw new ArgumentNullException(nameof(run));
     }
     _context.Run.Add(run);
 }
示例#7
0
 public static void RegisterGlobalFilters(GlobalFilterCollection filters)
 {
     filters.Add(new HandleErrorAttribute());
     if (RunModel.GetInstance().Model.Value == RunModelEnum.Release)
     {
         filters.Add(new SsoMemberOnlyAttribute(GetIgnoredActionMethod()));
     }
 }
示例#8
0
        private ExcelReportGrid ScenarioDetailsGrid(RunModel run, ScenarioModel scenario, int maxColumnsCount, DateTime reportDate)
        {
            var grid = new ExcelReportGrid();

            grid.MaxColumnCount = maxColumnsCount;
            var row1 = new ExcelReportRow();

            row1.Cells.Add(new ExcelReportCell()
            {
                Value = "Report Date", Alignment = ExcelHorizontalAlignment.Left, StyleName = GamePlanReportStyles.HeaderStyle.Name
            });
            row1.Cells.Add(new ExcelReportCell()
            {
                Value = string.Format(CultureInfo.InvariantCulture, "{0:dd MMMM yyyy} - {0:HH:mm:ss}", reportDate), Alignment = ExcelHorizontalAlignment.Left, StyleName = GamePlanReportStyles.HeaderStyle.Name
            });
            grid.HeaderRows.Add(row1);

            var row2 = new ExcelReportRow();

            row2.Cells.Add(new ExcelReportCell()
            {
                Value = "Run Name", Alignment = ExcelHorizontalAlignment.Left, StyleName = GamePlanReportStyles.LightHeaderStyle.Name
            });
            row2.Cells.Add(new ExcelReportCell()
            {
                Value = run.Description, Alignment = ExcelHorizontalAlignment.Left, StyleName = GamePlanReportStyles.LightHeaderStyle.Name
            });
            grid.BodyRows.Add(row2);

            var row3 = new ExcelReportRow();

            row3.Cells.Add(new ExcelReportCell()
            {
                Value = "Run Id", Alignment = ExcelHorizontalAlignment.Left, StyleName = GamePlanReportStyles.LightHeaderStyle.Name
            });
            row3.Cells.Add(new ExcelReportCell()
            {
                Value = run.Id, Alignment = ExcelHorizontalAlignment.Left, StyleName = GamePlanReportStyles.LightHeaderStyle.Name
            });
            grid.BodyRows.Add(row3);

            var row4 = new ExcelReportRow();

            row4.Cells.Add(new ExcelReportCell()
            {
                Value = "Scenario Name", Alignment = ExcelHorizontalAlignment.Left, StyleName = GamePlanReportStyles.LightHeaderStyle.Name
            });
            row4.Cells.Add(new ExcelReportCell()
            {
                Value = scenario.Name, Alignment = ExcelHorizontalAlignment.Left, StyleName = GamePlanReportStyles.LightHeaderStyle.Name
            });
            grid.BodyRows.Add(row4);

            return(grid);
        }
        public EditScoreViewModel()
        {
            targetModel      = new TargetModel();
            runModel         = new RunModel();
            stageModel       = new StageModel();
            competitionModel = new CompetitionModel();
            shooterModel     = new ShooterModel();

            Competitions = competitionModel.GetAllCompetitions().Convert();
            Shooters     = shooterModel.GetAllShooters().Convert();
        }
示例#10
0
        public ExcelReportRunModel Map(RunModel run, IEnumerable <Demographic> demographics, DateTime reportDate)
        {
            var model = new ExcelReportRunModel();

            foreach (var scenario in run.Scenarios)
            {
                var excelReportScenario = Map(run, scenario, demographics, reportDate);
                model.Scenarios.Add(excelReportScenario);
            }
            return(model);
        }
示例#11
0
        public ActionResult addRun(RunModel run)
        {
            UserModel owner = UserHandler.GetUserDataByToken(Request.Headers["authorization"]);

            owner = _repositoryUsers.GetUserByLogin(owner.UserLogin);

            run.Id      = Guid.NewGuid().ToString();
            run.ownerId = owner.Id;
            _repositoryRun.Register(run);
            _repositoryRun.SaveChanges();

            return(Ok());
        }
示例#12
0
        public ActionResult GetRegistredUsersByRunId(RunModel runModel)
        {
            UserModel user    = UserHandler.GetUserDataByToken(Request.Headers["authorization"], true);
            string    sqlProc = "SELECT";

            //Dictionary<string, object> queryParams = new Dictionary<string, object> {
            //          { "@runId", run.Id},
            //          {"@userId", user.Id },
            //          {"@registerdSide", RegistredSide.user.ToString() }
            //};


            return(Ok());
        }
示例#13
0
        public RunViewModel(RunModel model, IContext context)
        {
            _model   = model;
            _context = context;

            RunAllCommand       = new DelegateCommand(param => OnRunAllCommand());
            RunSingleCommand    = new DelegateCommand(param => OnRunSingleCommand(Convert.ToInt32(param)));
            OpenSolutionCommand = new DelegateCommand(param => OnOpenSolutionCommand(Convert.ToInt32(param)));
            ToAlgorithmCommand  = new DelegateCommand(param => OnToAlgorithmCommand());

            _model.AlgorithmStarted  += Model_AlgorithmStarted;
            _model.AlgorithmFinished += Model_AlgorithmFinished;

            Results = new ObservableCollection <StableMarriagePanel>();
        }
示例#14
0
        private static async Task SendRunInfo(double ellapsed)
        {
            RunModel run = new RunModel()
            {
                id        = $"{_runName}_{DateTime.Now.ToFileTime()}",
                name      = _runName,
                ellapsed  = ellapsed,
                metadata  = "Test String... please update with correct run metadata details like env details, etc...",
                starttime = _startTime
            };

            _runId = run.id;
            var serverUri = ConfigurationManager.AppSettings["BaseUri"] + ConfigurationManager.AppSettings["RunEndpoint"];
            var result    = await HttpHelper.Send(serverUri, run);

            Console.WriteLine(result);
        }
示例#15
0
        private static void ApplyFunctionalAreaFaultTypesToRunModel(RunModel runModel, Run run, IFunctionalAreaRepository functionalAreaRepository)
        {
            if (run.FailureTypes == null || !run.FailureTypes.Any())
            {
                return;
            }

            var selectedFaultTypes = functionalAreaRepository.FindFaultTypes(run.FailureTypes);

            if (selectedFaultTypes != null && selectedFaultTypes.Any())
            {
                runModel.FaultTypes = selectedFaultTypes.Select(sft => new RunFaultTypeModel
                {
                    Id          = sft.Id,
                    Description = sft.Description?.FirstOrDefault(e => e.Key == "ENG").Value
                });
            }
        }
示例#16
0
        public void NewRunModel()
        {
            StablePairsEvaluation          stablePairsEvaluation          = new StablePairsEvaluation();
            GroupHappinessEvaluation       groupHappinessEvaluation       = new GroupHappinessEvaluation();
            EgalitarianHappinessEvaluation egalitarianHappinessEvaluation = new EgalitarianHappinessEvaluation();

            NewModel();
            SetupModel setupModel = _model.NewSetupModel();

            setupModel.Initialize();
            ParticipantsModel participantsModel = _model.NewParticipantsModel();

            participantsModel.Initialize();
            PreferencesModel preferencesModel = _model.NewPreferencesModel();

            preferencesModel.Initialize();
            AlgorithmModel algorithmModel = _model.NewAlgorithmModel();

            algorithmModel.Initialize();
            RunModel runModel = _model.NewRunModel();

            runModel.Initialize();

            int  receivedEvents = 0;
            Task task;

            NewModel();

            runModel.AlgorithmStarted  += (object sender, AlgorithmEventArgs e) => receivedEvents++;
            runModel.AlgorithmFinished += (object sender, AlgorithmEventArgs e) =>
            {
                receivedEvents++;
                Assert.AreEqual(_context.Algorithms[e.Index].Algorithm.Evaluate(stablePairsEvaluation), e.StablePairs);
                Assert.AreEqual(_context.Algorithms[e.Index].Algorithm.Evaluate(groupHappinessEvaluation), e.GroupHappiness);
                Assert.AreEqual(_context.Algorithms[e.Index].Algorithm.Evaluate(egalitarianHappinessEvaluation), e.EgalitarianHappiness);
            };
            task = Task.Run(async() => {
                await runModel.RunSingleAlgorithm(0);
                Assert.AreEqual(2, receivedEvents);
            });
        }
示例#17
0
        private void NewModel()
        {
            _context = new ModelContext();
            SetupModel setupModel = new SetupModel(_context);

            setupModel.Initialize();
            ParticipantsModel participantsModel = new ParticipantsModel(_context);

            participantsModel.Initialize();
            PreferencesModel preferencesModel = new PreferencesModel(_context);

            preferencesModel.Initialize();
            AlgorithmModel algorithmModel = new AlgorithmModel(_context);

            algorithmModel.Initialize();
            algorithmModel.CreateGaleShapleyAlgorithm();
            algorithmModel.CreateGeneticAlgorithm();
            _model = new RunModel(_context);
            _model.Initialize();
            _context.AlgorithmsChanged = false;
        }
示例#18
0
        private void NewViewModel()
        {
            _context   = new ModelContext();
            _model     = new RunModel(_context);
            _viewModel = new RunViewModel(_model, _context);

            SetupModel setupModel = new SetupModel(_context);

            setupModel.Initialize();
            ParticipantsModel participantsModel = new ParticipantsModel(_context);

            participantsModel.Initialize();
            PreferencesModel preferencesModel = new PreferencesModel(_context);

            preferencesModel.Initialize();
            AlgorithmModel algorithmModel = new AlgorithmModel(_context);

            algorithmModel.Initialize();

            algorithmModel.CreateGaleShapleyAlgorithm();
            algorithmModel.CreateGeneticAlgorithm();

            _viewModel.RefreshPage();
        }
示例#19
0
        private ExcelReportScenario Map(RunModel run, ScenarioModel scenario, IEnumerable <Demographic> demographics, DateTime reportDate)
        {
            var model = new ExcelReportScenario();

            model.Name = scenario.Name;
            //Some passes are displayed in 1, 2, 3, 4 coulmns
            // therfore 12 coulumns is assigned to each pass
            // so it can be divided to 1, 2, 3 or 4 easily
            //and one column for the title
            var numberOfCellForEachPass = 12;

            model.MaxColumnsCount         = scenario.Passes.Count * numberOfCellForEachPass + 1;// the 1 is the title column
            model.ScenarioDetails         = ScenarioDetailsGrid(run, scenario, model.MaxColumnsCount, reportDate);
            model.SalesAreaPassPriorities = SalesAreaPassPrioritiesGrid(scenario.Passes, model.MaxColumnsCount);
            model.General              = GeneralGrid(scenario.Passes, model.MaxColumnsCount);
            model.Weighting            = WeightingGrid(scenario.Passes, model.MaxColumnsCount);
            model.Tolerance            = ToleranceGrid(scenario.Passes, model.MaxColumnsCount);
            model.Rules                = RulesGrid(scenario.Passes, model.MaxColumnsCount);
            model.ProgrammeRepetitions = ProgrammeRepetitionsGrid(scenario.Passes, model.MaxColumnsCount);
            model.BreakExclusions      = BreakExclusionsGrid(scenario.Passes, model.MaxColumnsCount);
            model.MinRatingPoints      = MinRatingPointsGrid(scenario.Passes, model.MaxColumnsCount);
            model.SlottingLimits       = SlottingLimitsGrid(scenario.Passes, demographics, model.MaxColumnsCount);
            return(model);
        }
示例#20
0
        public ActionResult <IEnumerable <RunDto> > GetRunByCompetitionId(string Id)
        {
            UserModel user    = UserHandler.GetUserDataByToken(Request.Headers["authorization"], true);
            string    sqlProc = "SELECT * FROM run (NOLOCK) WHERE competitionId = @competitionId";
            Dictionary <string, object> queryParams = new Dictionary <string, object> {
                { "@competitionId", Id }
            };
            DbHandler dbHandler = new DbHandler();
            DataSet   dataSet   = dbHandler.GetSetFromDb(sqlProc, queryParams);

            int numberOfRuns = dataSet.Tables["tab"].Rows.Count;

            RunModel[] runModels   = new RunModel[numberOfRuns];
            int        runIterator = 0;

            foreach (DataRow row in dataSet.Tables["tab"].Rows)
            {
                RunModel runModel = new RunModel();
                runModel.competitionId = row["competitionId"].ToString();
                runModel.Id            = row["Id"].ToString();
                runModel.ownerId       = row["ownerId"].ToString();
                runModel.description   = row["description"].ToString();
                runModel.target        = row["target"].ToString();
                runModel.noOfShots     = int.Parse(row["noOfShots"].ToString());

                runModels[runIterator] = runModel;
                runIterator++;
            }
            //RunModel[] runModels = GetRunsByCompIdAndUserID(Id, user.Id);

            return(Ok(runModels));

            //user = _repositoryUsers.GetUserByLogin(user.UserLogin);
            //var run = _repositoryRun.GetRunByCompetitionId(id);
            //return Ok(_mapper.Map<IEnumerable<RunDto>>(run));
        }
        public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder)
        {
            if (RunModel.GetInstance().Model.Value == RunModelEnum.Release)
            {
                builder.RegisterType <SsoAuthenticationService>().As <IAuthenticationService>().InstancePerLifetimeScope();
            }
            else
            {
                builder.RegisterType <FakeAuthenticationService>().As <IAuthenticationService>().InstancePerLifetimeScope();
            }

            builder.RegisterType <WebHelper>().As <IWebHelper>().InstancePerLifetimeScope();
            builder.RegisterType <PageTitleBuilder>().As <IPageTitleBuilder>().InstancePerLifetimeScope();

            var assemblies = typeFinder.GetAssemblies().ToArray();

//#if DEBUG
//            Log.Info("assemblies.Count : " + assemblies.Count().ToString());
//            StringBuilder sb = new StringBuilder();
//            foreach (var s in assemblies)
//            {
//                sb.AppendFormat("{0}{1}", s.FullName.Split(',')[0], "<br/>");
//            }
//            Log.Info(sb.ToString());
//#endif

            builder.RegisterControllers(assemblies);
            builder.RegisterAssemblyTypes(assemblies)
            .Where(t => t.Name.EndsWith("Repository"))
            .AsImplementedInterfaces()
            .InstancePerLifetimeScope();


            builder.RegisterGeneric(typeof(Repository <>)).As(typeof(IRepository <>)).InstancePerLifetimeScope();


            builder.RegisterType <AutomapperTypeAdapterFactory>().As <ITypeAdapterFactory>().SingleInstance();
            builder.RegisterType <LMS_DbContext>().InstancePerLifetimeScope();
            builder.RegisterType <WorkContext>().As <IWorkContext>().InstancePerLifetimeScope();
            builder.RegisterType <UserService>().As <IUserService>().InstancePerLifetimeScope();
            builder.RegisterType <CustomerService>().As <ICustomerService>().InstancePerLifetimeScope();
            builder.RegisterType <CustomerOrderService>().As <ICustomerOrderService>().InstancePerLifetimeScope();
            builder.RegisterType <PermissionService>().As <IPermissionService>().InstancePerLifetimeScope();
            builder.RegisterType <FeeManageService>().As <IFeeManageService>().InstancePerLifetimeScope();
            builder.RegisterType <OrderService>().As <IOrderService>().InstancePerLifetimeScope();
            builder.RegisterType <InStorageService>().As <IInStorageService>().InstancePerLifetimeScope();
            builder.RegisterType <OutStorageService>().As <IOutStorageService>().InstancePerLifetimeScope();
            builder.RegisterType <CountryService>().As <ICountryService>().InstancePerLifetimeScope();
            builder.RegisterType <FreightService>().As <IFreightService>().InstancePerLifetimeScope();
            builder.RegisterType <HomeService>().As <IHomeService>().InstancePerLifetimeScope();
            builder.RegisterType <NewService>().As <INewService>().InstancePerLifetimeScope();
            builder.RegisterType <TrackingNumberService>().As <ITrackingNumberService>().InstancePerLifetimeScope();
            builder.RegisterType <WayBillTemplateService>().As <IWayBillTemplateService>().InstancePerLifetimeScope();
            builder.RegisterType <DictionaryTypeService>().As <IDictionaryTypeService>().InstancePerLifetimeScope();
            builder.RegisterType <ExpressService>().As <IExpressService>().InstancePerLifetimeScope();
            builder.RegisterType <InsuredCalculationService>().As <IInsuredCalculationService>().InstancePerLifetimeScope();
            builder.RegisterType <ReturnGoodsService>().As <IReturnGoodsService>().InstancePerLifetimeScope();

            builder.RegisterType <FinancialService>().As <IFinancialService>().InstancePerLifetimeScope();

            builder.RegisterType <EubWayBillService>().As <IEubWayBillService>().InstancePerLifetimeScope();

            builder.RegisterType <OperateLogServices>().As <IOperateLogServices>().InstancePerLifetimeScope();
        }
示例#22
0
        private void brnStart_Click(object sender, EventArgs e)
        {
            if (edtRootPath.Text.Equals(""))
            {
                MessageBox.Show("Root Path Is Emty", "ERROR");
                return;
            }

            /*if (edtKeyword.Text.Equals(""))
             * {
             *  MessageBox.Show("Keyword Is Emty", "ERROR");
             *  return;
             * } */
            if (radSaveAs.Checked)
            {
                if (edtPathSaveAs.Text.Equals(""))
                {
                    MessageBox.Show("Save Path Is Emty", "ERROR");
                    return;
                }
            }
            List <SortModel> _listSortModel = new List <SortModel>();

            if (!edtPathKewordFilter.Text.Equals(""))
            {
                try
                {
                    string[] lines = File.ReadAllLines(edtPathKewordFilter.Text.Trim());
                    foreach (string line in lines)
                    {
                        if (!line.Equals(""))
                        {
                            SortModel _sortModel = new SortModel();
                            _sortModel.Keywords       = line;
                            _sortModel.PathSave       = edtPathSaveAs.Text.Trim();
                            _sortModel.RootPath       = edtRootPath.Text.Trim();
                            _sortModel.IsCreateFolder = true;
                            _listSortModel.Add(_sortModel);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            RunModel _runModel = new RunModel();

            PNGModel model = new PNGModel();

            model.RootPath   = edtRootPath.Text.ToString().Trim();
            model.isReplace  = radReplace.Checked;
            model.isSaveAs   = radSaveAs.Checked;
            model.Keywords   = edtKeyword.Text;
            model.PathSaveAs = edtPathSaveAs.Text.ToString().Trim();

            _runModel.SortModels = _listSortModel;
            _runModel.PNGModel   = model;

            RenameController _renameController = new RenameController(_runModel, this);

            _renameController.Start();
        }
示例#23
0
 public ActionResult RegisterUserInRun(RunModel run)
 {
     return(Ok());
 }