Пример #1
0
        public void JoinNationalTeam(int p_Player_OID, int p_national_team_OID)
        {
            PickadosGenNHibernate.EN.Pickados.PlayerEN playerEN = null;
            try
            {
                SessionInitializeTransaction();
                playerEN = (PlayerEN)session.Load(typeof(PlayerEN), p_Player_OID);
                playerEN.National_team = (PickadosGenNHibernate.EN.Pickados.TeamEN)session.Load(typeof(PickadosGenNHibernate.EN.Pickados.TeamEN), p_national_team_OID);

                playerEN.National_team.National_player.Add(playerEN);



                session.Update(playerEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is PickadosGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new PickadosGenNHibernate.Exceptions.DataLayerException("Error in PlayerCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            PlayerEN t = obj as PlayerEN;

            if (t == null)
            {
                return(false);
            }
            if (Id.Equals(t.Id))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
        public void UnlinkNationalTeam(int p_Player_OID, int p_national_team_OID)
        {
            try
            {
                SessionInitializeTransaction();
                PickadosGenNHibernate.EN.Pickados.PlayerEN playerEN = null;
                playerEN = (PlayerEN)session.Load(typeof(PlayerEN), p_Player_OID);

                if (playerEN.National_team.Id == p_national_team_OID)
                {
                    playerEN.National_team = null;
                }
                else
                {
                    throw new ModelException("The identifier " + p_national_team_OID + " in p_national_team_OID you are trying to unrelationer, doesn't exist in PlayerEN");
                }

                session.Update(playerEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is PickadosGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new PickadosGenNHibernate.Exceptions.DataLayerException("Error in PlayerCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
Пример #4
0
 public PlayerEN(PlayerEN player)
 {
     this.init(Id, player.Club_team, player.National_team, player.Name, player.Scorer);
 }