コード例 #1
0
        public ContentState(MessageDB message)
        {
            this.Message = message;
            this.MessageSteps = this.Message.MessageStepDBList
                .ToDictionary(s => s.StepNumber, s => s);

            this.ContentPackIDQ = new Queue<int>();
            this.VoiceIDQ = new Queue<int>();
            this.PollingIDQ = new Queue<int>();
            this.AnimationIDQ = new Queue<int>();

            this.CreateCriteriaQueues();
        }
コード例 #2
0
        public void InsertOutgoingMessage(MessageDB message)
        {
            lock (this.dbLock)
            {

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

                    sqlCon.Execute(WZConstants.DBClauseSyncOff);
                    sqlCon.BeginTransaction();

                    try
                    {

                        message.IsOutgoing = true;
                        sqlCon.Insert(message, typeof(MessageDB));
                        sqlCon.InsertAll(message.MessageStepDBList);
                        sqlCon.InsertAll(message.MessageRecipientDBList);

                        sqlCon.Commit();

                    } catch (Exception ex)
                    {

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

                    }//end try catch

                }//end using sqlCon

            }//end lock
        }
コード例 #3
0
        public static Message ConvertFromMessageDB(MessageDB item)
        {
            Message toReturn = new Message ();

            toReturn.Errors = item.Errors;
            toReturn.FromAccountID = item.FromAccountID;
            toReturn.MessageID = item.MessageID;
            toReturn.MessageSent = item.MessageSent;
            toReturn.MessageConfirmed = item.MessageConfirmed;

            if (null != item.MessageStepDBList &&
                item.MessageStepDBList.Count > 0) {
                MessageStep[] messageSteps = new MessageStep[item.MessageStepDBList.Count];
                for (int i = 0; i < item.MessageStepDBList.Count; i++) {
                    messageSteps [i] = MessageStepDB.ConvertFromMessageStepDB (item.MessageStepDBList [i]);
                }//end for

                toReturn.MessageSteps = messageSteps.ToList ();
            }//end if

            if (null != item.MessageRecipientDBList &&
                item.MessageRecipientDBList.Count > 0) {
                Message.MessageRecipient[] recipients = new MessageRecipient[item.MessageRecipientDBList.Count];
                for (int i = 0; i < item.MessageRecipientDBList.Count; i++) {
                    recipients [i] = MessageRecipientDB.ConvertFromMessageRecipientDB (item.MessageRecipientDBList [i]);
                }//end for

                toReturn.MessageRecipients = recipients.ToList ();
            }//end if

            return toReturn;
        }
コード例 #4
0
        public static MessageDB ConvertFromMessage(Message item)
        {
            MessageDB toReturn = new MessageDB ();
            toReturn.Errors = item.Errors;
            toReturn.FromAccountID = item.FromAccountID;
            toReturn.MessageID = item.MessageID;
            toReturn.MessageSent = item.MessageSent;
            toReturn.MessageSteps = item.MessageSteps;
            toReturn.MessageConfirmed = item.MessageConfirmed;
            toReturn.MessageStepDBList = new List<MessageStepDB> ();

            if (null != item.MessageSteps &&
                item.MessageSteps.Count > 0)
            {

                foreach (MessageStep eachMessageStep in item.MessageSteps)
                {
                    toReturn.MessageStepDBList.Add (MessageStepDB.ConvertFromMessageStep (eachMessageStep));
                }//end foreach

            }//end if

            toReturn.MessageRecipientDBList = new List<MessageRecipientDB> ();

            if (null != item.MessageRecipients &&
                item.MessageRecipients.Count > 0)
            {
                foreach (Message.MessageRecipient eachMessageRecipient in item.MessageRecipients)
                {

                    MessageRecipientDB msgRcpDB = MessageRecipientDB.ConvertFromMessageRecipient (eachMessageRecipient);
                    msgRcpDB.MessageGuid = toReturn.MessageGuid;
                    toReturn.MessageRecipientDBList.Add (msgRcpDB);

                }//end foreach
            }//end if

            return toReturn;
        }