Esempio n. 1
0
        private void loadStatusddl()
        {
            PstatusBLL objMasterBLL = new PstatusBLL();

            OccupationStatus.DataTextField  = "PAPDESIGNATION1";
            OccupationStatus.DataValueField = "PAPDESIGNATIONID1";
            OccupationStatus.DataSource     = objMasterBLL.GetPstatus();
            OccupationStatus.DataBind();
        }
        /// <summary>
        /// A helper method for moving through a sequence of points for a particular step
        /// </summary>
        /// <param name="gameStateBeforeStep"></param>
        /// <param name="currentGameState"></param>
        /// <param name="nextPosition"></param>
        /// <param name="nextMoveNumber"></param>
        /// <returns></returns>
        public RuleOutcome MoveToNextPosition(GameState gameStateBeforeStep, GameState currentGameState, Position nextPosition, int nextMoveNumber)
        {
            CellState actualCellState = currentGameState[nextPosition];

            // Check whether the correct move was made to this position:
            OccupationStatus statusOfNextPosition = actualCellState.OccupationStatus;

            switch (statusOfNextPosition)
            {
            case OccupationStatus.YourWall:
            case OccupationStatus.You:
                // Check move number:
                if (actualCellState.MoveNumber != nextMoveNumber)
                {
                    return(new RuleOutcome
                    {
                        Status = RuleStatus.DeviationFromRuleDetected
                    });
                }
                break;

            case OccupationStatus.Opponent:
            case OccupationStatus.OpponentWall:
                return(new RuleOutcome
                {
                    Status = RuleStatus.DeviationFromRuleDetected
                });

            case OccupationStatus.Clear:
                return(new RuleOutcome
                {
                    Status = RuleStatus.NextMoveSuggested,
                    SuggestedMove = new Move(PlayerType.You, nextMoveNumber, nextPosition)
                });
            }

            // Apply chosen move:
            gameStateBeforeStep.MoveToPosition(nextPosition);

            if (AfterEachMove != null)
            {
                AfterEachMove(this, gameStateBeforeStep, currentGameState);
            }

            // Apply opponent's move to current position:
            int       opponentsMoveNumber = currentGameState.PlayerWhoMovedFirst == PlayerType.You ? nextMoveNumber : nextMoveNumber + 1;
            CellState opponentsActualMove = currentGameState.GetCellByMoveNumber(PlayerType.Opponent, opponentsMoveNumber);

            gameStateBeforeStep.MoveToPosition(opponentsActualMove.Position);

            return(new RuleOutcome
            {
                Status = RuleStatus.NoFurtherSuggestions
            });
        }
Esempio n. 3
0
        public CarOccupation GetLastOccupationOfType(OccupationStatus occupationStatus)
        {
            CarOccupation lastOccupation = null;

            foreach (var occupation in _occupations)
            {
                if (occupation.OccupationStatus == occupationStatus)
                {
                    lastOccupation = occupation;
                }
            }

            return(lastOccupation);
        }
Esempio n. 4
0
 private void clearDetails()
 {
     ddloptionGroup.ClearSelection();
     OccupationStatus.ClearSelection();
     RdbtnBoth.Checked       = false;
     RdbtnCash.Checked       = false;
     RdbtnHBoth.Checked      = false;
     RdbtnHbtninkind.Checked = false;
     RdbtnHcash.Checked      = false;
     Rdbtninkind.Checked     = false;
     RdbtnNO.Checked         = false;
     RdbtnYES.Checked        = false;
     btnAdd.Text             = "Save";
     btnCncl.Text            = "Clear";
 }
Esempio n. 5
0
        /// <summary>
        /// A helper method for moving through a sequence of points for a particular step
        /// </summary>
        /// <param name="gameStateBeforeStep"></param>
        /// <param name="currentGameState"></param>
        /// <param name="nextPosition"></param>
        /// <param name="nextMoveNumber"></param>
        /// <returns></returns>
        public static RuleOutcome MoveToNextPosition(GameState gameStateBeforeStep, GameState currentGameState, Position nextPosition, int nextMoveNumber)
        {
            CellState actualCellState = currentGameState[nextPosition];

            // Check whether the correct move was made to this position:
            OccupationStatus statusOfNextPosition = actualCellState.OccupationStatus;

            switch (statusOfNextPosition)
            {
            case OccupationStatus.YourWall:
            case OccupationStatus.You:
                // Check move number:
                if (actualCellState.MoveNumber != nextMoveNumber)
                {
                    return(new RuleOutcome
                    {
                        Status = RuleStatus.DeviationFromRuleDetected
                    });
                }
                break;

            case OccupationStatus.Opponent:
            case OccupationStatus.OpponentWall:
                return(new RuleOutcome
                {
                    Status = RuleStatus.DeviationFromRuleDetected
                });

            case OccupationStatus.Clear:
                return(new RuleOutcome
                {
                    Status = RuleStatus.NextMoveSuggested,
                    SuggestedMove = new Move(PlayerType.You, nextMoveNumber, nextPosition)
                });
            }

            // Apply chosen move:
            gameStateBeforeStep.MoveToPosition(nextPosition);

            // Apply opponent's move:
            ApplyOpponentsMoveToMutablePosition(gameStateBeforeStep, currentGameState, nextMoveNumber);

            return(new RuleOutcome
            {
                Status = RuleStatus.NoFurtherSuggestions
            });
        }
Esempio n. 6
0
        public static string ToOccupationStatusString(this OccupationStatus source)
        {
            switch (source)
            {
            case OccupationStatus.NotWorkNotStudy: return("Нигде не работал и не учился");

            case OccupationStatus.StudyInEducationInstitution: return("Учился в образовательном учреждении");

            case OccupationStatus.WorkOnAgriculture: return("Работал в сельском хозяйстве");

            case OccupationStatus.WorkOnStateEnterprise: return("Работал на государственном предприятии");

            case OccupationStatus.WorkOnCommercialEnterprise: return("Работал на коммерческом предприятии");
            }

            return(string.Empty);
        }
        private void CalculateChambersForPlayer(PlayerType player)
        {
            this.player       = player;
            count             = 0;
            nextChamberNumber = 1;
            switch (player)
            {
            case PlayerType.You:
                playerOccupationStatus = OccupationStatus.You;
                break;

            default:
                playerOccupationStatus = OccupationStatus.Opponent;
                break;
            }

            gameState.ClearChamberPropertiesForPlayer(player);

            edgeStack = new Stack <Edge>();
            Queue <CellState> cellsToVisit = new Queue <CellState>();

            foreach (CellState cellState in gameState.GetAllCellStates())
            {
                if (cellState.ClosestPlayer == player &&
                    (cellState.OccupationStatus == OccupationStatus.Clear || cellState.OccupationStatus == playerOccupationStatus))
                {
                    cellState.ClearChamberPropertiesForPlayer(player);
                    cellsToVisit.Enqueue(cellState);
                }
            }

            int cellsToVisitCount = cellsToVisit.Count;

            while (cellsToVisitCount != 0)
            {
                CellState nextCellToVisit = cellsToVisit.Dequeue();
                if (!nextCellToVisit.Visited)
                {
                    Visit(nextCellToVisit);
                }
                cellsToVisitCount--;
            }
        }
Esempio n. 8
0
        private async Task <DeviceStatus> GetExactDeviceStatus(Guid deviceId)
        {
            SensorActivity pirActivity = await _movementService.GetSensorStatusAsync(deviceId, SensorType.PIR);

            SensorActivity rangeActivity = await _movementService.GetSensorStatusAsync(deviceId, SensorType.Range);

            TimeSpan expiry = _settingsService.GetSensorActivityExpiry();

            OccupationStatus status = pirActivity.IsActive(expiry) || rangeActivity.IsActive(expiry)
                                      ? OccupationStatus.Occupied
                                      : OccupationStatus.Empty;

            return(new DeviceStatus()
            {
                DeviceInfo = Devices.All.FirstOrDefault(f => f.ID.Equals(deviceId)),
                Status = status,
                LastActivity = GetMinDate(pirActivity?.EntryDate, rangeActivity?.EntryDate)
            });
        }
Esempio n. 9
0
 public CarOccupation(DatePeriod period, OccupationStatus occupationStatus)
 {
     Period           = period;
     OccupationStatus = occupationStatus;
 }
Esempio n. 10
0
 public void ChangeOccupation(OccupationStatus occupation)
 {
     Occupation = occupation;
 }
Esempio n. 11
0
 public CivilInfo(EducationStatus education, string profession, OccupationStatus occupation)
 {
     Education = education;
     ChangeProfession(profession);
     Occupation = occupation;
 }
Esempio n. 12
0
 public Car(string modelName, string color, OccupationStatus occupationStatus)
 {
     this.modelName        = modelName;
     this.color            = color;
     this.occupationStatus = occupationStatus;
 }