|
@@ -20,12 +20,13 @@ namespace WpfApp1.Windows
|
|
public partial class EditEmploeeWindow : Window
|
|
public partial class EditEmploeeWindow : Window
|
|
{
|
|
{
|
|
private int id;
|
|
private int id;
|
|
|
|
+ private Emploee emploee;
|
|
public EditEmploeeWindow(int id)
|
|
public EditEmploeeWindow(int id)
|
|
|
|
|
|
{
|
|
{
|
|
InitializeComponent();
|
|
InitializeComponent();
|
|
this.id = id;
|
|
this.id = id;
|
|
- var emploee = Helper.GetContext().Emploee.Where(x => x.ID == id).FirstOrDefault();
|
|
|
|
|
|
+ emploee = Helper.GetContext().Emploee.Where(x => x.ID == id).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
EmploeeTb.Text = $"{emploee.Surname} {emploee.Name[0]}.{emploee.Middlename[0]}.";
|
|
EmploeeTb.Text = $"{emploee.Surname} {emploee.Name[0]}.{emploee.Middlename[0]}.";
|
|
@@ -36,7 +37,12 @@ namespace WpfApp1.Windows
|
|
|
|
|
|
private void ConfirmBtn_Click(object sender, RoutedEventArgs e)
|
|
private void ConfirmBtn_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ if(StatusCb.SelectedItem != null && StatusCb.SelectedItem != emploee.WorkStatus)
|
|
|
|
+ {
|
|
|
|
+ emploee.StatusID = (StatusCb.SelectedItem as WorkStatus).ID;
|
|
|
|
+ Helper.GetContext().SaveChanges();
|
|
|
|
+ Close();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|