示例#1
0
        public void AddReplyTo(ClassifiedMessage oMessageReply)
        {
            ClassifiedMessage oMessage = this.oMessages.Find(msg => msg.Id == oMessageReply.ReplyTo);

            if (oMessage != null)
            {
                oMessage.AddReply(oMessageReply);
            }
        }
示例#2
0
 public async Task NotifyMessage(ClassifiedMessage message)
 {
     if (this.isValid)
     {
         var user = new User(this.CreatedBy);
         if (user.oDetails.ConsentToContact)
         {
             //Send mail
         }
     }
 }
示例#3
0
        public void LoadMessages(string cFrom = "", string cTo = "")
        {
            string                      cProcedure = "";
            ClassifiedMessage           oMessage;
            DataTable                   oMessagesDB;
            Dictionary <string, object> infoParameters = new Dictionary <string, object>();

            infoParameters.Add("cClassifiedId", this.Id);

            if (cFrom.Length == 0 && cTo.Length == 0)
            {
                cProcedure = "sp_Messages_GetAll";
            }
            else if (cFrom.Length == 0 && cTo.Length > 0)
            {
                cProcedure = "sp_Messages_GetClsTo";
                infoParameters.Add("cTo", cTo);
            }
            else if (cFrom.Length > 0 && cTo.Length == 0)
            {
                cProcedure = "sp_Messages_GetClsFrom";
                infoParameters.Add("cFrom", cFrom);
            }
            else
            {
                cProcedure = "sp_Messages_GetClsFromTo";
                infoParameters.Add("cFrom", cFrom);
                infoParameters.Add("cTo", cTo);
            }

            try
            {
                oMessagesDB = DBConn.ExecuteCommand(cProcedure, infoParameters).Tables[0];
                if (!oMessagesDB.HasErrors)
                {
                    foreach (DataRow oRow in oMessagesDB.Rows)
                    {
                        oMessage = new ClassifiedMessage();
                        oMessage.MapFromTableRow(oRow);
                        if (oMessage.isValid)
                        {
                            this.oMessages.Add(oMessage);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                this.sMsgError.Add("Error getting messages.");
                this.sMsgError.Add(e.Message);
            }
        }
示例#4
0
        public void LoadMessagesFrom(string cFrom)
        {
            ClassifiedMessage           oMessage;
            DataTable                   oMessagesDB;
            Dictionary <string, object> infoParameters = new Dictionary <string, object>();

            infoParameters.Add("cClassifiedId", this.Id);
            infoParameters.Add("cFrom", cFrom);

            try
            {
                oMessagesDB = DBConn.ExecuteCommand("sp_Messages_GetClsFrom", infoParameters).Tables[0];
                if (!oMessagesDB.HasErrors)
                {
                    foreach (DataRow oRow in oMessagesDB.Rows)
                    {
                        oMessage = new ClassifiedMessage();
                        oMessage.MapFromTableRow(oRow);
                        if (oMessage.isValid)
                        {
                            if (oMessage.ReplyTo > 0)
                            {
                                this.oMessages.AddReplyTo(oMessage);
                            }
                            else
                            {
                                this.oMessages.Add(oMessage);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                this.sMsgError.Add("Error getting messages.");
                this.sMsgError.Add(e.Message);
            }
        }
示例#5
0
 public void Add(ClassifiedMessage oMessage)
 {
     this.oMessages.Add(oMessage);
 }
示例#6
0
 public SecureClassifiedMessage(ClassifiedMessage fromMessage)
 {
     this.Id      = fromMessage.Id;
     this.Date    = fromMessage.Date;
     this.Message = fromMessage.Message;
 }
示例#7
0
 public void AddReply(ClassifiedMessage oMessage)
 {
     this.oReply.Add(oMessage);
 }