diff --git a/demo_blagodat/.vs/demo_blagodat/FileContentIndex/1ffcf824-4c2c-4b24-959a-d1a5b4020c56.vsidx b/demo_blagodat/.vs/demo_blagodat/FileContentIndex/1ffcf824-4c2c-4b24-959a-d1a5b4020c56.vsidx deleted file mode 100644 index 6ed1052..0000000 Binary files a/demo_blagodat/.vs/demo_blagodat/FileContentIndex/1ffcf824-4c2c-4b24-959a-d1a5b4020c56.vsidx and /dev/null differ diff --git a/demo_blagodat/.vs/demo_blagodat/FileContentIndex/96fad6f4-4c6f-4e89-b8a2-52b563efcabd.vsidx b/demo_blagodat/.vs/demo_blagodat/FileContentIndex/96fad6f4-4c6f-4e89-b8a2-52b563efcabd.vsidx new file mode 100644 index 0000000..39b55e1 Binary files /dev/null and b/demo_blagodat/.vs/demo_blagodat/FileContentIndex/96fad6f4-4c6f-4e89-b8a2-52b563efcabd.vsidx differ diff --git a/demo_blagodat/.vs/demo_blagodat/FileContentIndex/e7b4b9ab-c017-4eb2-8aab-40edbb6449c5.vsidx b/demo_blagodat/.vs/demo_blagodat/FileContentIndex/e7b4b9ab-c017-4eb2-8aab-40edbb6449c5.vsidx new file mode 100644 index 0000000..39f0e2f Binary files /dev/null and b/demo_blagodat/.vs/demo_blagodat/FileContentIndex/e7b4b9ab-c017-4eb2-8aab-40edbb6449c5.vsidx differ diff --git a/demo_blagodat/.vs/demo_blagodat/FileContentIndex/ea856d02-36e7-4a04-9927-3be48debcadd.vsidx b/demo_blagodat/.vs/demo_blagodat/FileContentIndex/ea856d02-36e7-4a04-9927-3be48debcadd.vsidx deleted file mode 100644 index edadb3c..0000000 Binary files a/demo_blagodat/.vs/demo_blagodat/FileContentIndex/ea856d02-36e7-4a04-9927-3be48debcadd.vsidx and /dev/null differ diff --git a/demo_blagodat/.vs/demo_blagodat/v17/.futdcache.v2 b/demo_blagodat/.vs/demo_blagodat/v17/.futdcache.v2 index 3f4141c..919107f 100644 Binary files a/demo_blagodat/.vs/demo_blagodat/v17/.futdcache.v2 and b/demo_blagodat/.vs/demo_blagodat/v17/.futdcache.v2 differ diff --git a/demo_blagodat/.vs/demo_blagodat/v17/.suo b/demo_blagodat/.vs/demo_blagodat/v17/.suo index 6893341..4538637 100644 Binary files a/demo_blagodat/.vs/demo_blagodat/v17/.suo and b/demo_blagodat/.vs/demo_blagodat/v17/.suo differ diff --git a/demo_blagodat/Functions/ChangeServices.axaml b/demo_blagodat/Functions/ChangeServices.axaml index bac0dcb..7d19376 100644 --- a/demo_blagodat/Functions/ChangeServices.axaml +++ b/demo_blagodat/Functions/ChangeServices.axaml @@ -4,11 +4,20 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="demo_blagodat.ChangeServices" + xmlns:vm="using:demo_blagodat.Models" Title="Изменить услугу"> - - + + + + + + + + + + diff --git a/demo_blagodat/Functions/ChangeServices.axaml.cs b/demo_blagodat/Functions/ChangeServices.axaml.cs index 0f8e661..71709fb 100644 --- a/demo_blagodat/Functions/ChangeServices.axaml.cs +++ b/demo_blagodat/Functions/ChangeServices.axaml.cs @@ -5,90 +5,85 @@ using Avalonia.Markup.Xaml; using demo_blagodat.Models; using System.Linq; using System; +using System.Collections.ObjectModel; namespace demo_blagodat; public partial class ChangeServices : Window { public Employee User; + static User11Context db = new User11Context(); + ObservableCollection ServiceitemSource = new ObservableCollection(db.Services); + public ChangeServices(Employee user) { InitializeComponent(); User = user; + ListServices.ItemsSource = ServiceitemSource; } + private void ComboBox_SelectionChanged(object? sender, Avalonia.Controls.SelectionChangedEventArgs e) + { + if (sender != null) { } + } private void changeClient(object sender, RoutedEventArgs e) { try // { - // - string? name = Name.Text; - // string? newname = TextNewName.Text; string? newcode = TextNewCode.Text; decimal? newprice = Math.Round(decimal.TryParse(TextNewPrice.Text.Replace(".", ","), out decimal resalt) ? resalt : -1 , 2); - if (name != "") + if (ListServices.SelectedItem != null) { - using (User11Context db = new User11Context()) // + Service service = db.Services.Where(it => it == ListServices.SelectedItem).FirstOrDefault(); + if (TextNewName.Text != "") { - Service? service = db.Services.Where(it => it.ServiceName == name).FirstOrDefault(); - if (service != null) - { - if (TextNewName.Text != "") - { - service.ServiceName = newname; // "" + service.ServiceName = newname; // "" - db.SaveChanges(); // + db.SaveChanges(); // - // - MesAdd.Text = " "; - MesAddError.Text = ""; - } - if (TextNewCode.Text != "") - { - service.ServiceCode = newcode; // "" - - db.SaveChanges(); // - - // - MesAdd.Text = " "; - MesAddError.Text = ""; - } - - if (newprice == -1) - { - // - MesAdd.Text = ""; - MesAddError.Text = " "; - } - else if (TextNewPrice.Text != "") - { - service.ServiceCostPerHour = (decimal) newprice;// " " - - db.SaveChanges(); // - - // - MesAdd.Text = " "; - MesAddError.Text = ""; - } - - if(TextNewName.Text == "" && TextNewCode.Text == "" && TextNewPrice.Text == "") - { - // - MesAdd.Text = ""; - MesAddError.Text = " "; - } - check(service); - } - else - { - MesAdd.Text = ""; - MesAddError.Text = " "; - } + // + MesAdd.Text = " "; + MesAddError.Text = ""; } + if (TextNewCode.Text != "") + { + service.ServiceCode = newcode; // "" + + db.SaveChanges(); // + + // + MesAdd.Text = " "; + MesAddError.Text = ""; + } + + if (newprice == -1) + { + // + MesAdd.Text = ""; + MesAddError.Text = " "; + } + else if (TextNewPrice.Text != "") + { + service.ServiceCostPerHour = (decimal)newprice;// " " + + db.SaveChanges(); // + + // + MesAdd.Text = " "; + MesAddError.Text = ""; + } + + if (TextNewName.Text == "" && TextNewCode.Text == "" && TextNewPrice.Text == "") + { + // + MesAdd.Text = ""; + MesAddError.Text = " "; + } + check(service); } else { @@ -115,14 +110,11 @@ public partial class ChangeServices : Window private void check(Service service) { - using (User11Context db = new User11Context()) // - { - Service checkService = db.Services.Where(it => it.ServiceName == service.ServiceName).FirstOrDefault(); + Service checkService = db.Services.Where(it => it.ServiceName == service.ServiceName).FirstOrDefault(); - SelectName.Text = checkService.ServiceName; - SelectCode.Text = checkService.ServiceCode; - SelectPrice.Text = checkService.ServiceCostPerHour.ToString(); - } + SelectName.Text = checkService.ServiceName; + SelectCode.Text = checkService.ServiceCode; + SelectPrice.Text = checkService.ServiceCostPerHour.ToString(); } private void ExitClik(object sender, RoutedEventArgs e) diff --git a/demo_blagodat/Functions/DeleteServices.axaml b/demo_blagodat/Functions/DeleteServices.axaml index 1c4a7df..98ded59 100644 --- a/demo_blagodat/Functions/DeleteServices.axaml +++ b/demo_blagodat/Functions/DeleteServices.axaml @@ -4,25 +4,40 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="demo_blagodat.DeleteServices" + xmlns:vm="using:demo_blagodat.Models" Title="Удалить Сервис"> - - - - - - - - - + + + + + + + + + + + + + + + + + -