|
@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls;
|
|
|
|
+using static System.Net.Mime.MediaTypeNames;
|
|
|
|
|
|
namespace PP_Ven_MosS.Pages
|
|
namespace PP_Ven_MosS.Pages
|
|
{
|
|
{
|
|
@@ -50,6 +51,7 @@ namespace PP_Ven_MosS.Pages
|
|
EmployeeID.employeeid = Convert.ToInt32(cb.SelectedValue);
|
|
EmployeeID.employeeid = Convert.ToInt32(cb.SelectedValue);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
private void Report_Click(object sender, RoutedEventArgs e)
|
|
private void Report_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
Button btn = (Button)sender;
|
|
Button btn = (Button)sender;
|
|
@@ -62,8 +64,6 @@ namespace PP_Ven_MosS.Pages
|
|
{
|
|
{
|
|
PP_MininEntities DB = new PP_MininEntities();
|
|
PP_MininEntities DB = new PP_MininEntities();
|
|
ComboBox cb = (ComboBox)sender;
|
|
ComboBox cb = (ComboBox)sender;
|
|
- cb.DisplayMemberPath = "Surname";
|
|
|
|
- cb.SelectedValuePath = "Id_user";
|
|
|
|
if (cb.Uid != null)
|
|
if (cb.Uid != null)
|
|
{
|
|
{
|
|
int appId = int.Parse(cb.Uid);
|
|
int appId = int.Parse(cb.Uid);
|
|
@@ -72,8 +72,21 @@ namespace PP_Ven_MosS.Pages
|
|
{
|
|
{
|
|
if (ap != null)
|
|
if (ap != null)
|
|
{
|
|
{
|
|
- ap.Id_employee = Convert.ToInt32(cb.SelectedValue);
|
|
|
|
- DB.SaveChanges();
|
|
|
|
|
|
+ var apps = DB.Applications.Where(x => x.Date_app == ap.Date_app).ToList();
|
|
|
|
+ var busyEmployees = apps.Where(x => x.Id_application != appId).Select(x => x.Id_employee).ToList();
|
|
|
|
+ if (!busyEmployees.Contains(Convert.ToInt32(cb.SelectedValue)))
|
|
|
|
+ {
|
|
|
|
+ ap.Id_employee = Convert.ToInt32(cb.SelectedValue);
|
|
|
|
+ DB.SaveChanges();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("Сотрудик занят на этот день!");
|
|
|
|
+ cb.SelectedValue = null;
|
|
|
|
+ ap.Id_employee = Convert.ToInt32(cb.SelectedValue);
|
|
|
|
+ DB.SaveChanges();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|