7 лаба готова
This commit is contained in:
parent
1f141851ea
commit
2f4ce9525a
@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RenovationWorkBusinessLogic.BusinessLogic;
|
||||
using RenovationWorkContracts.BindingModels;
|
||||
using RenovationWorkContracts.BusinessLogicsContracts;
|
||||
using System;
|
||||
@ -12,27 +13,20 @@ namespace RenovationWorkBusinessLogic.MailWorker
|
||||
public abstract class AbstractMailWorker
|
||||
{
|
||||
protected string _mailLogin = string.Empty;
|
||||
|
||||
protected string _mailPassword = string.Empty;
|
||||
|
||||
protected string _smtpClientHost = string.Empty;
|
||||
|
||||
protected int _smtpClientPort;
|
||||
|
||||
protected string _popHost = string.Empty;
|
||||
|
||||
protected int _popPort;
|
||||
|
||||
private readonly IMessageInfoLogic _messageInfoLogic;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger, IMessageInfoLogic messageInfoLogic)
|
||||
private readonly IClientLogic _clientLogic;
|
||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger, IMessageInfoLogic messageInfoLogic, IClientLogic client)
|
||||
{
|
||||
_clientLogic = client;
|
||||
_logger = logger;
|
||||
_messageInfoLogic = messageInfoLogic;
|
||||
}
|
||||
|
||||
public void MailConfig(MailConfigBindingModel config)
|
||||
{
|
||||
_mailLogin = config.MailLogin;
|
||||
@ -41,57 +35,48 @@ namespace RenovationWorkBusinessLogic.MailWorker
|
||||
_smtpClientPort = config.SmtpClientPort;
|
||||
_popHost = config.PopHost;
|
||||
_popPort = config.PopPort;
|
||||
_logger.LogDebug("Config: {login}, {password}, {clientHost}, {clientPOrt}, {popHost}, {popPort}", _mailLogin, _mailPassword, _smtpClientHost, _smtpClientPort, _popHost, _popPort);
|
||||
_logger.LogDebug("Config: {login}, {password}, {clientHost}, { clientPOrt}, { popHost}, { popPort}", _mailLogin, _mailPassword, _smtpClientHost, _smtpClientPort, _popHost, _popPort);
|
||||
}
|
||||
|
||||
public async void MailSendAsync(MailSendInfoBindingModel info)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(_smtpClientHost) || _smtpClientPort == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(info.MailAddress) || string.IsNullOrEmpty(info.Subject) || string.IsNullOrEmpty(info.Text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogDebug("Send Mail: {To}, {Subject}", info.MailAddress, info.Subject);
|
||||
await SendMailAsync(info);
|
||||
}
|
||||
|
||||
public async void MailCheck()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(_popHost) || _popPort == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_messageInfoLogic == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var list = await ReceiveMailAsync();
|
||||
_logger.LogDebug("Check Mail: {Count} new mails", list.Count);
|
||||
foreach (var mail in list)
|
||||
{
|
||||
mail.ClientId = _clientLogic.ReadElement(new() { Email = mail.SenderName })?.Id;
|
||||
_messageInfoLogic.Create(mail);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Task SendMailAsync(MailSendInfoBindingModel info);
|
||||
|
||||
protected abstract Task<List<MessageInfoBindingModel>> ReceiveMailAsync();
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,7 @@ namespace RenovationWorkBusinessLogic.MailWorker
|
||||
{
|
||||
public class MailKitWorker : AbstractMailWorker
|
||||
{
|
||||
public MailKitWorker(ILogger<MailKitWorker> logger, IMessageInfoLogic messageInfoLogic) : base(logger, messageInfoLogic) { }
|
||||
|
||||
public MailKitWorker(ILogger<MailKitWorker> logger, IMessageInfoLogic messageInfoLogic, IClientLogic client) : base(logger, messageInfoLogic, client) { }
|
||||
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
|
||||
{
|
||||
using var objMailMessage = new MailMessage();
|
||||
@ -31,12 +30,10 @@ namespace RenovationWorkBusinessLogic.MailWorker
|
||||
objMailMessage.Body = info.Text;
|
||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
||||
|
||||
objSmtpClient.UseDefaultCredentials = false;
|
||||
objSmtpClient.EnableSsl = true;
|
||||
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
||||
objSmtpClient.Credentials = new NetworkCredential(_mailLogin, _mailPassword);
|
||||
|
||||
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
||||
}
|
||||
catch (Exception)
|
||||
@ -44,7 +41,6 @@ namespace RenovationWorkBusinessLogic.MailWorker
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task<List<MessageInfoBindingModel>> ReceiveMailAsync()
|
||||
{
|
||||
var list = new List<MessageInfoBindingModel>();
|
||||
|
@ -11,6 +11,6 @@
|
||||
"SmtpClientPort": "587",
|
||||
"PopHost": "pop.gmail.com",
|
||||
"PopPort": "995",
|
||||
"MailLogin": "roma.ismailov96@gmail.com",
|
||||
"MailPassword": "lopl zigv bpms xvre"
|
||||
"MailLogin": "rpplabs098@gmail.com",
|
||||
"MailPassword": "sxwf ohjr cgba wext"
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<add key="SmtpClientPort" value="587" />
|
||||
<add key="PopHost" value="pop.gmail.com" />
|
||||
<add key="PopPort" value="995" />
|
||||
<add key="MailLogin" value="roma.ismailov96@gmail.com" />
|
||||
<add key="MailPassword" value="lopl zigv bpms xvre" />
|
||||
<add key="MailLogin" value="rpplabs098@gmail.com" />
|
||||
<add key="MailPassword" value="sxwf ohjr cgba wext" />
|
||||
</appSettings>
|
||||
</configuration>
|
62
RenovationWork/RenovationWorkView/FormMail.Designer.cs
generated
Normal file
62
RenovationWork/RenovationWorkView/FormMail.Designer.cs
generated
Normal file
@ -0,0 +1,62 @@
|
||||
namespace RenovationWorkView
|
||||
{
|
||||
partial class FormMail
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dataGridView.Location = new System.Drawing.Point(0, 0);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowTemplate.Height = 25;
|
||||
this.dataGridView.Size = new System.Drawing.Size(800, 450);
|
||||
this.dataGridView.TabIndex = 0;
|
||||
//
|
||||
// FormMail
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Name = "FormMail";
|
||||
this.Text = "Письма";
|
||||
this.Load += new System.EventHandler(this.FormViewMail_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
48
RenovationWork/RenovationWorkView/FormMail.cs
Normal file
48
RenovationWork/RenovationWorkView/FormMail.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RenovationWorkContracts.BusinessLogicsContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RenovationWorkView
|
||||
{
|
||||
public partial class FormMail : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IMessageInfoLogic _logic;
|
||||
|
||||
public FormMail(ILogger<FormMail> logger, IMessageInfoLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormViewMail_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["ClientId"].Visible = false;
|
||||
dataGridView.Columns["MessageId"].Visible = false;
|
||||
dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка списка писем");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки писем");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
RenovationWork/RenovationWorkView/FormMail.resx
Normal file
120
RenovationWork/RenovationWorkView/FormMail.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -39,13 +39,14 @@
|
||||
this.componentProductsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.запускРаботыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.письмаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.письмаToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.CreateOrderButton = new System.Windows.Forms.Button();
|
||||
this.TakeOrderInWorkButton = new System.Windows.Forms.Button();
|
||||
this.OrderReadyButton = new System.Windows.Forms.Button();
|
||||
this.IssuedOrderButton = new System.Windows.Forms.Button();
|
||||
this.UpdateListButton = new System.Windows.Forms.Button();
|
||||
this.письмаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MenuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@ -57,7 +58,8 @@
|
||||
this.СправочникиToolStripMenuItem,
|
||||
this.отчетыToolStripMenuItem,
|
||||
this.запускРаботыToolStripMenuItem,
|
||||
this.письмаToolStripMenuItem});
|
||||
this.письмаToolStripMenuItem,
|
||||
this.письмаToolStripMenuItem1});
|
||||
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.MenuStrip.Name = "MenuStrip";
|
||||
this.MenuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3);
|
||||
@ -142,6 +144,18 @@
|
||||
this.запускРаботыToolStripMenuItem.Text = "Запуск работы";
|
||||
this.запускРаботыToolStripMenuItem.Click += new System.EventHandler(this.запускРаботыToolStripMenuItem_Click);
|
||||
//
|
||||
// письмаToolStripMenuItem
|
||||
//
|
||||
this.письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
|
||||
this.письмаToolStripMenuItem.Size = new System.Drawing.Size(14, 24);
|
||||
//
|
||||
// письмаToolStripMenuItem1
|
||||
//
|
||||
this.письмаToolStripMenuItem1.Name = "письмаToolStripMenuItem1";
|
||||
this.письмаToolStripMenuItem1.Size = new System.Drawing.Size(77, 24);
|
||||
this.письмаToolStripMenuItem1.Text = "Письма";
|
||||
this.письмаToolStripMenuItem1.Click += new System.EventHandler(this.письмаToolStripMenuItem_Click);
|
||||
//
|
||||
// DataGridView
|
||||
//
|
||||
this.DataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
@ -219,11 +233,6 @@
|
||||
this.UpdateListButton.UseVisualStyleBackColor = true;
|
||||
this.UpdateListButton.Click += new System.EventHandler(this.UpdateListButton_Click);
|
||||
//
|
||||
// письмаToolStripMenuItem
|
||||
//
|
||||
this.письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
|
||||
this.письмаToolStripMenuItem.Size = new System.Drawing.Size(77, 24);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
@ -269,5 +278,6 @@
|
||||
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
||||
private ToolStripMenuItem запускРаботыToolStripMenuItem;
|
||||
private ToolStripMenuItem письмаToolStripMenuItem;
|
||||
private ToolStripMenuItem письмаToolStripMenuItem1;
|
||||
}
|
||||
}
|
@ -257,5 +257,13 @@ namespace PrecastConcretePlantView
|
||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void письмаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormMail));
|
||||
if (service is FormMail form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace RenovationWorkView
|
||||
});
|
||||
|
||||
// ñîçäàåì òàéìåð
|
||||
var timer = new System.Threading.Timer(new TimerCallback(MailCheck!), null, 0, 100000);
|
||||
var timer = new System.Threading.Timer(new TimerCallback(MailCheck!), null, 0, 1000);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -97,6 +97,7 @@ namespace RenovationWorkView
|
||||
services.AddTransient<FormReportOrders>();
|
||||
services.AddTransient<FormImplementer>();
|
||||
services.AddTransient<FormImplementers>();
|
||||
services.AddTransient<FormMail>();
|
||||
}
|
||||
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user