Print problemer
Har muligvis rettet den print fejl der er - men mangler at få det testet. Der er slettet en masse projekter som ikke bliver brugt mere. Og flyttet rundt på de få projekter som er tilbage. Dette er V2 og i sit eget repo, så dette er initial commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<Window x:Class="Pos.Setting.AddEmployeeWindow"
|
||||
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:Pos.Setting"
|
||||
mc:Ignorable="d"
|
||||
Title="Tilføj medarbejder" Height="150" Width="200" Icon="../../Icons/employees.png">
|
||||
<StackPanel HorizontalAlignment="Stretch" >
|
||||
<TextBox Name="txtStaff" Style="{StaticResource TextBox}"></TextBox>
|
||||
<Button Content="Ret" Name="btnAdd" Style="{StaticResource Buttons}" Click="btnAdd_Click"></Button>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,35 @@
|
||||
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.Shapes;
|
||||
using Database.Repository;
|
||||
|
||||
namespace Pos.Setting
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AddEmployeeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class AddEmployeeWindow : Window
|
||||
{
|
||||
public AddEmployeeWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
EmployeeRepository employeeRepository = new EmployeeRepository();
|
||||
employeeRepository.Add(txtStaff.Text);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<Window x:Class="Pos.Setting.DeleteEmployeeWindow"
|
||||
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:Pos.Setting"
|
||||
mc:Ignorable="d"
|
||||
Title="Arkivere medarbejder" Height="300" Width="300" Icon="../../Icons/employee.png">
|
||||
<StackPanel HorizontalAlignment="Stretch" >
|
||||
<TextBlock Text="Ønsker du at arkivere:" Style="{StaticResource TextBox}"/>
|
||||
<TextBlock Name="txtDelEmployee" Style="{StaticResource TextBox}" Foreground="Red" FontWeight="ExtraBold" />
|
||||
<Button Content="Ja" Name="btnYes" Style="{StaticResource Buttons}" Margin="10,10,10,30" Click="btnYes_Click"></Button>
|
||||
<Button Content="Nej" Name="btnNo" Style="{StaticResource Buttons}" Click="btnNo_Click"></Button>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,44 @@
|
||||
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.Shapes;
|
||||
using Database.Repository;
|
||||
|
||||
namespace Pos.Setting
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DeleteEmployeeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class DeleteEmployeeWindow : Window
|
||||
{
|
||||
private int _employeeId;
|
||||
|
||||
public DeleteEmployeeWindow(int employeeId, string staffName)
|
||||
{
|
||||
InitializeComponent();
|
||||
_employeeId = employeeId;
|
||||
txtDelEmployee.Text = staffName;
|
||||
}
|
||||
|
||||
private void btnYes_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
EmployeeRepository employeeRepository = new EmployeeRepository();
|
||||
employeeRepository.Delete(_employeeId);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnNo_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<Window x:Class="Pos.Setting.EditEmployeeWindow"
|
||||
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:Pos.Setting"
|
||||
mc:Ignorable="d"
|
||||
Title="Ret medarbejder" Height="150" Width="200" Icon="../../Icons/employee.png">
|
||||
<StackPanel HorizontalAlignment="Stretch" >
|
||||
<TextBox Name="txtEmployee" Style="{StaticResource TextBox}"></TextBox>
|
||||
<Button Content="Ret" Name="btnEdit" Style="{StaticResource Buttons}" Click="btnEdit_Click"></Button>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,39 @@
|
||||
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.Shapes;
|
||||
using Database.Repository;
|
||||
|
||||
namespace Pos.Setting
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for EditEmployeeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class EditEmployeeWindow : Window
|
||||
{
|
||||
private int _employeeId;
|
||||
|
||||
public EditEmployeeWindow(int employeeId, string staffName)
|
||||
{
|
||||
_employeeId = employeeId;
|
||||
InitializeComponent();
|
||||
txtEmployee.Text = staffName;
|
||||
}
|
||||
|
||||
private void btnEdit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
EmployeeRepository employeeRepository = new EmployeeRepository();
|
||||
employeeRepository.Edit(_employeeId,txtEmployee.Text);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
PointOfSale/Pos.Ui/Pos/Setting/Employee/EmployeeWindow.xaml
Normal file
22
PointOfSale/Pos.Ui/Pos/Setting/Employee/EmployeeWindow.xaml
Normal file
@@ -0,0 +1,22 @@
|
||||
<Window x:Class="Pos.Setting.EmployeeWindow"
|
||||
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:Pos.Setting"
|
||||
mc:Ignorable="d"
|
||||
Title="Medarbejder" Height="400" Width="450" Icon="../../Icons/employees.png">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Name="LstStaff" Grid.Row="0" Grid.Column="0" Style="{StaticResource ListBox}">
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1">
|
||||
<Button Content="Opret" Style="{StaticResource Buttons}" Name="btnCreate" Click="btnCreate_Click" />
|
||||
<Button Content="Redigere" Style="{StaticResource Buttons}" Name="btnEdit" IsEnabled="False" Click="btnEdit_Click" />
|
||||
<Button Content="Arkivere" Style="{StaticResource Buttons}" Name="btnDelete" IsEnabled="False" Click="btnDelete_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
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;
|
||||
using Database.Models;
|
||||
using Database.Repository;
|
||||
|
||||
namespace Pos.Setting
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for EmployeeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class EmployeeWindow : Window
|
||||
{
|
||||
private int _selectedEmployee = -1;
|
||||
private string _employeeName = string.Empty;
|
||||
public EmployeeWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
|
||||
private void Item_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ListBoxItem item = (ListBoxItem)sender;
|
||||
_selectedEmployee = Convert.ToInt32(item.Tag);
|
||||
_employeeName = item.Content.ToString();
|
||||
btnDelete.IsEnabled = true;
|
||||
btnEdit.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void btnEdit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
EditEmployeeWindow editEmployeeWindow = new EditEmployeeWindow(_selectedEmployee, _employeeName);
|
||||
editEmployeeWindow.Closed += WindowClosed;
|
||||
editEmployeeWindow.Show();
|
||||
}
|
||||
|
||||
private void btnCreate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AddEmployeeWindow addEmployeeWindow = new AddEmployeeWindow();
|
||||
addEmployeeWindow.Closed += WindowClosed;
|
||||
addEmployeeWindow.Show();
|
||||
}
|
||||
|
||||
|
||||
private void btnDelete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DeleteEmployeeWindow deleteEmployeeWindow = new DeleteEmployeeWindow(_selectedEmployee,_employeeName);
|
||||
deleteEmployeeWindow.Closed += WindowClosed;
|
||||
deleteEmployeeWindow.Show();
|
||||
}
|
||||
|
||||
private void WindowClosed(object? sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
using EmployeeRepository employeeRepository = new EmployeeRepository();
|
||||
List<EmployeeEntity> allStaff = employeeRepository.GetAll();
|
||||
LstStaff.Items.Clear();
|
||||
foreach (EmployeeEntity staff in allStaff)
|
||||
{
|
||||
ListBoxItem item = new ListBoxItem();
|
||||
item.Content = staff.Name;
|
||||
item.Tag = staff.Id;
|
||||
item.Selected += Item_Selected;
|
||||
LstStaff.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user