public static Message.MessageRecipient ConvertFromMessageRecipientDB(MessageRecipientDB item)
        {
            Message.MessageRecipient toReturn = new Message.MessageRecipient();
            toReturn.AccountID = new Guid(item.AccountGuid);
            toReturn.IsRead = item.IsRead;

            return toReturn;
        }
        public static MessageRecipientDB ConvertFromMessageRecipient(Message.MessageRecipient item)
        {
            MessageRecipientDB toReturn = new MessageRecipientDB();
            toReturn.AccountGuid = item.AccountID.ToString();
            toReturn.IsRead = item.IsRead;

            return toReturn;
        }
Exemplo n.º 3
0
        public void MarkMessageRead(string messageGuid, string ownerAccountID)
        {
            #if(DEBUG)
            Console.WriteLine("Will mark message read! {0}", messageGuid);
            #endif

            lock (this.dbLock)
            {

                using (SQLiteConnection sqlCon = new SQLiteConnection(this.DBPath))
                {

                    sqlCon.Execute(WZConstants.DBClauseSyncOff);

                    sqlCon.BeginTransaction();

                    try
                    {

                        if (sqlCon.Execute("UPDATE MessageRecipientDB SET IsRead=? WHERE MessageGuid=? AND AccountGuid=?", true, messageGuid, ownerAccountID) == 0)
                        {

                            MessageRecipientDB msgRcp = new MessageRecipientDB()
                            {

                                AccountGuid = ownerAccountID,
                                MessageGuid = messageGuid,
                                IsRead = true

                            };

            #if(DEBUG)
                            Console.WriteLine("Created a new message recipient! {0}", msgRcp);
            #endif

                            sqlCon.Insert(msgRcp, typeof(MessageRecipientDB));

                        }//end if
                        sqlCon.Commit();

                    } catch (Exception ex)
                    {

            #if(DEBUG)
                        Console.WriteLine("Error in MarkMessageRead! {0}--{1}", ex.Message, ex.StackTrace);
            #endif
                        sqlCon.Rollback();

                    }//end try catch

                }//end using sqlCon

            }//end lock
        }