Initial commit
Initial commit til Git. V2 er deployed
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<Window x:Class="Pos.Setting.Category.AddProductGroupWindow"
|
||||
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.Category"
|
||||
mc:Ignorable="d"
|
||||
Title="Tilføj varegruppe" Height="150" Width="200" Icon="../../Icons/category.png">
|
||||
<StackPanel HorizontalAlignment="Stretch" >
|
||||
<TextBox Name="txtProductGroup" Style="{StaticResource TextBox}"></TextBox>
|
||||
<Button Content="Opret" 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.Category
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AddProductGroupWindow.xaml
|
||||
/// </summary>
|
||||
public partial class AddProductGroupWindow : Window
|
||||
{
|
||||
public AddProductGroupWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ProductGroupRepository categoryRepository = new ProductGroupRepository();
|
||||
categoryRepository.Add(txtProductGroup.Text);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<Window x:Class="Pos.Setting.Category.ArchiveProductGroupWindow"
|
||||
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.Category"
|
||||
mc:Ignorable="d"
|
||||
Title="Arkivere varegruppe" Height="300" Width="300" Icon="../../Icons/category.png">
|
||||
<StackPanel HorizontalAlignment="Stretch" >
|
||||
<TextBlock Text="Ønsker du at arkivere:" Style="{StaticResource TextBox}"/>
|
||||
<TextBlock Name="txtDelProductGroup" 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.Category
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ArchiveProductGroupWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ArchiveProductGroupWindow : Window
|
||||
{
|
||||
private readonly int _id;
|
||||
public ArchiveProductGroupWindow(string name, int id)
|
||||
{
|
||||
InitializeComponent();
|
||||
_id = id;
|
||||
txtDelProductGroup.Text = name;
|
||||
|
||||
}
|
||||
|
||||
private void btnNo_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnYes_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ProductGroupRepository categoryRepository = new ProductGroupRepository();
|
||||
categoryRepository.Archive(_id);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<Window x:Class="Pos.Setting.Category.ChangeProductGroupOrderWindow"
|
||||
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.Category"
|
||||
mc:Ignorable="d"
|
||||
Title="Rækkefølge" Height="450" Width="300" Icon="../../Icons/settings.png">
|
||||
<DockPanel>
|
||||
<ListBox Name="lstCategory" Style="{StaticResource ListBox}" DockPanel.Dock="Top" >
|
||||
</ListBox>
|
||||
<Button Style="{StaticResource Buttons}" Name="btnSave" Content="Gem rækkefølge" VerticalAlignment="Bottom" Click="btnSave_Click"></Button>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,96 @@
|
||||
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;
|
||||
using Database.Repository;
|
||||
|
||||
namespace Pos.Setting.Category
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ChangeProductGroupOrderWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ChangeProductGroupOrderWindow : Window
|
||||
{
|
||||
ObservableCollection<Database.Models.ProductGroupEntity> _prodGroupList = new ObservableCollection<Database.Models.ProductGroupEntity>();
|
||||
public ChangeProductGroupOrderWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
ProductGroupRepository categoryRepository = new ProductGroupRepository();
|
||||
List<Database.Models.ProductGroupEntity> categories = categoryRepository.GetAll();
|
||||
foreach (Database.Models.ProductGroupEntity category in categories)
|
||||
{
|
||||
_prodGroupList.Add(category);
|
||||
}
|
||||
lstCategory.Items.Clear();
|
||||
lstCategory.DisplayMemberPath = "Name";
|
||||
lstCategory.ItemsSource = _prodGroupList;
|
||||
|
||||
Style itemContainerStyle = new Style(typeof(ListBoxItem));
|
||||
itemContainerStyle.Setters.Add(new Setter(ListBoxItem.AllowDropProperty, true));
|
||||
itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(s_PreviewMouseLeftButtonDown)));
|
||||
itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.DropEvent, new DragEventHandler(lstCategory_Drop)));
|
||||
lstCategory.ItemContainerStyle = itemContainerStyle;
|
||||
}
|
||||
|
||||
void s_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
if (sender is ListBoxItem)
|
||||
{
|
||||
ListBoxItem draggedItem = sender as ListBoxItem;
|
||||
DragDrop.DoDragDrop(draggedItem, draggedItem.DataContext, DragDropEffects.Move);
|
||||
draggedItem.IsSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
void lstCategory_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
Database.Models.ProductGroupEntity droppedData = e.Data.GetData(typeof(Database.Models.ProductGroupEntity)) as Database.Models.ProductGroupEntity;
|
||||
Database.Models.ProductGroupEntity target = ((ListBoxItem)(sender)).DataContext as Database.Models.ProductGroupEntity;
|
||||
|
||||
int removedIdx = lstCategory.Items.IndexOf(droppedData);
|
||||
int targetIdx = lstCategory.Items.IndexOf(target);
|
||||
|
||||
if (removedIdx < targetIdx)
|
||||
{
|
||||
_prodGroupList.Insert(targetIdx + 1, droppedData);
|
||||
_prodGroupList.RemoveAt(removedIdx);
|
||||
}
|
||||
else
|
||||
{
|
||||
int remIdx = removedIdx + 1;
|
||||
if (_prodGroupList.Count + 1 > remIdx)
|
||||
{
|
||||
_prodGroupList.Insert(targetIdx, droppedData);
|
||||
_prodGroupList.RemoveAt(remIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSave_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ProductGroupRepository categoryRepository = new ProductGroupRepository();
|
||||
for (int i = 0; i < _prodGroupList.Count; i++)
|
||||
{
|
||||
Database.Models.ProductGroupEntity productGroup = _prodGroupList[i];
|
||||
categoryRepository.SetIndex(productGroup.Id,i);
|
||||
}
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<Window x:Class="Pos.Setting.Category.EditProductGroupWindow"
|
||||
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.Category"
|
||||
mc:Ignorable="d"
|
||||
Title="Ret varegruppe" Height="150" Width="200" Icon="../../Icons/category.png">
|
||||
<StackPanel HorizontalAlignment="Stretch" >
|
||||
<TextBox Name="txtProductGroup" 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.Category
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for EditProductGroupWindow.xaml
|
||||
/// </summary>
|
||||
public partial class EditProductGroupWindow : Window
|
||||
{
|
||||
private readonly int _id;
|
||||
|
||||
public EditProductGroupWindow(string name, int id)
|
||||
{
|
||||
InitializeComponent();
|
||||
_id = id;
|
||||
txtProductGroup.Text = name;
|
||||
}
|
||||
|
||||
private void btnEdit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ProductGroupRepository categoryRepository = new ProductGroupRepository();
|
||||
categoryRepository.Edit(txtProductGroup.Text,_id);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<Window x:Class="Pos.Category.ProductGroupWindow"
|
||||
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.Category"
|
||||
mc:Ignorable="d"
|
||||
Title="Varegrupper" Height="400" Width="450" Icon="../../Icons/category.png">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Name="LstCategory" 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"/>
|
||||
<Button Content="Rækkefølge" Style="{StaticResource Buttons}" Name="btnOrder" Click="btnOrder_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,92 @@
|
||||
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;
|
||||
using Pos.Setting.Category;
|
||||
|
||||
namespace Pos.Category
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ProductGroupWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ProductGroupWindow : Window
|
||||
{
|
||||
private int _id = -1;
|
||||
private string _name = string.Empty;
|
||||
|
||||
public ProductGroupWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void btnCreate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AddProductGroupWindow addProductGroupWindow = new AddProductGroupWindow();
|
||||
addProductGroupWindow.Closed += WindowClosed;
|
||||
addProductGroupWindow.Show();
|
||||
}
|
||||
|
||||
private void WindowClosed(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ItemOnSelected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ListBoxItem item = (ListBoxItem)sender;
|
||||
_id = Convert.ToInt32(item.Tag);
|
||||
_name = item.Content.ToString();
|
||||
btnDelete.IsEnabled = true;
|
||||
btnEdit.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
ProductGroupRepository categoryRepository = new ProductGroupRepository();
|
||||
List<Database.Models.ProductGroupEntity> categories = categoryRepository.GetAll();
|
||||
LstCategory.Items.Clear();
|
||||
foreach (Database.Models.ProductGroupEntity category in categories)
|
||||
{
|
||||
ListBoxItem item = new ListBoxItem();
|
||||
item.Tag = category.Id;
|
||||
item.Content = category.Name;
|
||||
item.Selected += ItemOnSelected;
|
||||
LstCategory.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnEdit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
EditProductGroupWindow editProductGroupWindow = new EditProductGroupWindow(_name,_id);
|
||||
editProductGroupWindow.Closed += WindowClosed;
|
||||
editProductGroupWindow.Show();
|
||||
}
|
||||
|
||||
private void btnDelete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ArchiveProductGroupWindow archiveProductGroupWindow = new ArchiveProductGroupWindow(_name, _id);
|
||||
archiveProductGroupWindow.Closed += WindowClosed;
|
||||
archiveProductGroupWindow.Show();
|
||||
}
|
||||
|
||||
|
||||
private void btnOrder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ChangeProductGroupOrderWindow changeProductGroupOrderWindow = new ChangeProductGroupOrderWindow();
|
||||
changeProductGroupOrderWindow.Closed += WindowClosed;
|
||||
changeProductGroupOrderWindow.Show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user