示例#1
0
        private void UpdateContactAdminPanel() //Обновление данных в админ панели
        {
            AdminMessages.Rows.Clear();
            List <int> ListId = ContactController.GetAllIdPushed();

            if (ListId == null)
            {
                return;
            }
            foreach (var IdMessage in ListId)
            {
                var IdUser  = ContactController.GetIdUserFromIdMessage(IdMessage);
                var user    = UserController.GetUser(IdUser);
                var Topic   = ContactController.GetTopicFromId(IdMessage);
                var Message = ContactController.GetMessageFromId(IdMessage);
                if (user == null)
                {
                    continue;
                }
                tb_Ct_Name.Text          = $"{user.first_name} {user.last_name}";
                tb_Ct_iduser.Text        = user.ID.ToString();
                tb_email_admin.Text      = user.email;
                topic_admin_contact.Text = Topic;
                tb_msg_admin.Text        = Message;
                var index = AdminMessages.Rows.Add();
                AdminMessages.Rows[index].Cells["idMsg"].Value    = IdMessage;
                AdminMessages.Rows[index].Cells["UserName"].Value = user.first_name + " " + user.last_name;
                AdminMessages.Rows[index].Cells["Topic"].Value    = Topic;
                AdminMessages.Rows[index].Cells["Message"].Value  = Message;
            }
        }
示例#2
0
        private void AdminMessages_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            int    IdMessage = Int32.Parse(AdminMessages.Rows[AdminMessages.CurrentRow.Index].Cells["idMsg"].Value.ToString());
            int    IdUser    = ContactController.GetIdUserFromIdMessage(IdMessage);
            User   user      = UserController.GetUser(IdUser);
            string Topic     = ContactController.GetTopicFromId(IdMessage);
            string Message   = ContactController.GetMessageFromId(IdMessage);

            if (user == null)
            {
                return;
            }
            tb_Ct_Name.Text          = $"{user.first_name} {user.last_name}";
            tb_Ct_iduser.Text        = user.ID.ToString();
            tb_email_admin.Text      = user.email;
            topic_admin_contact.Text = Topic;
            tb_msg_admin.Text        = Message;
        }