Beispiel #1
0
        /// <summary>
        /// Сообщения из ChatHelpDesc
        /// </summary>
        /// <param name="dialog">id диалога</param>
        /// <param name="type">тип сообщения</param>
        /// <param name="readState">прочитанные/непрочитанные сообщения</param>
        /// <returns></returns>
        List <Msg> GetChat2DescMessages(string dialog, string type, bool?readState)
        {
            bool             setRead        = Configer.IsSetRead();
            int              limit          = Configer.MessagesLimit();
            MessagesResponse messagesInCh2D = Messages.GetMessages(type, readState, limit, setRead, dialog);
            List <Msg>       messages       = new List <Msg>();

            foreach (var msg in messagesInCh2D.messages)
            {
                Client client = new Clients().GetClient(Int32.Parse(msg.clientID));
                //var transport = ChatHelpdescAgent.Messages.GetMessage(msg.ID).transport;
                Msg message = new Msg()
                {
                    ID            = msg.ID,
                    Name          = client.name,
                    Post          = client.extra_comment_2,
                    Company       = client.extra_comment_1,
                    text          = msg.text,
                    Transport     = msg.transport,
                    Phone         = client.phone,
                    dialog        = msg.dialog_id,
                    Date          = msg.created,
                    type          = msg.type,
                    assigned_name = client.assigned_name
                };
                messages.Add(message);
            }
            return(messages);
        }