Beispiel #1
0
        public GetLevelConditionResponse GetLevelCondition(GetRequest2 request)
        {
            GetLevelConditionResponse response = new GetLevelConditionResponse();

            try
            {
                LevelCondition     levelCondition     = new LevelCondition();
                LevelConditionView levelConditionView = levelCondition.ConvertToLevelConditionView();

                Infrastructure.Querying.Query query = new Infrastructure.Querying.Query();
                Criterion criteria1 = new Criterion("LevelID", request.ID1, CriteriaOperator.Equal);
                Criterion criteria2 = new Criterion("ConditionID", request.ID2, CriteriaOperator.Equal);

                query.Add(criteria1); query.Add(criteria2);

                levelCondition = _levelConditionRepository.FindBy(query).FirstOrDefault();
                if (levelCondition != null)
                {
                    levelConditionView = levelCondition.ConvertToLevelConditionView();
                }

                response.LevelConditionView = levelConditionView;
            }
            catch (Exception ex)
            {
            }

            return(response);
        }
Beispiel #2
0
        public GeneralResponse DeleteLevelCondition(DeleteRequest2 request)
        {
            GeneralResponse response = new GeneralResponse();

            LevelCondition levelCondition = new LevelCondition();

            Infrastructure.Querying.Query query = new Infrastructure.Querying.Query();
            Criterion criterion1 = new Criterion("Level.ID", request.ID1, CriteriaOperator.Equal);
            Criterion criterion2 = new Criterion("Condition.ID", request.ID2, CriteriaOperator.Equal);

            query.Add(criterion1);
            query.Add(criterion2);

            levelCondition = _levelConditionRepository.FindBy(query).FirstOrDefault();

            if (levelCondition != null)
            {
                try
                {
                    _levelConditionRepository.Remove(levelCondition);
                    _uow.Commit();

                    ////response.success = true;
                }
                catch (Exception ex)
                {
                    response.ErrorMessages.Add(ex.Message);
                }
            }

            return(response);
        }
Beispiel #3
0
        public GeneralResponse EditLevelCondition(EditLevelConditionRequest request)
        {
            GeneralResponse response       = new GeneralResponse();
            LevelCondition  levelCondition = new LevelCondition();

            levelCondition = _levelConditionRepository.FindBy(request.ID);

            if (levelCondition != null)
            {
                try
                {
                    levelCondition.ModifiedDate     = PersianDateTime.Now;
                    levelCondition.ModifiedEmployee = _employeeRepository.FindBy(request.ModifiedEmployeeID);
                    if (request.ConditionID != levelCondition.Condition.ID)
                    {
                        levelCondition.Condition = this._conditionRepository.FindBy(request.ConditionID);
                    }
                    if (request.LevelID != levelCondition.Level.ID)
                    {
                        levelCondition.Level = this._levelRepository.FindBy(request.LevelID);
                    }

                    if (levelCondition.RowVersion != request.RowVersion)
                    {
                        response.ErrorMessages.Add("EditConcurrencyKey");
                        return(response);
                    }
                    else
                    {
                        levelCondition.RowVersion += 1;
                    }

                    if (levelCondition.GetBrokenRules().Count() > 0)
                    {
                        foreach (BusinessRule businessRule in levelCondition.GetBrokenRules())
                        {
                            response.ErrorMessages.Add(businessRule.Rule);
                        }

                        return(response);
                    }

                    _levelConditionRepository.Save(levelCondition);
                    _uow.Commit();

                    ////response.success = true;
                }
                catch (Exception ex)
                {
                    response.ErrorMessages.Add(ex.Message);
                }
            }
            else
            {
                response.ErrorMessages.Add("NoItemToEditKey");
            }
            return(response);
        }
Beispiel #4
0
        public GeneralResponse AddLevelConditions(IEnumerable <AddLevelConditionRequest> requests)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                foreach (AddLevelConditionRequest request in requests)
                {
                    GetRequest2 getreq = new GetRequest2()
                    {
                        ID1 = request.LevelID, ID2 = request.ConditionID
                    };
                    LevelCondition lc = LevelCondition_Get(getreq);

                    if (lc == null)
                    {
                        LevelCondition levelCondition = new LevelCondition();
                        levelCondition.ID             = Guid.NewGuid();
                        levelCondition.CreateDate     = PersianDateTime.Now;
                        levelCondition.CreateEmployee = _employeeRepository.FindBy(request.CreateEmployeeID);
                        levelCondition.Condition      = this._conditionRepository.FindBy(request.ConditionID);
                        levelCondition.Level          = this._levelRepository.FindBy(request.LevelID);
                        levelCondition.RowVersion     = 1;

                        #region Validation
                        if (levelCondition.GetBrokenRules().Count() > 0)
                        {
                            foreach (BusinessRule businessRule in levelCondition.GetBrokenRules())
                            {
                                response.ErrorMessages.Add(businessRule.Rule);
                            }

                            return(response);
                        }
                        #endregion

                        _levelConditionRepository.Add(levelCondition);
                    }
                    else
                    {
                        response.ErrorMessages.Add("DuplicateCondition");
                        return(response);
                    }
                }

                _uow.Commit();

                ////response.success = true;
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add(ex.Message);
            }

            return(response);
        }
Beispiel #5
0
        public IEnumerable<LenLevel> Search(LevelCondition condition)
        {
            using (var db = new Entities())
            {
                IQueryable<LenLevel> query = db.LenLevel;
                query = condition.Filter(query);

                return query.OrderBy(q => q.ID).ToList();
            }
        }
    private IEnumerator WaitBoardController()
    {
        while (m_boardController.IsBusy)
        {
            yield return(new WaitForEndOfFrame());
        }

        yield return(new WaitForSeconds(1f));

        State = eStateGame.GAME_OVER;

        if (m_levelCondition != null)
        {
            m_levelCondition.ConditionCompleteEvent -= GameOver;

            Destroy(m_levelCondition);
            m_levelCondition = null;
        }
    }
Beispiel #7
0
        private LevelCondition LevelCondition_Get(GetRequest2 request)
        {
            LevelCondition levelCondition = new LevelCondition();

            try
            {
                Infrastructure.Querying.Query query = new Infrastructure.Querying.Query();
                Criterion criteria1 = new Criterion("Level.ID", request.ID1, CriteriaOperator.Equal);
                Criterion criteria2 = new Criterion("Condition.ID", request.ID2, CriteriaOperator.Equal);

                query.Add(criteria1); query.Add(criteria2);

                levelCondition = _levelConditionRepository.FindBy(query).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }

            return(levelCondition);
        }
    public void LoadLevel(eLevelMode mode)
    {
        m_boardController = new GameObject("BoardController").AddComponent <BoardController>();
        m_boardController.StartGame(this, m_gameSettings);

        if (mode == eLevelMode.MOVES)
        {
            m_levelCondition = this.gameObject.AddComponent <LevelMoves>();
            m_levelCondition.Setup(m_gameSettings.LevelMoves, m_uiMenu.GetLevelConditionView(), m_boardController);
        }
        else if (mode == eLevelMode.TIMER)
        {
            m_levelCondition = this.gameObject.AddComponent <LevelTime>();
            m_levelCondition.Setup(m_gameSettings.LevelMoves, m_uiMenu.GetLevelConditionView(), this);
        }

        m_levelCondition.ConditionCompleteEvent += GameOver;

        State = eStateGame.GAME_STARTED;
    }
Beispiel #9
0
        public GeneralResponse AddLevelCondition(AddLevelConditionRequest request)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                LevelCondition levelCondition = new LevelCondition();
                levelCondition.ID             = Guid.NewGuid();
                levelCondition.CreateDate     = PersianDateTime.Now;
                levelCondition.CreateEmployee = _employeeRepository.FindBy(request.CreateEmployeeID);
                levelCondition.Condition      = this._conditionRepository.FindBy(request.ConditionID);
                levelCondition.Level          = this._levelRepository.FindBy(request.LevelID);
                levelCondition.RowVersion     = 1;

                #region Validation
                if (levelCondition.GetBrokenRules().Count() > 0)
                {
                    foreach (BusinessRule businessRule in levelCondition.GetBrokenRules())
                    {
                        response.ErrorMessages.Add(businessRule.Rule);
                    }

                    return(response);
                }
                #endregion

                _levelConditionRepository.Add(levelCondition);
                _uow.Commit();

                ////response.success = true;
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add(ex.Message);
            }

            return(response);
        }
Beispiel #10
0
 public static LevelConditionView ConvertToLevelConditionView(this LevelCondition levelCondition)
 {
     return(Mapper.Map <LevelCondition, LevelConditionView>(levelCondition));
 }
Beispiel #11
0
 // GET: LeanManage/Level
 public ActionResult Index(LevelCondition condition)
 {
     var datas = LevelBiz.Search(condition);
     var model = PDM.Create(datas, condition);
     return View(model);
 }