Example #1
0
        public void DeleteFollow(int p_Tipster_OID, System.Collections.Generic.IList <int> p_follow_to_OIDs)
        {
            try
            {
                SessionInitializeTransaction();
                PickadosGenNHibernate.EN.Pickados.TipsterEN tipsterEN = null;
                tipsterEN = (TipsterEN)session.Load(typeof(TipsterEN), p_Tipster_OID);

                PickadosGenNHibernate.EN.Pickados.TipsterEN follow_toENAux = null;
                if (tipsterEN.Follow_to != null)
                {
                    foreach (int item in p_follow_to_OIDs)
                    {
                        follow_toENAux = (PickadosGenNHibernate.EN.Pickados.TipsterEN)session.Load(typeof(PickadosGenNHibernate.EN.Pickados.TipsterEN), item);
                        if (tipsterEN.Follow_to.Contains(follow_toENAux) == true)
                        {
                            tipsterEN.Follow_to.Remove(follow_toENAux);
                            follow_toENAux.Followed_by.Remove(tipsterEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_follow_to_OIDs you are trying to unrelationer, doesn't exist in TipsterEN");
                        }
                    }
                }

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

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


            finally
            {
                SessionClose();
            }
        }
Example #2
0
        public void AddFollow(int p_Tipster_OID, System.Collections.Generic.IList <int> p_follow_to_OIDs)
        {
            PickadosGenNHibernate.EN.Pickados.TipsterEN tipsterEN = null;
            try
            {
                SessionInitializeTransaction();
                tipsterEN = (TipsterEN)session.Load(typeof(TipsterEN), p_Tipster_OID);
                PickadosGenNHibernate.EN.Pickados.TipsterEN follow_toENAux = null;
                if (tipsterEN.Follow_to == null)
                {
                    tipsterEN.Follow_to = new System.Collections.Generic.List <PickadosGenNHibernate.EN.Pickados.TipsterEN>();
                }

                foreach (int item in p_follow_to_OIDs)
                {
                    follow_toENAux = new PickadosGenNHibernate.EN.Pickados.TipsterEN();
                    follow_toENAux = (PickadosGenNHibernate.EN.Pickados.TipsterEN)session.Load(typeof(PickadosGenNHibernate.EN.Pickados.TipsterEN), item);
                    follow_toENAux.Followed_by.Add(tipsterEN);

                    tipsterEN.Follow_to.Add(follow_toENAux);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
Example #3
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            TipsterEN t = obj as TipsterEN;

            if (t == null)
            {
                return(false);
            }
            if (Id.Equals(t.Id))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
 public TipsterEN(TipsterEN tipster)
 {
     this.init(Id, tipster.MonthlyStats, tipster.Post, tipster.Follow_to, tipster.Followed_by, tipster.Premium, tipster.Subscription_fee, tipster.CreatedAt, tipster.ModifiedAt, tipster.Alias, tipster.Email, tipster.Password);
 }