Наконец-то

This commit is contained in:
Yunusov_Niyaz 2024-05-07 22:38:27 +04:00
parent d3fe1a06c8
commit 37f88a13f0
13 changed files with 41 additions and 57 deletions

View File

@ -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="labwork73@gmail.com" />
<add key="MailPassword" value="laba73" />
<add key="MailLogin" value="niiiyaziiik@gmail.com" />
<add key="MailPassword" value="fbuz lxpx sirr rzbp" />
</appSettings>
</configuration>

View File

@ -48,8 +48,8 @@
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridView);
Name = "Почта";
Text = "FormMails";
Name = "FormMails";
Text = "Почты";
Load += ViewMailForm_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);

View File

@ -1,17 +1,17 @@
<?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
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>
@ -26,36 +26,36 @@
<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
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
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
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
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
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
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
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

View File

@ -40,10 +40,9 @@ namespace CarRepairShop
string.Empty,
SmtpClientHost = System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ??
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,
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])
});
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])});
// ñîçäàåì òàéìåð
var timer = new System.Threading.Timer(new
TimerCallback(MailCheck!), null, 0, 100000);

View File

@ -108,7 +108,7 @@ namespace CarRepairShopBusinessLogic.BusinessLogics
{
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));
}

View File

@ -38,7 +38,7 @@ namespace CarRepairShopDatabaseImplement.Implements
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
{
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)))
{
return null;

View File

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace CarRepairShopDatabaseImplement.Migrations
{
[DbContext(typeof(RepairsShopDatabase))]
[Migration("20240506164851_InitialCreate")]
[Migration("20240507162722_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />

View File

@ -15,7 +15,7 @@ namespace CarRepairShopDatabaseImplement.Models
public string Subject { get; private set; } = string.Empty;
public string Body { get; private set; } = string.Empty;
public Client? Client { get; private set; }
public static MessageInfo? Create(MessageInfoBindingModel model)
public static MessageInfo? Create(RepairsShopDatabase context, MessageInfoBindingModel model)
{
if (model == null)
{
@ -25,7 +25,8 @@ namespace CarRepairShopDatabaseImplement.Models
{
Body = model.Body,
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,
SenderName = model.SenderName,
DateDelivery = model.DateDelivery,

View File

@ -9,7 +9,7 @@ namespace CarRepairShopDatabaseImplement
{
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);

View File

@ -20,7 +20,7 @@ builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IRepairLogic, RepairLogic>();
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at
https://aka.ms/aspnetcore/swashbuckle

View File

@ -10,6 +10,6 @@
"SmtpClientPort": "587",
"PopHost": "pop.gmail.com",
"PopPort": "995",
"MailLogin": "labwork73@gmail.com",
"MailPassword": "laba73"
"MailLogin": "niiiyaziiik@gmail.com",
"MailPassword": "fbuz lxpx sirr rzbp"
}

View File

@ -6,10 +6,6 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Content Remove="Views\Home\Mails.cshtml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
@ -19,16 +15,4 @@
<ProjectReference Include="..\CarRepairShopRestApi\CarRepairShopRestApi.csproj" />
</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>