Esempio n. 1
0
        public override RefererHostDup GetInstance(ISession session, ManagedSecurityContext sec)
        {
            RefererHostDup instance = base.GetInstance(session, sec);

            instance.Host        = this.Host;
            instance.RefererHost = ManagedRefererHost.Find(session, this.RefererHost);
            return(instance);
        }
Esempio n. 2
0
        public override int CreateOrUpdate(TransitRefererHostDup instance, ManagedSecurityContext sec)
        {
            RefererHost rh = ManagedRefererHost.FindOrCreate(Session, instance.RefererHost);

            // merge existing dup hosts
            IList hosts = Session.CreateCriteria(typeof(RefererHost))
                          .Add(Expression.Like("Host", instance.Host)).List();

            foreach (RefererHost host in hosts)
            {
                if (host != rh)
                {
                    rh.Total += host.Total;
                    Session.Delete(host);
                }
            }

            Session.Save(rh);
            return(base.CreateOrUpdate(instance, sec));
        }
Esempio n. 3
0
        public override RefererAccount GetInstance(ISession session, ManagedSecurityContext sec)
        {
            RefererAccount instance = base.GetInstance(session, sec);

            instance.RefererHost = string.IsNullOrEmpty(this.RefererHostName) ? null : ManagedRefererHost.Find(session, this.RefererHostName);
            instance.Account     = (AccountId != 0) ? session.Load <Account>(AccountId) : null;
            return(instance);
        }