diff --git a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Repositories/Implementations/ConnectionString.cs b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Repositories/Implementations/ConnectionString.cs new file mode 100644 index 0000000..27da614 --- /dev/null +++ b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Repositories/Implementations/ConnectionString.cs @@ -0,0 +1,6 @@ +namespace ProjectConfectionaryFactory.Repositories.Implementations; + +internal class ConnectionString : IConnectionString +{ + string IConnectionString.ConnectionString => "Host=localhost;Username=postgres;Password=postgres;Database=confectioneryfactoryotp;"; +} \ No newline at end of file diff --git a/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Entities/Client.cs b/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Entities/Client.cs index c9c7d15..fbbb8e8 100644 --- a/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Entities/Client.cs +++ b/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Entities/Client.cs @@ -5,10 +5,10 @@ public class Client public int Id { get; private set; } public string Name { get; private set; } = string.Empty; public string Surname { get; private set; } = string.Empty; - public double Phone { get; private set; } + public string Phone { get; private set; } public string Address { get; private set; } = string.Empty; - public static Client CreateEntity(int id, string name, string surname, double phone, string address) + public static Client CreateEntity(int id, string name, string surname, string phone, string address) { return new Client { diff --git a/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Entities/Supplier.cs b/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Entities/Supplier.cs index f2d2b1d..134fb04 100644 --- a/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Entities/Supplier.cs +++ b/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Entities/Supplier.cs @@ -4,10 +4,10 @@ public class Supplier { public int Id { get; private set; } public string Name { get; private set; } = string.Empty; - public double Phone { get; private set; } + public string Phone { get; private set; } public string Address { get; private set; } = string.Empty; - public static Supplier CreateEntity(int id, string name, double phone, string address) + public static Supplier CreateEntity(int id, string name, string phone, string address) { return new Supplier { diff --git a/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Forms/FormClient.cs b/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Forms/FormClient.cs index af390ac..685a38f 100644 --- a/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Forms/FormClient.cs +++ b/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Forms/FormClient.cs @@ -1,5 +1,6 @@ using ProjectConfectioneryFactory.Entities; using ProjectConfectioneryFactory.Repositories; +using System.Text.RegularExpressions; namespace ProjectConfectioneryFactory.Forms { @@ -40,7 +41,7 @@ namespace ProjectConfectioneryFactory.Forms { try { - if (string.IsNullOrWhiteSpace(textBoxClientName.Text) || string.IsNullOrWhiteSpace(textBoxClientSurname.Text) || string.IsNullOrWhiteSpace(maskedTextBoxPhone.Text) || string.IsNullOrWhiteSpace(textBoxAddress.Text)) + if (string.IsNullOrWhiteSpace(textBoxClientName.Text) || string.IsNullOrWhiteSpace(textBoxClientSurname.Text) || !maskedTextBoxPhone.MaskCompleted || string.IsNullOrWhiteSpace(textBoxAddress.Text)) { throw new Exception("Имеются незаполненные поля"); } @@ -66,7 +67,7 @@ namespace ProjectConfectioneryFactory.Forms id, textBoxClientName.Text, textBoxClientSurname.Text, - Double.Parse(maskedTextBoxPhone.Text), + maskedTextBoxPhone.Text, textBoxAddress.Text); } } diff --git a/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Forms/FormClient.resx b/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Forms/FormClient.resx index 8b2ff64..af32865 100644 --- a/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Forms/FormClient.resx +++ b/ProjectConfectioneryFactory/ProjectConfectioneryFactory/Forms/FormClient.resx @@ -1,7 +1,7 @@