Ejemplo n.º 1
0
        public override void AfterSave(bool isUpdate)
        {
            base.AfterSave(isUpdate);

            PrivateLastMessage plm = Provider.Database.Read<PrivateLastMessage>("MailBoxOwnerId={0} AND UserId={1}", Provider.User.Id, this.ToUserId);
            if (plm == null)
                plm = new PrivateLastMessage { MailBoxOwnerId = Provider.User.Id, UserId = this.ToUserId };
            plm.Summary = this.Message.StrCrop(30);
            plm.Save();

            PrivateLastMessage plm2 = Provider.Database.Read<PrivateLastMessage>("MailBoxOwnerId={0} AND UserId={1}", this.ToUserId, Provider.User.Id);
            if((plm2==null || plm2.UpdateDate<DateTime.Now.AddHours(-2)) && ToUser.Settings.MailAfterMessage)
            {
                string msg = String.Format(@"
                                Merhaba {0},<br/><br/>
                                {1} size özel mesaj gönderdi:<br/><br/>
                                <i>{2}</i><br/><br/>
                                <a href=""http://{3}"">http://{3}</a>",
                this.ToUser.FullName,
                Provider.User.FullName,
                this.Message,
                Provider.Configuration.SiteAddress);
                Provider.SendMail(this.ToUser.Email, Provider.User.FullName + " size özel mesaj gönderdi", msg);
            }

            if (plm2 == null)
                plm2 = new PrivateLastMessage { MailBoxOwnerId = this.ToUserId, UserId = Provider.User.Id };
            plm2.Summary = this.Message.StrCrop(30);
            plm2.Save();
        }
Ejemplo n.º 2
0
        public override void AfterSave(bool isUpdate)
        {
            base.AfterSave(isUpdate);

            PrivateLastMessage plm = Provider.Database.Read <PrivateLastMessage>("MailBoxOwnerId={0} AND UserId={1}", Provider.User.Id, this.ToUserId);

            if (plm == null)
            {
                plm = new PrivateLastMessage {
                    MailBoxOwnerId = Provider.User.Id, UserId = this.ToUserId
                }
            }
            ;
            plm.Summary = this.Message.StrCrop(30);
            plm.Save();

            PrivateLastMessage plm2 = Provider.Database.Read <PrivateLastMessage>("MailBoxOwnerId={0} AND UserId={1}", this.ToUserId, Provider.User.Id);

            if ((plm2 == null || plm2.UpdateDate < DateTime.Now.AddHours(-2)) && ToUser.Settings.MailAfterMessage)
            {
                string msg = String.Format(@"
                                Merhaba {0},<br/><br/>
                                {1} size özel mesaj gönderdi:<br/><br/>
                                <i>{2}</i><br/><br/>
                                <a href=""http://{3}"">http://{3}</a>",
                                           this.ToUser.FullName,
                                           Provider.User.FullName,
                                           this.Message,
                                           Provider.Configuration.SiteAddress);
                Provider.SendMail(this.ToUser.Email, Provider.User.FullName + " size özel mesaj gönderdi", msg);
            }

            if (plm2 == null)
            {
                plm2 = new PrivateLastMessage {
                    MailBoxOwnerId = this.ToUserId, UserId = Provider.User.Id
                }
            }
            ;
            plm2.Summary = this.Message.StrCrop(30);
            plm2.Save();
        }