Наконец-то
This commit is contained in:
parent
d3fe1a06c8
commit
37f88a13f0
@ -5,7 +5,7 @@
|
|||||||
<add key="SmtpClientPort" value="587" />
|
<add key="SmtpClientPort" value="587" />
|
||||||
<add key="PopHost" value="pop.gmail.com" />
|
<add key="PopHost" value="pop.gmail.com" />
|
||||||
<add key="PopPort" value="995" />
|
<add key="PopPort" value="995" />
|
||||||
<add key="MailLogin" value="labwork73@gmail.com" />
|
<add key="MailLogin" value="niiiyaziiik@gmail.com" />
|
||||||
<add key="MailPassword" value="laba73" />
|
<add key="MailPassword" value="fbuz lxpx sirr rzbp" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
@ -48,8 +48,8 @@
|
|||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(800, 450);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "Почта";
|
Name = "FormMails";
|
||||||
Text = "FormMails";
|
Text = "Почты";
|
||||||
Load += ViewMailForm_Load;
|
Load += ViewMailForm_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
@ -40,10 +40,9 @@ namespace CarRepairShop
|
|||||||
string.Empty,
|
string.Empty,
|
||||||
SmtpClientHost = System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ??
|
SmtpClientHost = System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ??
|
||||||
string.Empty,
|
string.Empty,
|
||||||
SmtpClientPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClient Port"]),
|
SmtpClientPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClientPort"]),
|
||||||
PopHost = System.Configuration.ConfigurationManager.AppSettings["PopHost"] ?? string.Empty,
|
PopHost = System.Configuration.ConfigurationManager.AppSettings["PopHost"] ?? string.Empty,
|
||||||
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])
|
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])});
|
||||||
});
|
|
||||||
// ñîçäàåì òàéìåð
|
// ñîçäàåì òàéìåð
|
||||||
var timer = new System.Threading.Timer(new
|
var timer = new System.Threading.Timer(new
|
||||||
TimerCallback(MailCheck!), null, 0, 100000);
|
TimerCallback(MailCheck!), null, 0, 100000);
|
||||||
|
@ -108,7 +108,7 @@ namespace CarRepairShopBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
throw new ArgumentException("Некорретно введен email клиента", nameof(model.Email));
|
throw new ArgumentException("Некорретно введен email клиента", nameof(model.Email));
|
||||||
}
|
}
|
||||||
if (!Regex.IsMatch(model.Password, @"^(?=.*\d)(?=.*\W)(?=.*[^\d\s]).+$"))
|
if (!Regex.IsMatch(model.Password, @"^(?=.*\d)(?=.*\w)(?=.*[^\d\s]).+$"))
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Некорректно введен пароль клиента", nameof(model.Password));
|
throw new ArgumentException("Некорректно введен пароль клиента", nameof(model.Password));
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ namespace CarRepairShopDatabaseImplement.Implements
|
|||||||
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
|
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new RepairsShopDatabase();
|
using var context = new RepairsShopDatabase();
|
||||||
var newMessage = MessageInfo.Create(model);
|
var newMessage = MessageInfo.Create(context, model);
|
||||||
if (newMessage == null || context.Messages.Any(x => x.MessageId.Equals(model.MessageId)))
|
if (newMessage == null || context.Messages.Any(x => x.MessageId.Equals(model.MessageId)))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace CarRepairShopDatabaseImplement.Migrations
|
namespace CarRepairShopDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(RepairsShopDatabase))]
|
[DbContext(typeof(RepairsShopDatabase))]
|
||||||
[Migration("20240506164851_InitialCreate")]
|
[Migration("20240507162722_InitialCreate")]
|
||||||
partial class InitialCreate
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
@ -15,7 +15,7 @@ namespace CarRepairShopDatabaseImplement.Models
|
|||||||
public string Subject { get; private set; } = string.Empty;
|
public string Subject { get; private set; } = string.Empty;
|
||||||
public string Body { get; private set; } = string.Empty;
|
public string Body { get; private set; } = string.Empty;
|
||||||
public Client? Client { get; private set; }
|
public Client? Client { get; private set; }
|
||||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
public static MessageInfo? Create(RepairsShopDatabase context, MessageInfoBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -25,7 +25,8 @@ namespace CarRepairShopDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
Body = model.Body,
|
Body = model.Body,
|
||||||
Subject = model.Subject,
|
Subject = model.Subject,
|
||||||
ClientId = model.ClientId,
|
ClientId = context.Clients.FirstOrDefault(x => x.Email == model.SenderName).Id,
|
||||||
|
Client = context.Clients.FirstOrDefault(x => x.Email == model.SenderName),
|
||||||
MessageId = model.MessageId,
|
MessageId = model.MessageId,
|
||||||
SenderName = model.SenderName,
|
SenderName = model.SenderName,
|
||||||
DateDelivery = model.DateDelivery,
|
DateDelivery = model.DateDelivery,
|
||||||
|
@ -9,7 +9,7 @@ namespace CarRepairShopDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=RepairsShopDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"
|
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=CarRepairsShopDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
|
@ -20,7 +20,7 @@ builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
|||||||
builder.Services.AddTransient<IRepairLogic, RepairLogic>();
|
builder.Services.AddTransient<IRepairLogic, RepairLogic>();
|
||||||
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||||
builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at
|
// Learn more about configuring Swagger/OpenAPI at
|
||||||
https://aka.ms/aspnetcore/swashbuckle
|
https://aka.ms/aspnetcore/swashbuckle
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
"SmtpClientPort": "587",
|
"SmtpClientPort": "587",
|
||||||
"PopHost": "pop.gmail.com",
|
"PopHost": "pop.gmail.com",
|
||||||
"PopPort": "995",
|
"PopPort": "995",
|
||||||
"MailLogin": "labwork73@gmail.com",
|
"MailLogin": "niiiyaziiik@gmail.com",
|
||||||
"MailPassword": "laba73"
|
"MailPassword": "fbuz lxpx sirr rzbp"
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,6 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Remove="Views\Home\Mails.cshtml" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -19,16 +15,4 @@
|
|||||||
<ProjectReference Include="..\CarRepairShopRestApi\CarRepairShopRestApi.csproj" />
|
<ProjectReference Include="..\CarRepairShopRestApi\CarRepairShopRestApi.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<UpToDateCheckInput Remove="Views\Home\Mails.cshtml" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<_ContentIncludedByDefault Remove="Views\Home\Mails.cshtml" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Views\Home\Mails.cshtml" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user