예제 #1
0
        public static ErrorCodes WriteMailToTargets(MassMail mail)
        {
            var ec = ErrorCodes.NoError;

            try
            {
                foreach (var target in mail.targets)
                {
                    Db.Query().CommandText(@"insert charactermessages (sender,folder,body,subject,type,targets,owner) values (@sender,@folder,@body,@subject,@type,@targets,@owner)")
                    .SetParameter("@sender", mail.sender.Id)
                    .SetParameter("@folder", mail.folder)
                    .SetParameter("@body", mail.body)
                    .SetParameter("@subject", mail.subject)
                    .SetParameter("@type", mail.type)
                    .SetParameter("@targets", GenxyConverter.SerializeObject(mail.targets.GetCharacterIDs().ToArray()))
                    .SetParameter("@owner", mail.owner.Id)
                    .SetParameter("@owner", target.Id)
                    .ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                Logger.Error("error occred in writeMailToTargetsSQL: " + ex.Message);
                ec = ErrorCodes.SQLExecutionError;
            }
            return(ec);
        }
예제 #2
0
        public static ErrorCodes WriteToOutbox(MassMail mail)
        {
            var res = Db.Query().CommandText(@"insert charactermessages (sender,folder,body,subject,type,targets,owner) values (@sender,@folder,@body,@subject,@type,@targets,@owner)")
                      .SetParameter("@sender", mail.sender.Id)
                      .SetParameter("@folder", (int)MailFolder.outbox)
                      .SetParameter("@body", mail.body)
                      .SetParameter("@subject", mail.subject)
                      .SetParameter("@type", (int)mail.type)
                      .SetParameter("@targets", GenxyConverter.SerializeObject(mail.targets.GetCharacterIDs().ToArray()))
                      .SetParameter("@owner", mail.sender.Id)
                      .ExecuteNonQuery();

            return((res != 1) ? ErrorCodes.SQLInsertError : ErrorCodes.NoError);
        }