Ejemplo n.º 1
0
        public DomainModel.BusinessObject.GameCoding LoadGameCoding(string gameCode, String ageGroup)
        {
            String stemId          = gameCode[0].ToString();
            int    AgeGroupIndex   = gameCode.IndexOf(ageGroup[0]);
            int    branchIdPerStem = int.Parse(gameCode.Substring(1, AgeGroupIndex - 1));

            String ageRangeId = ageGroup;
            int    bracIndex  = gameCode.IndexOf("(");
            int    end        = bracIndex - (AgeGroupIndex + 1);
            int    gameId     = int.Parse(gameCode.Substring(AgeGroupIndex + 1, end));
            Branch branch     = _dbx.Branches.SingleOrDefault(p => p.stemID == stemId && p.branchNumPerSTEM == branchIdPerStem);

            DatabaseModel.GameCoding game = _dbx.GameCodings.SingleOrDefault(p => p.STEM.Id == stemId && p.BranchId == branch.Id && p.AgeRange.Id == ageRangeId && p.Game.Id == gameId);
            DomainModel.BusinessObject.GameCoding gameCodingDomain = new DomainModel.BusinessObject.GameCoding();

            gameCodingDomain.Id = game.Id;
            DomainModel.BusinessObject.STEM stemdomain = new DomainModel.BusinessObject.STEM();
            stemdomain.Id          = game.STEM.Id;
            stemdomain.Description = game.STEM.Description;
            gameCodingDomain.Stem  = stemdomain;

            DomainModel.BusinessObject.Branches branchDomain = new DomainModel.BusinessObject.Branches();
            branchDomain.Id = game.Branch.Id;
            branchDomain.branchNumPerStem = game.Branch.branchNumPerSTEM;
            branchDomain.branchName       = game.Branch.branchName;
            branchDomain.stem             = gameCodingDomain.Stem;
            gameCodingDomain.Branch       = branchDomain;

            DomainModel.BusinessObject.AgeRange ageRangeDomain = new DomainModel.BusinessObject.AgeRange();
            ageRangeDomain.ID         = game.AgeRange.Id;
            ageRangeDomain.minAge     = game.AgeRange.minAge;
            ageRangeDomain.maxAge     = game.AgeRange.maxAge;
            gameCodingDomain.AgeRange = ageRangeDomain;

            DomainModel.BusinessObject.Games gameDomain = new DomainModel.BusinessObject.Games();
            gameDomain.Id         = game.Game.Id;
            gameDomain.GameName   = game.Game.gameName;
            gameCodingDomain.Game = gameDomain;

            return(gameCodingDomain);
        }
Ejemplo n.º 2
0
        public List <DomainModel.BusinessObject.GameCoding> LoadGameCodeByAgeAndSTEMAndBranch(DomainModel.BusinessObject.AgeRange ageRange, DomainModel.BusinessObject.STEM stem, DomainModel.BusinessObject.Branches branch)
        {
            List <DomainModel.BusinessObject.GameCoding> gameCoding = new List <DomainModel.BusinessObject.GameCoding>();
            List <DatabaseModel.GameCoding> lst_gameCode            = (from l in _dbx.GameCodings
                                                                       where l.STEM.Id == stem.Id && l.AgeRange.Id == ageRange.ID && l.BranchId == branch.Id
                                                                       select l).ToList();

            foreach (DatabaseModel.GameCoding game in lst_gameCode)
            {
                DomainModel.BusinessObject.GameCoding gameCodingDomain = new DomainModel.BusinessObject.GameCoding();

                gameCodingDomain.Id = game.Id;
                DomainModel.BusinessObject.STEM stemdomain = new DomainModel.BusinessObject.STEM();
                stemdomain.Id          = game.STEM.Id;
                stemdomain.Description = game.STEM.Description;
                gameCodingDomain.Stem  = stemdomain;

                DomainModel.BusinessObject.Branches branchDomain = new DomainModel.BusinessObject.Branches();
                branchDomain.Id = game.Branch.Id;
                branchDomain.branchNumPerStem = game.Branch.branchNumPerSTEM;
                branchDomain.branchName       = game.Branch.branchName;
                branchDomain.stem             = gameCodingDomain.Stem;
                gameCodingDomain.Branch       = branchDomain;

                DomainModel.BusinessObject.AgeRange ageRangeDomain = new DomainModel.BusinessObject.AgeRange();
                ageRangeDomain.ID         = game.AgeRange.Id;
                ageRangeDomain.minAge     = game.AgeRange.minAge;
                ageRangeDomain.maxAge     = game.AgeRange.maxAge;
                gameCodingDomain.AgeRange = ageRangeDomain;

                DomainModel.BusinessObject.Games gameDomain = new DomainModel.BusinessObject.Games();
                gameDomain.Id         = game.Game.Id;
                gameDomain.GameName   = game.Game.gameName;
                gameCodingDomain.Game = gameDomain;
                gameCoding.Add(gameCodingDomain);
            }
            return(gameCoding);
        }
Ejemplo n.º 3
0
        public List <DomainModel.BusinessObject.GameCoding> LoadGameModuleByAgeAndSTEMAndBranch(DomainModel.BusinessObject.AgeRange ageRange, DomainModel.BusinessObject.STEM stem, DomainModel.BusinessObject.Branches branch)
        {
            List <DomainModel.BusinessObject.GameCoding> lstGameCoding = new List <DomainModel.BusinessObject.GameCoding>();

            lstGameCoding = gameCodingRepo.LoadGameCodeByAgeAndSTEMAndBranch(ageRange, stem, branch);
            int i;

            for (i = 0; i < lstGameCoding.Count; i++)
            {
                List <DomainModel.BusinessObject.Module> gameModule = gameCodingRepo.GetGameModule(lstGameCoding.ElementAt(i).Game);
                lstGameCoding.ElementAt(i).Modules = gameModule;
            }
            return(lstGameCoding);
        }