151 lines
4.9 KiB
C#
151 lines
4.9 KiB
C#
using DatenDB;
|
|
using Deckungsbeitrag.AA_Klassen;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Drawing.Printing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using VirtualKeyboard;
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
|
|
namespace Deckungsbeitrag.AA_Forms
|
|
{
|
|
public partial class FormAuftragAuswahl : Form
|
|
{
|
|
private ArtikelKategorie Abteilung;
|
|
private List<View_Auftrag_Expedit> Auftragliste;
|
|
private QwertzKeyboard keyboard;
|
|
public Kunde kunde;
|
|
public Auftrag auftrag;
|
|
private Screen screen = Screen.PrimaryScreen;
|
|
|
|
public FormAuftragAuswahl()
|
|
{
|
|
InitializeComponent();
|
|
|
|
switch (ConfigurationManager.AppSettings["ConnectionString"].Split(';')[0].Split('=')[1])
|
|
{
|
|
case var t when t.Contains("frottee"): Abteilung = ArtikelKategorie.Frottee; break;
|
|
case var t when t.Contains("kleinteile"): Abteilung = ArtikelKategorie.Kleinteile; break;
|
|
case var t when t.Contains("grossteile"): Abteilung = ArtikelKategorie.Grossteile; break;
|
|
case var t when t.Contains("spannleintuch"): Abteilung = ArtikelKategorie.Spannleintuch; break;
|
|
default: break; //TODO: Default Zuweisung löschen bevor in Echtbetrieb.
|
|
}
|
|
}
|
|
|
|
private async void FormAuftragAuswahl_Load(object sender, EventArgs e)
|
|
{
|
|
new TouchScroll(panelAuswahl);
|
|
await GetAuftragliste();
|
|
Load_PanelAuswahl(this.Auftragliste);
|
|
}
|
|
private async Task GetAuftragliste()
|
|
{
|
|
this.Auftragliste = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Gewaschen, kategorie: Abteilung);
|
|
}
|
|
|
|
private async void Load_PanelAuswahl(List<View_Auftrag_Expedit> _liste)
|
|
{
|
|
this.panelAuswahl.Controls.Clear();
|
|
_liste = _liste.OrderBy(x => x.KundeName).ToList();
|
|
|
|
foreach (View_Auftrag_Expedit item in _liste)
|
|
{
|
|
string name = string.Empty;
|
|
if (item.KundeName.Length > 15) name = item.KundeName.Substring(0, 15) + "...";
|
|
else name = item.KundeName;
|
|
Label lbl = new Label()
|
|
{
|
|
Text = name,
|
|
BackColor = Color.Silver,
|
|
BorderStyle = BorderStyle.FixedSingle,
|
|
Font = new Font("Microsoft Sans Serif", 20, FontStyle.Bold),
|
|
Size = new Size(400, 70),
|
|
TextAlign = ContentAlignment.MiddleCenter,
|
|
Margin = new Padding(5, 5, 5, 5),
|
|
Padding = new Padding(15, 15, 15, 15),
|
|
Tag = item
|
|
};
|
|
lbl.Click += LabelAuftrag_Click;
|
|
lbl.MouseEnter += LabelAuftrag_MouseEnter;
|
|
lbl.MouseLeave += LabelAuftrag_MouseLeave;
|
|
panelAuswahl.Controls.Add(lbl);
|
|
}
|
|
|
|
}
|
|
|
|
private void LabelAuftrag_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
Label lbl = sender as Label;
|
|
lbl.BackColor = Color.Silver;
|
|
}
|
|
|
|
private void LabelAuftrag_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
Label lbl = sender as Label;
|
|
lbl.BackColor = Color.YellowGreen;
|
|
}
|
|
|
|
private void LabelAuftrag_Click(object sender, EventArgs e)
|
|
{
|
|
Label lbl = sender as Label;
|
|
View_Auftrag_Expedit exAuftrag = (View_Auftrag_Expedit)lbl.Tag;
|
|
this.kunde = Kunde.GetKunde(null, exAuftrag.KundeID, null);
|
|
this.auftrag = Auftrag.GetAuftrag(exAuftrag.AuftragID);
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
private void TextBoxKunde_TextChanged(object sender, EventArgs e)
|
|
{
|
|
TextBox textbox = sender as TextBox;
|
|
string text = textbox.Text.Trim().ToLower();
|
|
if (!string.IsNullOrWhiteSpace(text))
|
|
{
|
|
var filtered = string.IsNullOrWhiteSpace(text) ? this.Auftragliste : this.Auftragliste.Where(x => x.KundeName != null && x.KundeName.ToLower().Contains(text)).ToList();
|
|
Load_PanelAuswahl(filtered);
|
|
}
|
|
else Load_PanelAuswahl(this.Auftragliste);
|
|
|
|
}
|
|
|
|
private void TextBoxKunde_Click(object sender, EventArgs e)
|
|
{
|
|
TextBox textbox = sender as TextBox;
|
|
textbox.Clear();
|
|
|
|
if (Program.istTouch & Screen.PrimaryScreen.WorkingArea.Width > 0 & Screen.PrimaryScreen.WorkingArea.Width < 2000)
|
|
{
|
|
if (keyboard == null || keyboard.IsDisposed)
|
|
{
|
|
keyboard = new QwertzKeyboard(textBoxKunde, "isAlpha");
|
|
keyboard.Show();
|
|
}
|
|
else
|
|
{
|
|
keyboard.Close();
|
|
keyboard = new QwertzKeyboard(textBoxKunde, "isAlpha");
|
|
if (keyboard.ShowDialog() == DialogResult.OK) this.ActiveControl.Focus();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void FormAuftragAuswahl_Shown(object sender, EventArgs e)
|
|
{
|
|
this.Width = screen.WorkingArea.Width;
|
|
this.Height = (int)(screen.WorkingArea.Height * 0.70);
|
|
this.Location = new Point(0, 0);
|
|
|
|
this.panelAuswahl.Height = this.Bottom - this.panelSuchen.Bottom - 20;
|
|
}
|
|
|
|
}
|
|
}
|