diff --git a/CarRepairShop/CarRepairShop/App.config b/CarRepairShop/CarRepairShop/App.config index 5822f97..83fb561 100644 --- a/CarRepairShop/CarRepairShop/App.config +++ b/CarRepairShop/CarRepairShop/App.config @@ -5,7 +5,7 @@ - - + + \ No newline at end of file diff --git a/CarRepairShop/CarRepairShop/FormMails.Designer.cs b/CarRepairShop/CarRepairShop/FormMails.Designer.cs index 68bf727..fefc6c5 100644 --- a/CarRepairShop/CarRepairShop/FormMails.Designer.cs +++ b/CarRepairShop/CarRepairShop/FormMails.Designer.cs @@ -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); diff --git a/CarRepairShop/CarRepairShop/FormMails.resx b/CarRepairShop/CarRepairShop/FormMails.resx index 1af7de1..af32865 100644 --- a/CarRepairShop/CarRepairShop/FormMails.resx +++ b/CarRepairShop/CarRepairShop/FormMails.resx @@ -1,17 +1,17 @@  - diff --git a/CarRepairShop/CarRepairShop/Program.cs b/CarRepairShop/CarRepairShop/Program.cs index a75e455..b8c1735 100644 --- a/CarRepairShop/CarRepairShop/Program.cs +++ b/CarRepairShop/CarRepairShop/Program.cs @@ -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); diff --git a/CarRepairShop/CarRepairShopBusinessLogic/BusinessLogics/ClientLogic.cs b/CarRepairShop/CarRepairShopBusinessLogic/BusinessLogics/ClientLogic.cs index 94d2ce7..a8d8c55 100644 --- a/CarRepairShop/CarRepairShopBusinessLogic/BusinessLogics/ClientLogic.cs +++ b/CarRepairShop/CarRepairShopBusinessLogic/BusinessLogics/ClientLogic.cs @@ -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)); } diff --git a/CarRepairShop/CarRepairShopDatabaseImplement/Implements/MessageInfoStorage.cs b/CarRepairShop/CarRepairShopDatabaseImplement/Implements/MessageInfoStorage.cs index f703bc7..02a15fc 100644 --- a/CarRepairShop/CarRepairShopDatabaseImplement/Implements/MessageInfoStorage.cs +++ b/CarRepairShop/CarRepairShopDatabaseImplement/Implements/MessageInfoStorage.cs @@ -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; diff --git a/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240506164851_InitialCreate.Designer.cs b/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240507162722_InitialCreate.Designer.cs similarity index 99% rename from CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240506164851_InitialCreate.Designer.cs rename to CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240507162722_InitialCreate.Designer.cs index cff264f..ae625c6 100644 --- a/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240506164851_InitialCreate.Designer.cs +++ b/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240507162722_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace CarRepairShopDatabaseImplement.Migrations { [DbContext(typeof(RepairsShopDatabase))] - [Migration("20240506164851_InitialCreate")] + [Migration("20240507162722_InitialCreate")] partial class InitialCreate { /// diff --git a/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240506164851_InitialCreate.cs b/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240507162722_InitialCreate.cs similarity index 100% rename from CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240506164851_InitialCreate.cs rename to CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240507162722_InitialCreate.cs diff --git a/CarRepairShop/CarRepairShopDatabaseImplement/Models/MessageInfo.cs b/CarRepairShop/CarRepairShopDatabaseImplement/Models/MessageInfo.cs index 34b687b..7b6c807 100644 --- a/CarRepairShop/CarRepairShopDatabaseImplement/Models/MessageInfo.cs +++ b/CarRepairShop/CarRepairShopDatabaseImplement/Models/MessageInfo.cs @@ -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, diff --git a/CarRepairShop/CarRepairShopDatabaseImplement/RepairsShopDatabase.cs b/CarRepairShop/CarRepairShopDatabaseImplement/RepairsShopDatabase.cs index 3d411a8..6c5607c 100644 --- a/CarRepairShop/CarRepairShopDatabaseImplement/RepairsShopDatabase.cs +++ b/CarRepairShop/CarRepairShopDatabaseImplement/RepairsShopDatabase.cs @@ -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); diff --git a/CarRepairShop/CarRepairShopRestApi/Program.cs b/CarRepairShop/CarRepairShopRestApi/Program.cs index 8b168f9..7096b07 100644 --- a/CarRepairShop/CarRepairShopRestApi/Program.cs +++ b/CarRepairShop/CarRepairShopRestApi/Program.cs @@ -20,7 +20,7 @@ builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); -builder.Services.AddTransient(); +builder.Services.AddSingleton(); builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle diff --git a/CarRepairShop/CarRepairShopRestApi/appsettings.json b/CarRepairShop/CarRepairShopRestApi/appsettings.json index 9a8b5f2..33005ae 100644 --- a/CarRepairShop/CarRepairShopRestApi/appsettings.json +++ b/CarRepairShop/CarRepairShopRestApi/appsettings.json @@ -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" } diff --git a/CarRepairShop/CarRepairShowClientApp/CarRepairShowClientApp.csproj b/CarRepairShop/CarRepairShowClientApp/CarRepairShowClientApp.csproj index 52393c8..d1795b9 100644 --- a/CarRepairShop/CarRepairShowClientApp/CarRepairShowClientApp.csproj +++ b/CarRepairShop/CarRepairShowClientApp/CarRepairShowClientApp.csproj @@ -6,10 +6,6 @@ enable - - - - @@ -19,16 +15,4 @@ - - - - - - <_ContentIncludedByDefault Remove="Views\Home\Mails.cshtml" /> - - - - - -