update
This commit is contained in:
37
OfficeFlow/Models/Utils/User.cs
Normal file
37
OfficeFlow/Models/Utils/User.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OfficeFlow.Models
|
||||
{
|
||||
public partial class User
|
||||
{
|
||||
public Role Role {
|
||||
|
||||
get
|
||||
{
|
||||
return this.User_Role.FirstOrDefault()?.Role;
|
||||
}
|
||||
set
|
||||
{
|
||||
var userRole = this.User_Role.FirstOrDefault();
|
||||
if (userRole == null)
|
||||
{
|
||||
userRole = new User_Role {
|
||||
|
||||
User = this,
|
||||
|
||||
|
||||
};
|
||||
|
||||
App.Entities.User_Role.Add(userRole);
|
||||
}
|
||||
userRole.Role = value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,13 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Models\Utils\User.cs" />
|
||||
<Compile Include="Pages\EmployeePages\EmployeesPage.xaml.cs">
|
||||
<DependentUpon>EmployeesPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\EmployeePages\EmployeesPositionsPage.xaml.cs">
|
||||
<DependentUpon>EmployeesPositionsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\EmployeePages\NewEmployeePage.xaml.cs">
|
||||
<DependentUpon>NewEmployeePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -89,6 +96,14 @@
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Pages\EmployeePages\EmployeesPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\EmployeePages\EmployeesPositionsPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\EmployeePages\NewEmployeePage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
14
OfficeFlow/Pages/EmployeePages/EmployeesPage.xaml
Normal file
14
OfficeFlow/Pages/EmployeePages/EmployeesPage.xaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<Page x:Class="OfficeFlow.Pages.EmployeePages.EmployeesPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:OfficeFlow.Pages.EmployeePages"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Title="EmployeesPage">
|
||||
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
28
OfficeFlow/Pages/EmployeePages/EmployeesPage.xaml.cs
Normal file
28
OfficeFlow/Pages/EmployeePages/EmployeesPage.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OfficeFlow.Pages.EmployeePages
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for EmployeesPage.xaml
|
||||
/// </summary>
|
||||
public partial class EmployeesPage : Page
|
||||
{
|
||||
public EmployeesPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
OfficeFlow/Pages/EmployeePages/EmployeesPositionsPage.xaml
Normal file
14
OfficeFlow/Pages/EmployeePages/EmployeesPositionsPage.xaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<Page x:Class="OfficeFlow.Pages.EmployeePages.EmployeesPositionsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:OfficeFlow.Pages.EmployeePages"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Title="EmployeesPositionsPage">
|
||||
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OfficeFlow.Pages.EmployeePages
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for EmployeesPositionsPage.xaml
|
||||
/// </summary>
|
||||
public partial class EmployeesPositionsPage : Page
|
||||
{
|
||||
public EmployeesPositionsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,16 @@ namespace OfficeFlow.Pages
|
||||
|
||||
private void LoginButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Session.Authenticate(App.Entities.Users.FirstOrDefault());
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
NavigationService.Navigate(new MainPage());
|
||||
}
|
||||
|
||||
string login = LoginTextBox.Text.Trim();
|
||||
string password = PasswordBox.Password;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using OfficeFlow.Utils;
|
||||
using OfficeFlow.Pages.EmployeePages;
|
||||
using OfficeFlow.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -31,6 +32,95 @@ namespace OfficeFlow.Pages
|
||||
public void ReloadMenu()
|
||||
{
|
||||
MainMenu.Items.Clear();
|
||||
|
||||
string roleName = Session.CurrentUser.Role.RoleName;
|
||||
|
||||
if (roleName == "Администратор")
|
||||
{
|
||||
|
||||
MainMenu.Items.Add(CreateAdminMenu());
|
||||
}
|
||||
|
||||
|
||||
var aboutMenuItem = new MenuItem
|
||||
{
|
||||
Header = "Справка",
|
||||
|
||||
};
|
||||
|
||||
aboutMenuItem.Click += MenuItemAbout_Click;
|
||||
|
||||
MainMenu.Items.Add(
|
||||
|
||||
aboutMenuItem
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private MenuItem CreateAdminMenu()
|
||||
{
|
||||
MenuItem adminMenuItem = new MenuItem
|
||||
{
|
||||
Name = "MenuItemAdmin",
|
||||
Header = "Администрирование"
|
||||
|
||||
};
|
||||
|
||||
var empl = new MenuItem
|
||||
{
|
||||
Header = "Сотрудники",
|
||||
|
||||
};
|
||||
empl.Click += (object sender, RoutedEventArgs e) => NavigationService.Navigate(new EmployeesPage());
|
||||
adminMenuItem.Items.Add(empl);
|
||||
|
||||
var emplPositions = new MenuItem
|
||||
{
|
||||
Header = "Должности",
|
||||
|
||||
};
|
||||
emplPositions.Click += (object sender, RoutedEventArgs e) => NavigationService.Navigate(new EmployeesPositionsPage());
|
||||
adminMenuItem.Items.Add(emplPositions);
|
||||
|
||||
var users = new MenuItem
|
||||
{
|
||||
Header = "Учётные записи",
|
||||
|
||||
};
|
||||
users.Click += (object sender, RoutedEventArgs e) => throw new NotImplementedException();
|
||||
adminMenuItem.Items.Add(users);
|
||||
var tmp = new MenuItem
|
||||
{
|
||||
Header = "Кабинеты",
|
||||
|
||||
};
|
||||
tmp.Click += (object sender, RoutedEventArgs e) => throw new NotImplementedException();
|
||||
adminMenuItem.Items.Add(tmp);
|
||||
tmp = new MenuItem
|
||||
{
|
||||
Header = "Услуги",
|
||||
|
||||
};
|
||||
tmp.Click += (object sender, RoutedEventArgs e) => throw new NotImplementedException();
|
||||
adminMenuItem.Items.Add(tmp);
|
||||
tmp = new MenuItem
|
||||
{
|
||||
Header = "Виды условий оплат",
|
||||
|
||||
};
|
||||
tmp.Click += (object sender, RoutedEventArgs e) => throw new NotImplementedException();
|
||||
adminMenuItem.Items.Add(tmp);
|
||||
tmp = new MenuItem
|
||||
{
|
||||
Header = "Единицы измерений для услуг",
|
||||
|
||||
};
|
||||
tmp.Click += (object sender, RoutedEventArgs e) => throw new NotImplementedException();
|
||||
adminMenuItem.Items.Add(tmp);
|
||||
|
||||
|
||||
return adminMenuItem;
|
||||
}
|
||||
|
||||
public void ClearHistory()
|
||||
|
||||
@@ -32,6 +32,12 @@ namespace OfficeFlow.Pages.StartupPages
|
||||
var needAccountStatuses = App.Entities.AccountStatuses.Count() == 0;
|
||||
var needEmployeeStatuses = App.Entities.EmployeeStatuses.Count() == 0;
|
||||
|
||||
var needPaymentTerms = App.Entities.PaymentTerms.Count() == 0;
|
||||
var needPaymentStatuses = App.Entities.PaymentStatuses.Count() == 0;
|
||||
var needTenantStatuses = App.Entities.TenantStatuses.Count() == 0;
|
||||
var needRentalStatuses = App.Entities.RentalStatuses.Count() == 0;
|
||||
var needRoomStatuses = App.Entities.RoomStatuses.Count() == 0;
|
||||
|
||||
|
||||
using (var transaction = App.Entities.Database.BeginTransaction())
|
||||
{
|
||||
@@ -131,6 +137,133 @@ namespace OfficeFlow.Pages.StartupPages
|
||||
});
|
||||
}
|
||||
|
||||
// Заполнение условий оплаты
|
||||
if (needPaymentTerms)
|
||||
{
|
||||
App.Entities.PaymentTerms.Add(new PaymentTerm()
|
||||
{
|
||||
TermName = "Ежемесячно",
|
||||
TermDescription = "Оплата производится один раз в месяц."
|
||||
});
|
||||
App.Entities.PaymentTerms.Add(new PaymentTerm()
|
||||
{
|
||||
TermName = "Ежеквартально",
|
||||
TermDescription = "Оплата производится один раз в квартал (3 месяца)."
|
||||
});
|
||||
App.Entities.PaymentTerms.Add(new PaymentTerm()
|
||||
{
|
||||
TermName = "Ежегодно",
|
||||
TermDescription = "Оплата производится один раз в год."
|
||||
});
|
||||
App.Entities.PaymentTerms.Add(new PaymentTerm()
|
||||
{
|
||||
TermName = "По факту",
|
||||
TermDescription = "Оплата производится после предоставления услуги."
|
||||
});
|
||||
}
|
||||
|
||||
// Заполнение статусов платежей
|
||||
if (needPaymentStatuses)
|
||||
{
|
||||
App.Entities.PaymentStatuses.Add(new PaymentStatus()
|
||||
{
|
||||
StatusName = "Оплачен",
|
||||
StatusDescription = "Платеж успешно проведен."
|
||||
});
|
||||
App.Entities.PaymentStatuses.Add(new PaymentStatus()
|
||||
{
|
||||
StatusName = "Не оплачен",
|
||||
StatusDescription = "Платеж ожидает оплаты."
|
||||
});
|
||||
App.Entities.PaymentStatuses.Add(new PaymentStatus()
|
||||
{
|
||||
StatusName = "Частично оплачен",
|
||||
StatusDescription = "Платеж частично покрыт."
|
||||
});
|
||||
App.Entities.PaymentStatuses.Add(new PaymentStatus()
|
||||
{
|
||||
StatusName = "Отменен",
|
||||
StatusDescription = "Платеж отменен."
|
||||
});
|
||||
}
|
||||
|
||||
// Заполнение статусов арендаторов
|
||||
if (needTenantStatuses)
|
||||
{
|
||||
App.Entities.TenantStatuses.Add(new TenantStatus()
|
||||
{
|
||||
StatusName = "Активен",
|
||||
StatusDescription = "Арендатор активно пользуется услугами."
|
||||
});
|
||||
App.Entities.TenantStatuses.Add(new TenantStatus()
|
||||
{
|
||||
StatusName = "Неактивен",
|
||||
StatusDescription = "Арендатор временно не использует услуги."
|
||||
});
|
||||
App.Entities.TenantStatuses.Add(new TenantStatus()
|
||||
{
|
||||
StatusName = "Заблокирован",
|
||||
StatusDescription = "Арендатор заблокирован из-за нарушений."
|
||||
});
|
||||
App.Entities.TenantStatuses.Add(new TenantStatus()
|
||||
{
|
||||
StatusName = "Ожидает подтверждения",
|
||||
StatusDescription = "Арендатор зарегистрирован, но его статус ожидает подтверждения."
|
||||
});
|
||||
}
|
||||
|
||||
// Заполнение статусов аренды
|
||||
if (needRentalStatuses)
|
||||
{
|
||||
App.Entities.RentalStatuses.Add(new RentalStatus()
|
||||
{
|
||||
StatusName = "Активна",
|
||||
StatusDescription = "Аренда действует и оплачивается."
|
||||
});
|
||||
App.Entities.RentalStatuses.Add(new RentalStatus()
|
||||
{
|
||||
StatusName = "Завершена",
|
||||
StatusDescription = "Аренда завершена и больше не действует."
|
||||
});
|
||||
App.Entities.RentalStatuses.Add(new RentalStatus()
|
||||
{
|
||||
StatusName = "Просрочена",
|
||||
StatusDescription = "Аренда просрочена и требует оплаты."
|
||||
});
|
||||
App.Entities.RentalStatuses.Add(new RentalStatus()
|
||||
{
|
||||
StatusName = "Резерв",
|
||||
StatusDescription = "Помещение зарезервировано, но аренда еще не началась."
|
||||
});
|
||||
}
|
||||
|
||||
// Заполнение статусов помещений
|
||||
if (needRoomStatuses)
|
||||
{
|
||||
App.Entities.RoomStatuses.Add(new RoomStatus()
|
||||
{
|
||||
StatusName = "Свободно",
|
||||
StatusDescription = "Помещение свободно для аренды."
|
||||
});
|
||||
App.Entities.RoomStatuses.Add(new RoomStatus()
|
||||
{
|
||||
StatusName = "Занято",
|
||||
StatusDescription = "Помещение занято арендатором."
|
||||
});
|
||||
App.Entities.RoomStatuses.Add(new RoomStatus()
|
||||
{
|
||||
StatusName = "В ремонте",
|
||||
StatusDescription = "Помещение находится в ремонте и недоступно для аренды."
|
||||
});
|
||||
App.Entities.RoomStatuses.Add(new RoomStatus()
|
||||
{
|
||||
StatusName = "Резерв",
|
||||
StatusDescription = "Помещение зарезервировано, но аренда еще не началась."
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
App.Entities.SaveChanges();
|
||||
transaction.Commit();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user