Пример #1
0
 public static Boolean updateRace(LegaGladio.Entities.Race race, int oldID)
 {
     try
     {
         return DataAccessLayer.Race.updateRace(race, oldID);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while updating races");
         throw ex;
     }
 }
Пример #2
0
 public static Boolean newPlayer(LegaGladio.Entities.Player player)
 {
     try
     {
         return DataAccessLayer.Player.newPlayer(player);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while creating players");
         throw ex;
     }
 }
Пример #3
0
 public static Boolean updatePlayer(LegaGladio.Entities.Player player, int oldID)
 {
     try
     {
         return DataAccessLayer.Player.updatePlayer(player, oldID);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while updating players");
         throw ex;
     }
 }
Пример #4
0
 public static Boolean updateSkill(LegaGladio.Entities.Skill skill, int oldID)
 {
     try
     {
         return DataAccessLayer.Skill.updateSkill(skill, oldID);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while updating skills");
         throw ex;
     }
 }
Пример #5
0
 public static Boolean newSkill(LegaGladio.Entities.Skill skill)
 {
     try
     {
         return DataAccessLayer.Skill.newSkill(skill);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while creating skills");
         throw ex;
     }
 }
Пример #6
0
 public static Boolean newPositional(LegaGladio.Entities.Positional positional)
 {
     try
     {
         return DataAccessLayer.Positional.newPositional(positional);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while creating positionals");
         throw ex;
     }
 }
Пример #7
0
 public static List<LegaGladio.Entities.Game> listGame(LegaGladio.Entities.Coach coach)
 {
     try
     {
         return DataAccessLayer.Game.listGame(coach);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while listing games for coach");
         throw ex;
     }
 }
Пример #8
0
 public static Boolean updatePositional(LegaGladio.Entities.Positional positional, int oldID)
 {
     try
     {
         return DataAccessLayer.Positional.updatePositional(positional, oldID);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while updating positionals");
         throw ex;
     }
 }
Пример #9
0
 public static Boolean updateCoach(LegaGladio.Entities.Coach coach, int oldID)
 {
     try
     {
         return DataAccessLayer.Coach.updateCoach(coach, oldID);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while updating coaches");
         throw ex;
     }
 }
Пример #10
0
 public static Boolean newCoach(LegaGladio.Entities.Coach coach)
 {
     try
     {
         return DataAccessLayer.Coach.newCoach(coach);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while creating coaches");
         throw ex;
     }
 }
Пример #11
0
 public static Boolean newRace(LegaGladio.Entities.Race race)
 {
     try
     {
         return DataAccessLayer.Race.newRace(race);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while creating races");
         throw ex;
     }
 }
Пример #12
0
 public static Boolean newTeam(LegaGladio.Entities.Team team)
 {
     try
     {
         return DataAccessLayer.Team.newTeam(team);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while creating teams");
         throw ex;
     }
 }
Пример #13
0
 public static List<LegaGladio.Entities.Game> listGame(LegaGladio.Entities.Team team)
 {
     LegaGladioDS.gameDataTable gdt = new LegaGladioDS.gameDataTable();
     LegaGladioDSTableAdapters.gameTableAdapter gta = new LegaGladioDSTableAdapters.gameTableAdapter();
     try
     {
         gta.FillByTeamId(gdt, team.Id);
     }
     catch (Exception ex)
     {
         gdt.GetErrors();
         throw ex;
     }
     List<LegaGladio.Entities.Game> gameList = new List<LegaGladio.Entities.Game>();
     foreach (LegaGladioDS.gameRow gr in gdt.Rows)
     {
         LegaGladio.Entities.Game game = new LegaGladio.Entities.Game();
         game.Id = gr.id;
         game.Home = Team.getTeam(gr.homeID);
         game.Guest = Team.getTeam(gr.guestID);
         game.TdHome = gr.tdHome;
         game.TdGuest = gr.tdGuest;
         game.CasHome = gr.casHome;
         game.CasGuest = gr.casGuest;
         game.SpHome = gr.spHome;
         game.SpGuest = gr.spGuest;
         game.EarningHome = gr.earningHome;
         game.EarningGuest = gr.earningGuest;
         game.VarFFHome = gr.varFFHome;
         game.VarFFGuest = gr.varFFGuest;
         gameList.Add(game);
     }
     gta = null;
     gdt = null;
     return gameList;
 }
Пример #14
0
 public static Boolean updateCoach(LegaGladio.Entities.Coach coach, int oldID)
 {
     LegaGladioDSTableAdapters.coachTableAdapter cta = new LegaGladioDSTableAdapters.coachTableAdapter();
     LegaGladioDS.coachDataTable cdt = new LegaGladioDS.coachDataTable();
     LegaGladioDS.coachRow cr = (LegaGladioDS.coachRow)cdt.NewRow();
     cr.id = oldID;
     cr.name = coach.Name;
     cr.active = coach.Active;
     cr.nafID = coach.NafID;
     cr.nafNick = coach.NafNick;
     cr.note = coach.Notes;
     cr.value = coach.Value;
     int result = cta.Update(cr);
     return result > 0;
 }
Пример #15
0
 public static Boolean updateRace(LegaGladio.Entities.Race race, int oldID)
 {
     LegaGladioDSTableAdapters.raceTableAdapter rta = new LegaGladioDSTableAdapters.raceTableAdapter();
     LegaGladioDS.raceDataTable rdt = new LegaGladioDS.raceDataTable();
     LegaGladioDS.raceRow rr = (LegaGladioDS.raceRow)rdt.NewRow();
     rr.id = oldID;
     rr.name = race.Name;
     int result = rta.Update(rr);
     return result > 0;
 }
Пример #16
0
 public static Boolean newPlayer(LegaGladio.Entities.Player player)
 {
     LegaGladioDSTableAdapters.playerTableAdapter pta = new LegaGladioDSTableAdapters.playerTableAdapter();
     //name, map, agp, avp, stp, cost, spp, td, cas, pass, inter, niggling, missNextGame, mam, agm, avm, stm, retired, dead
     int result = pta.Insert(player.Name, player.MaPlus, player.AgPlus, player.AvPlus, player.StPlus, player.Cost, player.Spp, player.Td, player.Cas, player.Pass, player.Inter, player.Niggling, (byte)(player.MissNextGame ? 1 : 0), player.MaMinus, player.AgMinus, player.AvMinus, player.StMinus, (byte)(player.Retired ? 1 : 0), (byte)(player.Dead?1:0));
     pta = null;
     return result > 0;
 }
Пример #17
0
 public static Boolean newCoach(LegaGladio.Entities.Coach coach)
 {
     LegaGladioDSTableAdapters.coachTableAdapter cta = new LegaGladioDSTableAdapters.coachTableAdapter();
     int result = cta.Insert(coach.Name, coach.Value, coach.NafID, coach.Notes, coach.Active, coach.NafNick);
     cta = null;
     return result > 0;
 }
Пример #18
0
 public static Boolean newSkill(LegaGladio.Entities.Skill skill)
 {
     LegaGladioDSTableAdapters.skillTableAdapter sta = new LegaGladioDSTableAdapters.skillTableAdapter();
     int rowNum = sta.Insert(skill.Name, (int)skill.SkillType);
     sta = null;
     return rowNum == 1;
 }
Пример #19
0
 public static Boolean updatePlayer(LegaGladio.Entities.Player player, int oldID)
 {
     LegaGladioDSTableAdapters.playerTableAdapter pta = new LegaGladioDSTableAdapters.playerTableAdapter();
     LegaGladioDS.playerDataTable pdt = new LegaGladioDS.playerDataTable();
     LegaGladioDS.playerRow pr = (LegaGladioDS.playerRow)pdt.NewRow();
     pr.agm = player.AgMinus;
     pr.agp = player.AgPlus;
     pr.dead = player.Dead;
     pr.retired = player.Retired;
     pr.avm = player.AvMinus;
     pr.avp = player.AvPlus;
     pr.cas = player.Cas;
     pr.inter = player.Inter;
     pr.cost = player.Cost;
     pr.id = oldID;
     pr.mam = player.MaMinus;
     pr.map = player.MaPlus;
     pr.missNextGame = player.MissNextGame;
     pr.name = player.Name;
     pr.niggling = player.Niggling;
     pr.pass = player.Pass;
     pr.spp = player.Spp;
     pr.stm = player.StMinus;
     pr.stp = player.StPlus;
     pr.td = player.Td;
     int result = pta.Update(pr);
     return result > 0;
 }
Пример #20
0
 public static Boolean newTeam(LegaGladio.Entities.Team team)
 {
     LegaGladioDSTableAdapters.teamTableAdapter tta = new LegaGladioDSTableAdapters.teamTableAdapter();
     //value, name, funFactor, reroll, hasMedic, cheerleader, assistantCoach, active
     int result = tta.Insert(team.Value, team.Name, team.FunFactor, team.Reroll, (byte)(team.HasMedic ? 1 : 0), team.Cheerleader, team.AssistantCoach, (byte)(team.Active? 1 : 0));
     tta = null;
     return result > 0;
 }
Пример #21
0
 public static Boolean updateSkill(LegaGladio.Entities.Skill skill, int oldID)
 {
     LegaGladioDSTableAdapters.skillTableAdapter sta = new LegaGladioDSTableAdapters.skillTableAdapter();
     LegaGladioDS.skillDataTable sdt = new LegaGladioDS.skillDataTable();
     LegaGladioDS.skillRow sr = (LegaGladioDS.skillRow)sdt.NewRow();
     sr.id = oldID;
     sr.name = skill.Name;
     sr.type = (int)skill.SkillType;
     int result = sta.Update(sr);
     return result > 0;
 }
Пример #22
0
        public static Boolean updatePositional(LegaGladio.Entities.Positional positional, int oldID)
        {
            LegaGladioDSTableAdapters.positionalTableAdapter pta = new LegaGladioDSTableAdapters.positionalTableAdapter();
            LegaGladioDSTableAdapters.positional_skillTableAdapter psta = new LegaGladioDSTableAdapters.positional_skillTableAdapter();

            int rowNum = pta.Update(positional.Qty, positional.Title, (Decimal)positional.Cost, positional.Ma, positional.St, positional.Ag, positional.Av, oldID);

            LegaGladioDS.positional_skillDataTable psdt =  psta.GetDataByPositionalId(positional.Id);

            List<LegaGladio.Entities.Skill> agilityList = new List<LegaGladio.Entities.Skill>();
            List<LegaGladio.Entities.Skill> generalList = new List<LegaGladio.Entities.Skill>();
            List<LegaGladio.Entities.Skill> strengthList = new List<LegaGladio.Entities.Skill>();
            List<LegaGladio.Entities.Skill> passingList = new List<LegaGladio.Entities.Skill>();
            List<LegaGladio.Entities.Skill> mutationList = new List<LegaGladio.Entities.Skill>();
            List<LegaGladio.Entities.Skill> extraordinaryList = new List<LegaGladio.Entities.Skill>();

            foreach (LegaGladioDS.positional_skillRow psRow in psdt)
            {
                LegaGladio.Entities.Skill skill = Skill.getSkill((int)psRow.skillID);

                switch (skill.SkillType)
                {
                    case LegaGladio.Entities.SkillType.AGILITY:
                        agilityList.Add(skill);
                        break;
                    case LegaGladio.Entities.SkillType.GENERAL:
                        generalList.Add(skill);
                        break;
                    case LegaGladio.Entities.SkillType.STRENGTH:
                        strengthList.Add(skill);
                        break;
                    case LegaGladio.Entities.SkillType.PASSING:
                        passingList.Add(skill);
                        break;
                    case LegaGladio.Entities.SkillType.MUTATION:
                        mutationList.Add(skill);
                        break;
                    case LegaGladio.Entities.SkillType.EXTRAORDINARY:
                        extraordinaryList.Add(skill);
                        break;
                }

            }

            List<LegaGladio.Entities.Skill> listaAggiunte = new List<LegaGladio.Entities.Skill>();
            List<LegaGladio.Entities.Skill> listaRimozioni = new List<LegaGladio.Entities.Skill>();

            listaAggiunte.AddRange((List<LegaGladio.Entities.Skill>)positional.Agility.Except(agilityList));
            listaAggiunte.AddRange((List<LegaGladio.Entities.Skill>)positional.General.Except(generalList));
            listaAggiunte.AddRange((List<LegaGladio.Entities.Skill>)positional.Strength.Except(strengthList));
            listaAggiunte.AddRange((List<LegaGladio.Entities.Skill>)positional.Passing.Except(passingList));
            listaAggiunte.AddRange((List<LegaGladio.Entities.Skill>)positional.Mutation.Except(mutationList));
            listaAggiunte.AddRange((List<LegaGladio.Entities.Skill>)positional.Extraordinary.Except(extraordinaryList));

            listaRimozioni.AddRange((List<LegaGladio.Entities.Skill>)agilityList.Except(positional.Agility));
            listaRimozioni.AddRange((List<LegaGladio.Entities.Skill>)generalList.Except(positional.General));
            listaRimozioni.AddRange((List<LegaGladio.Entities.Skill>)strengthList.Except(positional.Strength));
            listaRimozioni.AddRange((List<LegaGladio.Entities.Skill>)passingList.Except(positional.Passing));
            listaRimozioni.AddRange((List<LegaGladio.Entities.Skill>)mutationList.Except(positional.Mutation));
            listaRimozioni.AddRange((List<LegaGladio.Entities.Skill>)extraordinaryList.Except(positional.Extraordinary));

            Skill.newSkills(listaAggiunte);
            Skill.deleteSkills(listaRimozioni);

            return rowNum == 1;
        }
Пример #23
0
        public static Boolean newPositional(LegaGladio.Entities.Positional positional)
        {
            LegaGladioDSTableAdapters.positionalTableAdapter pta = new LegaGladioDSTableAdapters.positionalTableAdapter();
            LegaGladioDSTableAdapters.positional_skillTableAdapter psta = new LegaGladioDSTableAdapters.positional_skillTableAdapter();

            //g, a, s, p, m, e
            int id = (int)pta.InsertPositional(positional.Qty, positional.Title, (Decimal)positional.Cost, positional.Ma, positional.St, positional.Ag, positional.Av);

            foreach (LegaGladio.Entities.Skill skill in positional.Agility)
            {
                psta.InsertPositionalSkill(id, skill.Id);
            }

            foreach (LegaGladio.Entities.Skill skill in positional.General)
            {
                psta.InsertPositionalSkill(id, skill.Id);
            }

            foreach (LegaGladio.Entities.Skill skill in positional.Strength)
            {
                psta.InsertPositionalSkill(id, skill.Id);
            }

            foreach (LegaGladio.Entities.Skill skill in positional.Passing)
            {
                psta.InsertPositionalSkill(id, skill.Id);
            }

            foreach (LegaGladio.Entities.Skill skill in positional.Mutation)
            {
                psta.InsertPositionalSkill(id, skill.Id);
            }

            foreach (LegaGladio.Entities.Skill skill in positional.Extraordinary)
            {
                psta.InsertPositionalSkill(id, skill.Id);
            }

            return id > -1;
        }
Пример #24
0
 public static Boolean updateTeam(LegaGladio.Entities.Team team, int oldID)
 {
     try
     {
         return DataAccessLayer.Team.updateTeam(team, oldID);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while updating teams");
         throw ex;
     }
 }
Пример #25
0
 public static Boolean newRace(LegaGladio.Entities.Race race)
 {
     LegaGladioDSTableAdapters.raceTableAdapter rta = new LegaGladioDSTableAdapters.raceTableAdapter();
     int result = rta.Insert(race.Name);
     rta = null;
     return result > 0;
 }
Пример #26
0
 public static Boolean updateTeam(LegaGladio.Entities.Team team, int oldID)
 {
     LegaGladioDSTableAdapters.teamTableAdapter tta = new LegaGladioDSTableAdapters.teamTableAdapter();
     LegaGladioDS.teamDataTable tdt = new LegaGladioDS.teamDataTable();
     LegaGladioDS.teamRow tr = (LegaGladioDS.teamRow)tdt.NewRow();
     tr.id = oldID;
     tr.name = team.Name;
     tr.value = team.Value;
     tr.funFactor = team.FunFactor;
     tr.reroll = team.Reroll;
     tr.hasMedic = team.HasMedic;
     tr.cheerleader = team.Cheerleader;
     tr.assistantCoach = team.AssistantCoach;
     tr.active = team.Active;
     int result = tta.Update(tr);
     return result > 0;
 }