Пример #1
0
        public ActionResult SkipStartUpPhase()
        {
            var gameManager = RiskContext.GetGame();

            gameManager.DoStartupPhase();
            return(View("Index", CreateBoard(gameManager)));
        }
Пример #2
0
        public ActionResult NextTurn()
        {
            var gameManager = RiskContext.GetGame();

            gameManager.DoNextTurn();
            return(View("Index", CreateBoard(gameManager)));
        }
Пример #3
0
        public ActionResult Index()
        {
            var board = new Board {
                Countries = RiskContext.GetGame().Countries
            };

            return(View(board));
        }
Пример #4
0
 public MainViewModel()
 {
     ViewLoaded     += OnViewLoaded;
     UserSaving     += OnUserSaving;
     RiskSaving     += OnRiskSaving;
     StrategySaving += OnStrategySaving;
     Client          = SingletonClient.GetInstance(this).Client;
     RiskContext     = new RiskContext();
     StrategyContext = new StrategyContext();
 }
Пример #5
0
        public ActionResult EndGame()
        {
            var gameManager = RiskContext.GetGame();

            do
            {
                gameManager.DoNextTurn();
            } while (!gameManager.GameEnded);

            return(View("Index", CreateBoard(RiskContext.GetGame())));
        }
Пример #6
0
 private Board CreateBoard(GameManager gameManager)
 {
     return(new Board
     {
         Countries = gameManager.Countries,
         Actions = gameManager.Actions,
         NextPhase = gameManager.CurrentPhase,
         ActivePlayer = gameManager.CurrentPlayer,
         Players = gameManager.Players.ToList(),
         GameEnded = gameManager.GameEnded,
         TimesWonByPlayers = RiskContext.GetStats().TimesWonByPlayer,
         Turn = gameManager.Turn,
         LastPhase = gameManager.LastPhase,
         LastPlayer = gameManager.LastPhase == EPhase.Move ? gameManager.LastPlayer : gameManager.CurrentPlayer
     });
 }
Пример #7
0
        /*
         *     public void CustomAUMTableColumnDef_Create(CustomAUMTableColumnDefViewModel valTableColumnDef)
         *     {
         *         var entity = new ValidationTableColumnDef();
         *
         *         entity.TableName = valTableColumnDef.TableName;
         *         entity.ColumnName = valTableColumnDef.ColumnName;
         *
         *         parameters.ValidationTableColumnDef.Add(entity);
         *         parameters.SaveChanges();
         *
         *         valTableColumnDef.Id = entity.Id;
         *     }
         *
         *         public void CustomAUMMapping_Create(CustomAUMMappingViewModel CustomAUMMapping)
         *            {
         *                var entity = new CustomAUMMapping();
         *
         *                entity.CustomAUMTableColumnDefId = CustomAUMMapping.ValidationTableColumnDefId;
         *                entity.ValidationFormTypeId = CustomAUMMapping.ValidationFormTypeId;
         *                entity.RelatedQuestions = CustomAUMMapping.RelatedQuestions;
         *                entity.Mappings = CustomAUMMapping.Mappings;
         *                entity.ViewOrder = CustomAUMMapping.ViewOrder;
         *
         *                parameters.CustomAUMMapping.Add(entity);
         *                parameters.SaveChanges();
         *
         *                CustomAUMMapping.Id = entity.Id;
         *            }
         *
         *            public void ValidationEnumeration_Create(ValidationEnumerationViewModel ValidationEnumeration)
         *            {
         *                var entity = new ValidationEnumeration();
         *
         *                entity.Id = ValidationEnumeration.Id;
         *                entity.ValidationEnumerationId = ValidationEnumeration.ValidationEnumerationId;
         *                entity.Value = ValidationEnumeration.Value;
         *
         *                parameters.ValidationEnumeration.Add(entity);
         *                parameters.SaveChanges();
         *            }
         *
         *            public void ValidationRulesErrorMessage_Create(ValidationRulesErrorMessageViewModel validationRulesErrorMessage)
         *            {
         *                var entity = new ValidationRulesErrorMessages();
         *
         *                entity.ColumnID = validationRulesErrorMessage.ColumnID;
         *                entity.Message = validationRulesErrorMessage.Message;
         *                entity.ValidationFormTypeIds = validationRulesErrorMessage.ValidationFormTypeIds;
         *
         *                parameters.ValidationRulesErrorMessages.Add(entity);
         *                parameters.SaveChanges();
         *
         *                validationRulesErrorMessage.Id = entity.Id;
         *            }
         *
         *            public void ValidationRule_Create(ValidationRuleViewModel validationRule)
         *            {
         *                var entity = new ValidationRules();
         *
         *                entity.CustomAUMTableColumnDefId = validationRule.CustomAUMTableColumnDefId;
         *                entity.OperandColumn = validationRule.OperandColumn;
         *                entity.ValidationOperator = validationRule.ValidationOperator;
         *                entity.OperandValue = validationRule.OperandValue;
         *                entity.ValidationStep = validationRule.ValidationStep;
         *                entity.ValidationFormTypeIds = validationRule.ValidationFormTypeIds;
         *
         *                parameters.ValidationRules.Add(entity);
         *                parameters.SaveChanges();
         *
         *                validationRule.Id = entity.Id;
         *            }*/

        #endregion

        #region Read

        public IEnumerable <RiskReportDataTableColumnDefViewModel> ValidationTableColumnDef_Read()
        {
            var riskCtx = new RiskContext();
            var riskReportDataColumnDefs = riskCtx.CustomAUMMapping.Select(riskReportDataColumnDef => new RiskReportDataTableColumnDefViewModel
            {
                Id            = riskReportDataColumnDef.Id,
                Client        = riskReportDataColumnDef.Client,
                Portfolio     = riskReportDataColumnDef.Portfolio,
                AUM           = riskReportDataColumnDef.AUM,
                EffectiveDate = riskReportDataColumnDef.EffectiveDate,
                IsStatic      = riskReportDataColumnDef.IsStatic,
                sysDate       = riskReportDataColumnDef.sysDate,
                ModifiedBy    = riskReportDataColumnDef.ModifiedBy,
            });

            return(riskReportDataColumnDefs);
        }
Пример #8
0
 public CustomAUMService(RiskContext parameters)
 {
     this.parameters = parameters;
 }
Пример #9
0
 public ThreatController(RiskContext context)
 {
     _context = context;
 }
Пример #10
0
 public RiskController(RiskContext context)
 {
     _context = context;
 }
Пример #11
0
 public SeedUtilities(RiskContext context)
 {
     _context = context;
 }
Пример #12
0
 public SettledBetRepository(RiskContext context)
 {
     _context = context;
 }
Пример #13
0
 public CustomerRepository(RiskContext context)
 {
     _context = context;
 }
Пример #14
0
 public DataMigration(RiskContext context)
 {
     _context = context;
 }
Пример #15
0
 public ActionResult NewGame()
 {
     RiskContext.ResetGame();
     return(View("Index", CreateBoard(RiskContext.GetGame())));
 }