diff --git a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Client.cs b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Client.cs index ef74cdb..c09364b 100644 --- a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Client.cs +++ b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/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/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Supplier.cs b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Supplier.cs index f75f4fe..180a0b1 100644 --- a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Supplier.cs +++ b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/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/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Forms/FormClient.cs b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Forms/FormClient.cs index 76bbdf9..c4cc262 100644 --- a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Forms/FormClient.cs +++ b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Forms/FormClient.cs @@ -1,5 +1,6 @@ using ProjectConfectionaryFactory.Entities; using ProjectConfectionaryFactory.Repositories; +using System.Text.RegularExpressions; namespace ProjectConfectionaryFactory.Forms { @@ -40,7 +41,7 @@ namespace ProjectConfectionaryFactory.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 ProjectConfectionaryFactory.Forms id, textBoxClientName.Text, textBoxClientSurname.Text, - Double.Parse(maskedTextBoxPhone.Text), + maskedTextBoxPhone.Text, textBoxAddress.Text); } } diff --git a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Forms/FormClient.resx b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Forms/FormClient.resx index 8b2ff64..af32865 100644 --- a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Forms/FormClient.resx +++ b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Forms/FormClient.resx @@ -1,7 +1,7 @@