Ejemplo n.º 1
0
 internal static long InsertMailMessage(GameMailMessage mail)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Mail_Insert", conn);
             sp.AddParameter("@senderID", SqlDbType.Int, 4, ParameterDirection.Input, mail.SenderID);
             sp.AddParameter("@receiverID", SqlDbType.Int, 4, ParameterDirection.Input, mail.ReceiverID);
             sp.AddParameter("@timeSent", SqlDbType.DateTime, 8, ParameterDirection.Input, mail.TimeSent);
             sp.AddParameter("@subject", SqlDbType.NVarChar, 50, ParameterDirection.Input, mail.Subject);
             sp.AddParameter("@body", SqlDbType.VarChar, 4000, ParameterDirection.Input, mail.Body);
             sp.AddParameter("@attachment", SqlDbType.Bit, 1, ParameterDirection.Input, mail.HasAttachment);
             sp.AddParameter("@readByReceiver", SqlDbType.Bit, 1, ParameterDirection.Input, false);
             sp.AddParameter("@mailID", SqlDbType.BigInt, 8, ParameterDirection.Output);
             return(Convert.ToInt64(sp.ExecuteScalar()));
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }