Beispiel #1
0
        public string SendMultiMessage(string messageTxt, string friendList)
        {
            Member member = new Member();
            Member friend = new Member();
            bool   isSent;

            string[] temp = friendList.Split(',');
            member.MemberId = Context.Session["memberID"].ToString();
            for (int i = 0; i < temp.Length; ++i)
            {
                if (temp[i] != "")
                {
                    friend.MemberId = temp[i];
                    Messages message = new Messages(messageTxt);



                    isSent = test.AddMessage(message, member, friend);
                }
            }

            //  System.Threading.Thread.Sleep(500);


            //Chech if message is really sent
            isSent = true;


            if (isSent == true)
            {
                return("<div class='msgeSentNotification blueFontTextColor BorberRad3'>Your Message(s) was sent successfully.</div>");
            }
            else
            {
                return("<div class='errorNotification BorberRad3'>Error. Your message was not sent.</div>");
            }
        }
Beispiel #2
0
        public static int AddMessage(Message message)
        {
            #region Проверка заполненности обязательных полей
            if (message.SenderId == 0)
            {
                throw new Exception("Не заполнено необходимое поле SenderId");
            }

            if (message.RecipientId == 0)
            {
                throw new Exception("Не заполнено необходимое поле RecipientId");
            }
            #endregion

            if (message.Date == DateTime.MinValue)
            {
                message.Date = DateTime.Now.ToUniversalTime();
            }

            return(MessagesDAL.AddMessage(message));
        }