Никита
6 years ago
9 changed files with 138 additions and 28 deletions
@ -0,0 +1,29 @@ |
|||
<Window x:Class="eCompanies.UsersWindow" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:eCompanies" |
|||
mc:Ignorable="d" |
|||
Title="UsersWindow" Height="450" Width="800" Closing="Window_Closing"> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="0*"/> |
|||
</Grid.ColumnDefinitions> |
|||
<DataGrid x:Name="usersGrid" HorizontalAlignment="Left" Height="354" Margin="10,55,0,0" VerticalAlignment="Top" Width="772" ItemsSource="{Binding}" AutoGenerateColumns="False" MouseDoubleClick="usersGrid_MouseDoubleClick"> |
|||
<DataGrid.Columns> |
|||
<DataGridTextColumn Header="ID" Binding="{Binding UsersId}"/> |
|||
<DataGridTextColumn Header="Имя пользователя" Binding="{Binding Name}" /> |
|||
<DataGridTextColumn Header="Логин" Binding="{Binding Login}" /> |
|||
<DataGridTextColumn Header="Пароль" Binding="{Binding Password}" /> |
|||
</DataGrid.Columns> |
|||
</DataGrid> |
|||
<TextBox x:Name="companyNameBox" HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="none" VerticalAlignment="Top" Width="470" FontSize="22"/> |
|||
<ComboBox x:Name="contractStatusComboBox" HorizontalAlignment="Left" Height="40" Margin="490,10,0,0" VerticalAlignment="Top" Width="292" FontSize="22"> |
|||
<ComboBoxItem>Еще не заключен</ComboBoxItem> |
|||
<ComboBoxItem>Заключен</ComboBoxItem> |
|||
<ComboBoxItem>Расторгнут</ComboBoxItem> |
|||
</ComboBox> |
|||
</Grid> |
|||
</Window> |
@ -0,0 +1,44 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
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.Shapes; |
|||
|
|||
namespace eCompanies |
|||
{ |
|||
/// <summary>
|
|||
/// Логика взаимодействия для UsersWindow.xaml
|
|||
/// </summary>
|
|||
public partial class UsersWindow : Window |
|||
{ |
|||
Companies currentCompany; |
|||
public UsersWindow(Companies c) |
|||
{ |
|||
InitializeComponent(); |
|||
currentCompany = c; |
|||
companyNameBox.Text = c.Name; |
|||
contractStatusComboBox.SelectedIndex = c.ContractStatus; |
|||
usersGrid.DataContext = new ObservableCollection<Users>(c.Users.AsEnumerable<Users>()); |
|||
} |
|||
|
|||
private void usersGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
|||
{ |
|||
} |
|||
|
|||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) |
|||
{ |
|||
MessageBoxResult mbr = MessageBox.Show("Вы закрываете окно с компанией. Хотите сохранить результаты?", "Сохранение изменений", MessageBoxButton.YesNo); |
|||
if (mbr == MessageBoxResult.Yes) |
|||
App.updateCompany(currentCompany); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue