From 4ed376f28a83d27427cb095ed6063f4970d72add Mon Sep 17 00:00:00 2001
From: Tim Schneider <43130816+DerStimmler@users.noreply.github.com>
Date: Thu, 20 Feb 2025 15:51:02 +0100
Subject: [PATCH] feat: add copy button for generated positions
---
...iceRechnungspositionsGenerator.Designer.cs | 340 +++++++++---------
.../LexofficeRechnungspositionsGenerator.cs | 15 +-
.../LexofficeRechnungspositionsGenerator.resx | 37 +-
3 files changed, 206 insertions(+), 186 deletions(-)
diff --git a/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.Designer.cs b/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.Designer.cs
index 3fba9cf..22cc240 100644
--- a/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.Designer.cs
+++ b/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.Designer.cs
@@ -21,171 +21,184 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
- #region Component Designer generated code
+ #region Component Designer generated code
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- groupBox1 = new GroupBox();
- lbxKunde = new ListBox();
- groupBox2 = new GroupBox();
- lbxLeistung = new ListBox();
- groupBox3 = new GroupBox();
- lbxMitarbeiter = new ListBox();
- tbxTitelDerPosition = new TextBox();
- label1 = new Label();
- btnPositionErstellen = new Button();
- tbxErstelltePosition = new TextBox();
- label2 = new Label();
- groupBox1.SuspendLayout();
- groupBox2.SuspendLayout();
- groupBox3.SuspendLayout();
- SuspendLayout();
- //
- // groupBox1
- //
- groupBox1.Controls.Add(lbxKunde);
- groupBox1.Location = new Point(27, 34);
- groupBox1.Margin = new Padding(4, 5, 4, 5);
- groupBox1.Name = "groupBox1";
- groupBox1.Padding = new Padding(4, 5, 4, 5);
- groupBox1.Size = new Size(355, 354);
- groupBox1.TabIndex = 0;
- groupBox1.TabStop = false;
- groupBox1.Text = "Kunde";
- //
- // lbxKunde
- //
- lbxKunde.FormattingEnabled = true;
- lbxKunde.ItemHeight = 23;
- lbxKunde.Location = new Point(8, 57);
- lbxKunde.Margin = new Padding(4, 5, 4, 5);
- lbxKunde.Name = "lbxKunde";
- lbxKunde.Size = new Size(338, 257);
- lbxKunde.TabIndex = 0;
- //
- // groupBox2
- //
- groupBox2.Controls.Add(lbxLeistung);
- groupBox2.Location = new Point(390, 34);
- groupBox2.Margin = new Padding(4, 5, 4, 5);
- groupBox2.Name = "groupBox2";
- groupBox2.Padding = new Padding(4, 5, 4, 5);
- groupBox2.Size = new Size(355, 354);
- groupBox2.TabIndex = 1;
- groupBox2.TabStop = false;
- groupBox2.Text = "Leistung";
- //
- // lbxLeistung
- //
- lbxLeistung.FormattingEnabled = true;
- lbxLeistung.ItemHeight = 23;
- lbxLeistung.Location = new Point(8, 57);
- lbxLeistung.Margin = new Padding(4, 5, 4, 5);
- lbxLeistung.Name = "lbxLeistung";
- lbxLeistung.Size = new Size(338, 257);
- lbxLeistung.TabIndex = 0;
- lbxLeistung.SelectedValueChanged += lbxLeistung_SelectedValueChanged;
- //
- // groupBox3
- //
- groupBox3.Controls.Add(lbxMitarbeiter);
- groupBox3.Location = new Point(752, 34);
- groupBox3.Margin = new Padding(4, 5, 4, 5);
- groupBox3.Name = "groupBox3";
- groupBox3.Padding = new Padding(4, 5, 4, 5);
- groupBox3.Size = new Size(355, 354);
- groupBox3.TabIndex = 2;
- groupBox3.TabStop = false;
- groupBox3.Text = "Mitarbeiter";
- //
- // lbxMitarbeiter
- //
- lbxMitarbeiter.FormattingEnabled = true;
- lbxMitarbeiter.ItemHeight = 23;
- lbxMitarbeiter.Location = new Point(8, 57);
- lbxMitarbeiter.Margin = new Padding(4, 5, 4, 5);
- lbxMitarbeiter.Name = "lbxMitarbeiter";
- lbxMitarbeiter.Size = new Size(338, 257);
- lbxMitarbeiter.TabIndex = 0;
- //
- // tbxTitelDerPosition
- //
- tbxTitelDerPosition.Location = new Point(197, 428);
- tbxTitelDerPosition.Margin = new Padding(4, 5, 4, 5);
- tbxTitelDerPosition.Name = "tbxTitelDerPosition";
- tbxTitelDerPosition.Size = new Size(318, 30);
- tbxTitelDerPosition.TabIndex = 3;
- //
- // label1
- //
- label1.AutoSize = true;
- label1.Location = new Point(48, 431);
- label1.Margin = new Padding(4, 0, 4, 0);
- label1.Name = "label1";
- label1.Size = new Size(141, 23);
- label1.TabIndex = 4;
- label1.Text = "Titel der Position:";
- //
- // btnPositionErstellen
- //
- btnPositionErstellen.Location = new Point(524, 428);
- btnPositionErstellen.Margin = new Padding(4, 5, 4, 5);
- btnPositionErstellen.Name = "btnPositionErstellen";
- btnPositionErstellen.Size = new Size(195, 30);
- btnPositionErstellen.TabIndex = 5;
- btnPositionErstellen.Text = "Position erstellen";
- btnPositionErstellen.UseVisualStyleBackColor = true;
- btnPositionErstellen.Click += btnPositionErstellen_Click;
- //
- // tbxErstelltePosition
- //
- tbxErstelltePosition.Location = new Point(199, 502);
- tbxErstelltePosition.Margin = new Padding(4, 5, 4, 5);
- tbxErstelltePosition.Name = "tbxErstelltePosition";
- tbxErstelltePosition.Size = new Size(520, 30);
- tbxErstelltePosition.TabIndex = 6;
- //
- // label2
- //
- label2.AutoSize = true;
- label2.Location = new Point(49, 504);
- label2.Margin = new Padding(4, 0, 4, 0);
- label2.Name = "label2";
- label2.Size = new Size(139, 23);
- label2.TabIndex = 7;
- label2.Text = "Erstellte Position:";
- //
- // LexofficeRechnungspositionsGenerator
- //
- AutoScaleDimensions = new SizeF(9F, 23F);
- AutoScaleMode = AutoScaleMode.Font;
- Controls.Add(label2);
- Controls.Add(tbxErstelltePosition);
- Controls.Add(btnPositionErstellen);
- Controls.Add(label1);
- Controls.Add(tbxTitelDerPosition);
- Controls.Add(groupBox3);
- Controls.Add(groupBox2);
- Controls.Add(groupBox1);
- Font = new Font("Segoe UI", 12.75F, FontStyle.Regular, GraphicsUnit.Point, 0);
- Margin = new Padding(4, 5, 4, 5);
- Name = "LexofficeRechnungspositionsGenerator";
- Size = new Size(1233, 810);
- Load += LexofficeRechnungspositionsGenerator_Load;
- groupBox1.ResumeLayout(false);
- groupBox2.ResumeLayout(false);
- groupBox3.ResumeLayout(false);
- ResumeLayout(false);
- PerformLayout();
- }
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ groupBox1 = new GroupBox();
+ lbxKunde = new ListBox();
+ groupBox2 = new GroupBox();
+ lbxLeistung = new ListBox();
+ groupBox3 = new GroupBox();
+ lbxMitarbeiter = new ListBox();
+ tbxTitelDerPosition = new TextBox();
+ label1 = new Label();
+ btnPositionErstellen = new Button();
+ tbxErstelltePosition = new TextBox();
+ label2 = new Label();
+ btn_Copy = new Button();
+ groupBox1.SuspendLayout();
+ groupBox2.SuspendLayout();
+ groupBox3.SuspendLayout();
+ SuspendLayout();
+ //
+ // groupBox1
+ //
+ groupBox1.Controls.Add(lbxKunde);
+ groupBox1.Location = new Point(27, 34);
+ groupBox1.Margin = new Padding(4, 5, 4, 5);
+ groupBox1.Name = "groupBox1";
+ groupBox1.Padding = new Padding(4, 5, 4, 5);
+ groupBox1.Size = new Size(355, 354);
+ groupBox1.TabIndex = 0;
+ groupBox1.TabStop = false;
+ groupBox1.Text = "Kunde";
+ //
+ // lbxKunde
+ //
+ lbxKunde.FormattingEnabled = true;
+ lbxKunde.ItemHeight = 23;
+ lbxKunde.Location = new Point(8, 57);
+ lbxKunde.Margin = new Padding(4, 5, 4, 5);
+ lbxKunde.Name = "lbxKunde";
+ lbxKunde.Size = new Size(338, 257);
+ lbxKunde.TabIndex = 0;
+ //
+ // groupBox2
+ //
+ groupBox2.Controls.Add(lbxLeistung);
+ groupBox2.Location = new Point(390, 34);
+ groupBox2.Margin = new Padding(4, 5, 4, 5);
+ groupBox2.Name = "groupBox2";
+ groupBox2.Padding = new Padding(4, 5, 4, 5);
+ groupBox2.Size = new Size(355, 354);
+ groupBox2.TabIndex = 1;
+ groupBox2.TabStop = false;
+ groupBox2.Text = "Leistung";
+ //
+ // lbxLeistung
+ //
+ lbxLeistung.FormattingEnabled = true;
+ lbxLeistung.ItemHeight = 23;
+ lbxLeistung.Location = new Point(8, 57);
+ lbxLeistung.Margin = new Padding(4, 5, 4, 5);
+ lbxLeistung.Name = "lbxLeistung";
+ lbxLeistung.Size = new Size(338, 257);
+ lbxLeistung.TabIndex = 0;
+ lbxLeistung.SelectedValueChanged += lbxLeistung_SelectedValueChanged;
+ //
+ // groupBox3
+ //
+ groupBox3.Controls.Add(lbxMitarbeiter);
+ groupBox3.Location = new Point(752, 34);
+ groupBox3.Margin = new Padding(4, 5, 4, 5);
+ groupBox3.Name = "groupBox3";
+ groupBox3.Padding = new Padding(4, 5, 4, 5);
+ groupBox3.Size = new Size(355, 354);
+ groupBox3.TabIndex = 2;
+ groupBox3.TabStop = false;
+ groupBox3.Text = "Mitarbeiter";
+ //
+ // lbxMitarbeiter
+ //
+ lbxMitarbeiter.FormattingEnabled = true;
+ lbxMitarbeiter.ItemHeight = 23;
+ lbxMitarbeiter.Location = new Point(8, 57);
+ lbxMitarbeiter.Margin = new Padding(4, 5, 4, 5);
+ lbxMitarbeiter.Name = "lbxMitarbeiter";
+ lbxMitarbeiter.Size = new Size(338, 257);
+ lbxMitarbeiter.TabIndex = 0;
+ //
+ // tbxTitelDerPosition
+ //
+ tbxTitelDerPosition.Location = new Point(197, 428);
+ tbxTitelDerPosition.Margin = new Padding(4, 5, 4, 5);
+ tbxTitelDerPosition.Name = "tbxTitelDerPosition";
+ tbxTitelDerPosition.Size = new Size(318, 30);
+ tbxTitelDerPosition.TabIndex = 3;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(48, 431);
+ label1.Margin = new Padding(4, 0, 4, 0);
+ label1.Name = "label1";
+ label1.Size = new Size(141, 23);
+ label1.TabIndex = 4;
+ label1.Text = "Titel der Position:";
+ //
+ // btnPositionErstellen
+ //
+ btnPositionErstellen.Location = new Point(524, 428);
+ btnPositionErstellen.Margin = new Padding(4, 5, 4, 5);
+ btnPositionErstellen.Name = "btnPositionErstellen";
+ btnPositionErstellen.Size = new Size(195, 30);
+ btnPositionErstellen.TabIndex = 5;
+ btnPositionErstellen.Text = "Position erstellen";
+ btnPositionErstellen.UseVisualStyleBackColor = true;
+ btnPositionErstellen.Click += btnPositionErstellen_Click;
+ //
+ // tbxErstelltePosition
+ //
+ tbxErstelltePosition.Location = new Point(199, 502);
+ tbxErstelltePosition.Margin = new Padding(4, 5, 4, 5);
+ tbxErstelltePosition.Name = "tbxErstelltePosition";
+ tbxErstelltePosition.ReadOnly = true;
+ tbxErstelltePosition.Size = new Size(520, 30);
+ tbxErstelltePosition.TabIndex = 6;
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(49, 504);
+ label2.Margin = new Padding(4, 0, 4, 0);
+ label2.Name = "label2";
+ label2.Size = new Size(139, 23);
+ label2.TabIndex = 7;
+ label2.Text = "Erstellte Position:";
+ //
+ // btn_Copy
+ //
+ btn_Copy.Location = new Point(740, 502);
+ btn_Copy.Name = "btn_Copy";
+ btn_Copy.Size = new Size(95, 33);
+ btn_Copy.TabIndex = 8;
+ btn_Copy.Text = "Kopieren";
+ btn_Copy.UseVisualStyleBackColor = true;
+ btn_Copy.Click += btn_Copy_Click;
+ //
+ // LexofficeRechnungspositionsGenerator
+ //
+ AutoScaleDimensions = new SizeF(9F, 23F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(btn_Copy);
+ Controls.Add(label2);
+ Controls.Add(tbxErstelltePosition);
+ Controls.Add(btnPositionErstellen);
+ Controls.Add(label1);
+ Controls.Add(tbxTitelDerPosition);
+ Controls.Add(groupBox3);
+ Controls.Add(groupBox2);
+ Controls.Add(groupBox1);
+ Font = new Font("Segoe UI", 12.75F, FontStyle.Regular, GraphicsUnit.Point, 0);
+ Margin = new Padding(4, 5, 4, 5);
+ Name = "LexofficeRechnungspositionsGenerator";
+ Size = new Size(1233, 810);
+ Load += LexofficeRechnungspositionsGenerator_Load;
+ groupBox1.ResumeLayout(false);
+ groupBox2.ResumeLayout(false);
+ groupBox3.ResumeLayout(false);
+ ResumeLayout(false);
+ PerformLayout();
+ }
- #endregion
+ #endregion
- private GroupBox groupBox1;
+ private GroupBox groupBox1;
private ListBox lbxKunde;
private GroupBox groupBox2;
private ListBox lbxLeistung;
@@ -196,5 +209,6 @@ private void InitializeComponent()
private Button btnPositionErstellen;
private TextBox tbxErstelltePosition;
private Label label2;
- }
+ private Button btn_Copy;
+ }
}
diff --git a/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.cs b/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.cs
index a9db3b8..8fe593b 100644
--- a/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.cs
+++ b/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.cs
@@ -34,6 +34,7 @@ private async void LexofficeRechnungspositionsGenerator_Load(object sender, Even
await MitarbeiterListeLaden();
btnPositionErstellen.Enabled = true;
+ btn_Copy.Enabled = false;
}
private async Task MitarbeiterListeLaden()
@@ -78,15 +79,18 @@ private void btnPositionErstellen_Click(object sender, EventArgs e)
if (rechnungsPositionErgebnis.IsSuccess)
{
tbxErstelltePosition.Text = rechnungsPositionErgebnis.Value;
+ btn_Copy.Enabled = true;
return;
}
MessageBox.Show(
rechnungsPositionErgebnis.Error,
- "Fehler bei der Erstellunge",
+ "Fehler bei der Positionserstellung",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
+ tbxErstelltePosition.Text = string.Empty;
+ btn_Copy.Enabled = false;
}
private Result KundeAuslesen()
@@ -107,8 +111,6 @@ private Result LeistungAuslesen()
private Result MitarbeiterAuslesen()
{
- var test = lbxLeistung.SelectedItem;
-
return Maybe
.From(lbxMitarbeiter.SelectedItem)
.ToResult("Bitte wähle zuerst einen Mitarbeiter aus")
@@ -122,7 +124,7 @@ private Result BeschreibungAuslesen()
.Ensure(titel => !string.IsNullOrWhiteSpace(titel), "Bitte gebe einen Titel für diese Position an");
}
- private Result KontoNummerErmitteln(string kunde, string leistung)
+ private static Result KontoNummerErmitteln(string kunde, string leistung)
{
return (kunde, leistung) switch
{
@@ -151,4 +153,9 @@ private void lbxLeistung_SelectedValueChanged(object sender, EventArgs e)
lbxMitarbeiter.Items.Clear();
lbxMitarbeiter.Items.AddRange(mitarbeiter.ToArray());
}
+
+ private void btn_Copy_Click(object sender, EventArgs e)
+ {
+ Clipboard.SetText(tbxErstelltePosition.Text);
+ }
}
diff --git a/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.resx b/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.resx
index be957dd..ae3fbf6 100644
--- a/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.resx
+++ b/Lexoffice/RechnungspositionenGenerator/LexofficeRechnungspositionsGenerator.resx
@@ -59,47 +59,46 @@
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
-
-
+
+
-
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
+
@@ -122,4 +121,4 @@
PublicKeyToken=b77a5c561934e089
-
+
\ No newline at end of file