|
@@ -42,6 +42,9 @@ namespace Acosta.ViewModels
|
|
VisitsViewModel visitsVM = new VisitsViewModel(myConnection4);
|
|
VisitsViewModel visitsVM = new VisitsViewModel(myConnection4);
|
|
public VisitsViewModel VisitsVM { get => visitsVM; set => visitsVM = value; }
|
|
public VisitsViewModel VisitsVM { get => visitsVM; set => visitsVM = value; }
|
|
|
|
|
|
|
|
+ UserViewModel userVM = new UserViewModel(myConnection);
|
|
|
|
+ public UserViewModel UserVM { get => userVM; set => userVM = value; }
|
|
|
|
+
|
|
public void SaveNetwork()
|
|
public void SaveNetwork()
|
|
{
|
|
{
|
|
myConnection2.SaveChanges();
|
|
myConnection2.SaveChanges();
|
|
@@ -66,14 +69,16 @@ namespace Acosta.ViewModels
|
|
UC = new VisitsView();
|
|
UC = new VisitsView();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
public UserControl UC { get => uc; set => this.RaiseAndSetIfChanged(ref uc, value); }
|
|
public UserControl UC { get => uc; set => this.RaiseAndSetIfChanged(ref uc, value); }
|
|
private UserControl uc = new AuthorizationView();
|
|
private UserControl uc = new AuthorizationView();
|
|
public int curUsId;
|
|
public int curUsId;
|
|
-
|
|
|
|
|
|
+ Employee? currentUser;
|
|
public void LoadPersonalAccount()
|
|
public void LoadPersonalAccount()
|
|
{
|
|
{
|
|
-
|
|
|
|
- Employee? currentUser = myConnection.Employees.FirstOrDefault(x => x.Email == AuthorizationVM.Login && x.Password == AuthorizationVM.Password);
|
|
|
|
|
|
+
|
|
|
|
+ currentUser = myConnection.Employees.FirstOrDefault(x => x.Email == AuthorizationVM.Login && x.Password == AuthorizationVM.Password);
|
|
if (currentUser == null)
|
|
if (currentUser == null)
|
|
{
|
|
{
|
|
AuthorizationVM.Message = "Пользователя с такими данными не существует.";
|
|
AuthorizationVM.Message = "Пользователя с такими данными не существует.";
|
|
@@ -88,25 +93,39 @@ namespace Acosta.ViewModels
|
|
curUsId = currentUser.Employeesid;
|
|
curUsId = currentUser.Employeesid;
|
|
PersonalAccountVM = new PersonalAccountViewModel(myConnection, curUsId);
|
|
PersonalAccountVM = new PersonalAccountViewModel(myConnection, curUsId);
|
|
UC = new PersonalAccountView();
|
|
UC = new PersonalAccountView();
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void SavePassword()
|
|
|
|
+ {
|
|
|
|
+ ChangePasswordView changePasswordView = new ChangePasswordView();
|
|
|
|
+ currentUser = myConnection.Employees.FirstOrDefault(x => x.Email == AuthorizationVM.Login && x.Password == AuthorizationVM.Password);
|
|
|
|
+ changePasswordView.cp(currentUser);
|
|
|
|
+ myConnection.SaveChanges();
|
|
|
|
+ UC = new PersonalAccountView();
|
|
|
|
+ }
|
|
|
|
+
|
|
public List<Project> ListProjects => myConnection.Projects.ToList();
|
|
public List<Project> ListProjects => myConnection.Projects.ToList();
|
|
public List<TradeNetwork> ListTrades => myConnection.TradeNetworks.ToList();
|
|
public List<TradeNetwork> ListTrades => myConnection.TradeNetworks.ToList();
|
|
public List<Employee> ListEmployees => myConnection.Employees.ToList().Where(x => x.Employeesid != curUsId).ToList();
|
|
public List<Employee> ListEmployees => myConnection.Employees.ToList().Where(x => x.Employeesid != curUsId).ToList();
|
|
public List<Outlet> ListOutlets => myConnection.Outlets.ToList();
|
|
public List<Outlet> ListOutlets => myConnection.Outlets.ToList();
|
|
public List<Visit> ListVisits => myConnection.Visits.ToList();
|
|
public List<Visit> ListVisits => myConnection.Visits.ToList();
|
|
|
|
+ public List<Acceptance> ListAcceptance => myConnection.Acceptances.ToList();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
//List<a> newList = new List<a>(new a((from p in myConnection.Outlets.ToList() select p.Outletid).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.Outlets.ToList() select p.Address).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.Outlets.ToList() select p.Location).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.TradeNetworks.ToList() select p.Title).ToImmutableList().ToList().FirstOrDefault()));
|
|
//List<a> newList = new List<a>(new a((from p in myConnection.Outlets.ToList() select p.Outletid).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.Outlets.ToList() select p.Address).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.Outlets.ToList() select p.Location).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.TradeNetworks.ToList() select p.Title).ToImmutableList().ToList().FirstOrDefault()));
|
|
//public List<string> fkTrade => myConnection.TradeNetworks.ToList().Select(x => x.Title).Where()
|
|
//public List<string> fkTrade => myConnection.TradeNetworks.ToList().Select(x => x.Title).Where()
|
|
//List<a> newList = new List<a>(new a((from p in myConnection.Outlets.ToList() select p.Outletid).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.Outlets.ToList() select p.Address).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.Outlets.ToList() select p.Location).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.TradeNetworks.ToList() select p.Title).ToImmutableList().ToList().FirstOrDefault()));
|
|
//List<a> newList = new List<a>(new a((from p in myConnection.Outlets.ToList() select p.Outletid).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.Outlets.ToList() select p.Address).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.Outlets.ToList() select p.Location).ToImmutableList().ToList().FirstOrDefault(), (from p in myConnection.TradeNetworks.ToList() select p.Title).ToImmutableList().ToList().FirstOrDefault()));
|
|
-
|
|
|
|
|
|
+
|
|
//public struct a
|
|
//public struct a
|
|
//{
|
|
//{
|
|
// int Outlerid;
|
|
// int Outlerid;
|
|
// string Address;
|
|
// string Address;
|
|
// string Location;
|
|
// string Location;
|
|
// string TradeNetworks;
|
|
// string TradeNetworks;
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
// public a(int oid, string ad, string loc, string tn)
|
|
// public a(int oid, string ad, string loc, string tn)
|
|
// {
|
|
// {
|
|
@@ -138,9 +157,9 @@ namespace Acosta.ViewModels
|
|
// Visits = outlet.Visits
|
|
// Visits = outlet.Visits
|
|
// })
|
|
// })
|
|
//.ToList();
|
|
//.ToList();
|
|
-
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -159,7 +178,7 @@ namespace Acosta.ViewModels
|
|
{
|
|
{
|
|
UC = new VisitsView();
|
|
UC = new VisitsView();
|
|
}
|
|
}
|
|
- public void EditVisitView()
|
|
|
|
|
|
+ public void EditVisitView(int userID)
|
|
{
|
|
{
|
|
UC = new EditVisitView();
|
|
UC = new EditVisitView();
|
|
}
|
|
}
|
|
@@ -173,7 +192,7 @@ namespace Acosta.ViewModels
|
|
{
|
|
{
|
|
UC = new ProjectsView();
|
|
UC = new ProjectsView();
|
|
}
|
|
}
|
|
- public void EditProjectsView()
|
|
|
|
|
|
+ public void EditProjectsView(int userID)
|
|
{
|
|
{
|
|
UC = new EditProjectsView();
|
|
UC = new EditProjectsView();
|
|
}
|
|
}
|