update 20241201

This commit is contained in:
Stefan Hutter
2024-12-01 18:34:28 +01:00
parent 470d2e1bb5
commit fcc74b25cb
5244 changed files with 3378608 additions and 267 deletions

View File

@@ -0,0 +1,340 @@
namespace OnDoc.Versandstrasse
{
partial class Versandstrasse
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
Syncfusion.Windows.Forms.Tools.TreeNodeAdvStyleInfo treeNodeAdvStyleInfo1 = new Syncfusion.Windows.Forms.Tools.TreeNodeAdvStyleInfo();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Versandstrasse));
this.treeViewAdv1 = new Syncfusion.Windows.Forms.Tools.TreeViewAdv();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.GrpPaketDetails = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.lbgasadresse = new System.Windows.Forms.ListBox();
this.chkGAS = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.txtnachrichtankunde = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rbversandoption3 = new System.Windows.Forms.RadioButton();
this.rbversandoption2 = new System.Windows.Forms.RadioButton();
this.rbversandoption1 = new System.Windows.Forms.RadioButton();
this.button1 = new System.Windows.Forms.Button();
this.tsbtnDruckPaketNew = new System.Windows.Forms.ToolStripButton();
this.tsbtnVersenden = new System.Windows.Forms.ToolStripButton();
((System.ComponentModel.ISupportInitialize)(this.treeViewAdv1)).BeginInit();
this.toolStrip1.SuspendLayout();
this.GrpPaketDetails.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// treeViewAdv1
//
this.treeViewAdv1.AllowDrop = true;
this.treeViewAdv1.BackColor = System.Drawing.Color.White;
this.treeViewAdv1.BackgroundColor = new Syncfusion.Drawing.BrushInfo(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))));
treeNodeAdvStyleInfo1.CheckBoxTickThickness = 1;
treeNodeAdvStyleInfo1.CheckColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
treeNodeAdvStyleInfo1.EnsureDefaultOptionedChild = true;
treeNodeAdvStyleInfo1.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
treeNodeAdvStyleInfo1.IntermediateCheckColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
treeNodeAdvStyleInfo1.OptionButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
treeNodeAdvStyleInfo1.SelectedOptionButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(210)))), ((int)(((byte)(210)))), ((int)(((byte)(210)))));
treeNodeAdvStyleInfo1.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(43)))), ((int)(((byte)(43)))));
this.treeViewAdv1.BaseStylePairs.AddRange(new Syncfusion.Windows.Forms.Tools.StyleNamePair[] {
new Syncfusion.Windows.Forms.Tools.StyleNamePair("Standard", treeNodeAdvStyleInfo1)});
this.treeViewAdv1.BeforeTouchSize = new System.Drawing.Size(487, 502);
this.treeViewAdv1.Border3DStyle = System.Windows.Forms.Border3DStyle.Flat;
this.treeViewAdv1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.treeViewAdv1.Dock = System.Windows.Forms.DockStyle.Left;
this.treeViewAdv1.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.treeViewAdv1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(43)))), ((int)(((byte)(43)))));
//
//
//
this.treeViewAdv1.HelpTextControl.BaseThemeName = null;
this.treeViewAdv1.HelpTextControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.treeViewAdv1.HelpTextControl.Location = new System.Drawing.Point(732, 0);
this.treeViewAdv1.HelpTextControl.Name = "helpText";
this.treeViewAdv1.HelpTextControl.Size = new System.Drawing.Size(49, 15);
this.treeViewAdv1.HelpTextControl.TabIndex = 0;
this.treeViewAdv1.HelpTextControl.Text = "help text";
this.treeViewAdv1.HotTracking = true;
this.treeViewAdv1.InactiveSelectedNodeForeColor = System.Drawing.SystemColors.ControlText;
this.treeViewAdv1.Indent = 20;
this.treeViewAdv1.ItemHeight = 25;
this.treeViewAdv1.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(94)))), ((int)(((byte)(94)))));
this.treeViewAdv1.Location = new System.Drawing.Point(2, 39);
this.treeViewAdv1.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218)))));
this.treeViewAdv1.MetroScrollBars = true;
this.treeViewAdv1.Name = "treeViewAdv1";
this.treeViewAdv1.PathSeparator = "/";
this.treeViewAdv1.SelectedNodeBackground = new Syncfusion.Drawing.BrushInfo(System.Drawing.Color.FromArgb(((int)(((byte)(197)))), ((int)(((byte)(197)))), ((int)(((byte)(197))))));
this.treeViewAdv1.SelectedNodeForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(43)))), ((int)(((byte)(43)))));
this.treeViewAdv1.ShowFocusRect = false;
this.treeViewAdv1.Size = new System.Drawing.Size(487, 502);
this.treeViewAdv1.Style = Syncfusion.Windows.Forms.Tools.TreeStyle.Office2016Colorful;
this.treeViewAdv1.TabIndex = 7;
this.treeViewAdv1.Text = "treeViewAdv2";
this.treeViewAdv1.ThemeName = "Office2016Colorful";
this.treeViewAdv1.ThemeStyle.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(171)))), ((int)(((byte)(171)))));
this.treeViewAdv1.ThemeStyle.TreeNodeAdvStyle.CheckBoxTickThickness = 0;
this.treeViewAdv1.ThemeStyle.TreeNodeAdvStyle.CheckColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
this.treeViewAdv1.ThemeStyle.TreeNodeAdvStyle.EnsureDefaultOptionedChild = true;
this.treeViewAdv1.ThemeStyle.TreeNodeAdvStyle.IntermediateCheckColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
this.treeViewAdv1.ThemeStyle.TreeNodeAdvStyle.OptionButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
this.treeViewAdv1.ThemeStyle.TreeNodeAdvStyle.SelectedOptionButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(210)))), ((int)(((byte)(210)))), ((int)(((byte)(210)))));
//
//
//
this.treeViewAdv1.ToolTipControl.BackColor = System.Drawing.SystemColors.Info;
this.treeViewAdv1.ToolTipControl.BaseThemeName = null;
this.treeViewAdv1.ToolTipControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.treeViewAdv1.ToolTipControl.Location = new System.Drawing.Point(642, 0);
this.treeViewAdv1.ToolTipControl.Name = "toolTip";
this.treeViewAdv1.ToolTipControl.Size = new System.Drawing.Size(41, 15);
this.treeViewAdv1.ToolTipControl.TabIndex = 1;
this.treeViewAdv1.ToolTipControl.Text = "toolTip";
this.treeViewAdv1.TransparentControls = true;
this.treeViewAdv1.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeViewAdv1_ItemDrag);
this.treeViewAdv1.NodeMouseClick += new Syncfusion.Windows.Forms.Tools.TreeNodeAdvMouseClickArgs(this.treeViewAdv1_NodeMouseClick);
this.treeViewAdv1.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewAdv1_DragDrop);
this.treeViewAdv1.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewAdv1_DragOver);
this.treeViewAdv1.DragLeave += new System.EventHandler(this.treeViewAdv1_DragLeave);
//
// toolStrip1
//
this.toolStrip1.AutoSize = false;
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbtnDruckPaketNew,
this.tsbtnVersenden});
this.toolStrip1.Location = new System.Drawing.Point(2, 2);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(933, 37);
this.toolStrip1.TabIndex = 8;
this.toolStrip1.Text = "toolStrip1";
//
// GrpPaketDetails
//
this.GrpPaketDetails.Controls.Add(this.button1);
this.GrpPaketDetails.Controls.Add(this.groupBox3);
this.GrpPaketDetails.Controls.Add(this.groupBox2);
this.GrpPaketDetails.Controls.Add(this.groupBox1);
this.GrpPaketDetails.Location = new System.Drawing.Point(495, 39);
this.GrpPaketDetails.Name = "GrpPaketDetails";
this.GrpPaketDetails.Size = new System.Drawing.Size(437, 502);
this.GrpPaketDetails.TabIndex = 9;
this.GrpPaketDetails.TabStop = false;
this.GrpPaketDetails.Text = "Details zum Druckpaket";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.label1);
this.groupBox3.Controls.Add(this.lbgasadresse);
this.groupBox3.Controls.Add(this.chkGAS);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox3.Location = new System.Drawing.Point(3, 230);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(431, 192);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Rückantwort";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(24, 63);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(105, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Rückantwortadresse";
//
// lbgasadresse
//
this.lbgasadresse.FormattingEnabled = true;
this.lbgasadresse.Items.AddRange(new object[] {
"Adresse 1",
"Adresse 2",
"Adresse 3"});
this.lbgasadresse.Location = new System.Drawing.Point(24, 82);
this.lbgasadresse.Name = "lbgasadresse";
this.lbgasadresse.Size = new System.Drawing.Size(332, 95);
this.lbgasadresse.TabIndex = 1;
//
// chkGAS
//
this.chkGAS.AutoSize = true;
this.chkGAS.Location = new System.Drawing.Point(24, 34);
this.chkGAS.Name = "chkGAS";
this.chkGAS.Size = new System.Drawing.Size(112, 17);
this.chkGAS.TabIndex = 0;
this.chkGAS.Text = "GAS-Rückantwort";
this.chkGAS.UseVisualStyleBackColor = true;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.txtnachrichtankunde);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox2.Location = new System.Drawing.Point(3, 130);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(431, 100);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Nachricht an Kunde";
//
// txtnachrichtankunde
//
this.txtnachrichtankunde.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtnachrichtankunde.Location = new System.Drawing.Point(3, 16);
this.txtnachrichtankunde.Multiline = true;
this.txtnachrichtankunde.Name = "txtnachrichtankunde";
this.txtnachrichtankunde.Size = new System.Drawing.Size(425, 81);
this.txtnachrichtankunde.TabIndex = 0;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.rbversandoption3);
this.groupBox1.Controls.Add(this.rbversandoption2);
this.groupBox1.Controls.Add(this.rbversandoption1);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(3, 16);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(431, 114);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Versandoptionen";
//
// rbversandoption3
//
this.rbversandoption3.AutoSize = true;
this.rbversandoption3.Location = new System.Drawing.Point(24, 75);
this.rbversandoption3.Name = "rbversandoption3";
this.rbversandoption3.Size = new System.Drawing.Size(207, 17);
this.rbversandoption3.TabIndex = 2;
this.rbversandoption3.TabStop = true;
this.rbversandoption3.Text = "Hauptadresse, Postversand erzwingen";
this.rbversandoption3.UseVisualStyleBackColor = true;
//
// rbversandoption2
//
this.rbversandoption2.AutoSize = true;
this.rbversandoption2.Location = new System.Drawing.Point(24, 52);
this.rbversandoption2.Name = "rbversandoption2";
this.rbversandoption2.Size = new System.Drawing.Size(197, 17);
this.rbversandoption2.TabIndex = 1;
this.rbversandoption2.TabStop = true;
this.rbversandoption2.Text = "Hauptadresse, E-Banking erzwingen";
this.rbversandoption2.UseVisualStyleBackColor = true;
//
// rbversandoption1
//
this.rbversandoption1.AutoSize = true;
this.rbversandoption1.Location = new System.Drawing.Point(24, 29);
this.rbversandoption1.Name = "rbversandoption1";
this.rbversandoption1.Size = new System.Drawing.Size(166, 17);
this.rbversandoption1.TabIndex = 0;
this.rbversandoption1.TabStop = true;
this.rbversandoption1.Text = "Hauptadresse und Versandart";
this.rbversandoption1.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Location = new System.Drawing.Point(6, 454);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 3;
this.button1.Text = "Speichern";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// tsbtnDruckPaketNew
//
this.tsbtnDruckPaketNew.Image = global::OnDoc.Properties.Resources.add_32x32_32;
this.tsbtnDruckPaketNew.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbtnDruckPaketNew.Name = "tsbtnDruckPaketNew";
this.tsbtnDruckPaketNew.Size = new System.Drawing.Size(123, 34);
this.tsbtnDruckPaketNew.Text = "Neues Druckpaket";
this.tsbtnDruckPaketNew.Click += new System.EventHandler(this.tsbtnDruckPaketNew_Click);
//
// tsbtnVersenden
//
this.tsbtnVersenden.Image = global::OnDoc.Properties.Resources.Letter_24x24_32;
this.tsbtnVersenden.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbtnVersenden.Name = "tsbtnVersenden";
this.tsbtnVersenden.Size = new System.Drawing.Size(244, 34);
this.tsbtnVersenden.Text = "Dokumente an Versandstrasse übergeben";
//
// Versandstrasse
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(937, 543);
this.Controls.Add(this.treeViewAdv1);
this.Controls.Add(this.GrpPaketDetails);
this.Controls.Add(this.toolStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Name = "Versandstrasse";
this.Style.MdiChild.IconHorizontalAlignment = System.Windows.Forms.HorizontalAlignment.Center;
this.Style.MdiChild.IconVerticalAlignment = System.Windows.Forms.VisualStyles.VerticalAlignment.Center;
this.Text = "Versandstrasse";
this.Load += new System.EventHandler(this.Versandstrasse_Load);
((System.ComponentModel.ISupportInitialize)(this.treeViewAdv1)).EndInit();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.GrpPaketDetails.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private Syncfusion.Windows.Forms.Tools.TreeViewAdv treeViewAdv1;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton tsbtnDruckPaketNew;
private System.Windows.Forms.ToolStripButton tsbtnVersenden;
private System.Windows.Forms.GroupBox GrpPaketDetails;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton rbversandoption3;
private System.Windows.Forms.RadioButton rbversandoption2;
private System.Windows.Forms.RadioButton rbversandoption1;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ListBox lbgasadresse;
private System.Windows.Forms.CheckBox chkGAS;
private System.Windows.Forms.TextBox txtnachrichtankunde;
private System.Windows.Forms.Button button1;
}
}

View File

@@ -0,0 +1,264 @@
using Syncfusion.Windows.Forms.Tools;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Syncfusion.WinForms.Controls;
using Syncfusion.Windows.Forms.Utils;
using OnDoc.Klassen;
using Syncfusion.Windows.Forms;
using Model;
using OnDoc.DocMgmt;
using System.Xml.Linq;
namespace OnDoc.Versandstrasse
{
public partial class Versandstrasse : SfForm
{
private Versandpakete pakete = new Versandpakete();
private TreeViewAdvDragHighlightTracker treeViewDragHighlightTracker = null;
private TreeNodeAdv currentSourceNode;
public Versandstrasse(Versandpakete pakete)
{
InitializeComponent();
this.treeViewAdv1.AutoScrolling = ScrollBars.Both;
this.Style.TitleBar.BackColor = Theaming.Titelbar();
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
this.treeViewDragHighlightTracker = new TreeViewAdvDragHighlightTracker(this.treeViewAdv1);
this.treeViewDragHighlightTracker.QueryAllowedPositionsForNode +=
new QueryAllowedPositionsEventHandler(this.TreeDragDrop_QueryAllowedPositionsForNode);
this.treeViewDragHighlightTracker.QueryDragInsertInfo +=
new QueryDragInsertInfoEventHandler(treeViewDragHighlightTracker_QueryDragInsertInfo);
this.pakete = pakete;
}
private void Versandstrasse_Load(object sender, EventArgs e)
{
Reload_Tree();
}
private void Reload_Tree() {
treeViewAdv1.Nodes.Clear();
TreeNodeAdv DruckJob;
for (int i = 0; i < pakete.paket.Count; i++)
{
DruckJob = new TreeNodeAdv();
DruckJob.Text = "Druckpaket " + pakete.paket[i].PaketNr;
DruckJob.Tag = "Druckpaket";
DruckJob.TagObject = pakete.paket[i];
treeViewAdv1.Nodes.Add(DruckJob);
PopulateDocs(pakete.paket[i], ref DruckJob);
}
treeViewAdv1.ExpandAll();
}
private void PopulateDocs(Versandpaket paket, ref TreeNodeAdv parentnode)
{
TreeNodeAdv dokumentnode;
for (int i = 0; i < paket.Dokument.Count; i++)
{
dokumentnode = new TreeNodeAdv();
dokumentnode.Text = paket.Dokument[i].Bezeichnung+" (" + paket.Dokument[i].Partnernr+")";
dokumentnode.Tag = paket.Dokument[i].DokumentID;
dokumentnode.TagObject= paket.Dokument[i];
parentnode.Nodes.Add(dokumentnode);
}
}
#region "Treeview"
private void treeViewAdv1_DragDrop(object sender, DragEventArgs e)
{
TreeViewAdv treeView = sender as TreeViewAdv;
TreeNodeAdv sourceNode = (TreeNodeAdv)e.Data.GetData(typeof(TreeNodeAdv));
TreeNodeAdv destinationNode = this.treeViewDragHighlightTracker.HighlightNode;
TreeViewDropPositions dropPosition = this.treeViewDragHighlightTracker.DropPosition;
this.treeViewDragHighlightTracker.ClearHighlightNode();
this.currentSourceNode = null;
if (destinationNode != null)
{
switch (dropPosition)
{
case TreeViewDropPositions.AboveNode:
sourceNode.Move(destinationNode, NodePositions.Previous);
break;
case TreeViewDropPositions.BelowNode:
sourceNode.Move(destinationNode, NodePositions.Next);
break;
case TreeViewDropPositions.OnNode:
sourceNode.Move(destinationNode.Nodes);
destinationNode.Expand();
break;
}
}
treeView.SelectedNode = sourceNode;
}
private void treeViewAdv1_DragLeave(object sender, EventArgs e)
{
this.treeViewDragHighlightTracker.ClearHighlightNode();
}
private void treeViewAdv1_DragOver(object sender, DragEventArgs e)
{
bool droppable = true;
TreeNodeAdv destinationNode = null;
TreeViewAdv treeView = sender as TreeViewAdv;
Point ptInTree = treeView.PointToClient(new Point(e.X, e.Y));
this.currentSourceNode = null;
if (e.Data.GetDataPresent(typeof(TreeNodeAdv)))
{
destinationNode = treeView.GetNodeAtPoint(ptInTree);
TreeNodeAdv sourceNode = (TreeNodeAdv)e.Data.GetData(typeof(TreeNodeAdv));
this.currentSourceNode = sourceNode;
droppable = this.CanDrop(sourceNode, destinationNode);
//if (droppable == true) { if (destinationNode.Tag.ToString() != "Druckpaket") { droppable = false; } }
}
else
droppable = false;
if (droppable)
e.Effect = DragDropEffects.Move;
else
e.Effect = DragDropEffects.None;
this.treeViewDragHighlightTracker.SetHighlightNode(destinationNode, ptInTree);
}
private bool CanDrop(TreeNodeAdv sourceNode, TreeNodeAdv destinationNode)
{
TreeNodeAdv xdestinationNode = this.treeViewDragHighlightTracker.HighlightNode;
TreeViewDropPositions dropPosition = this.treeViewDragHighlightTracker.DropPosition;
if (destinationNode == null || destinationNode == sourceNode)
return false;
else
{
try
{
if (xdestinationNode.Level == 1 && dropPosition != TreeViewDropPositions.OnNode)
{
return false;
}
if (xdestinationNode.Level == 2 ) { return true; }
}
catch { }
return true; }
}
private void treeViewAdv1_ItemDrag(object sender, ItemDragEventArgs e)
{
TreeViewAdv treeViewAdv = sender as TreeViewAdv;
TreeNodeAdv[] nodes = e.Item as TreeNodeAdv[];
TreeNodeAdv node = nodes[0];
{
DragDropEffects result = treeViewAdv.DoDragDrop(node, DragDropEffects.Move);
}
}
private bool IsDruckPaket(TreeNodeAdv node)
{
if (node.Tag == null
|| ("Druckpaket").CompareTo(node.Tag.ToString()) != 0)
{
return false;
}
else
return true;
}
private void treeViewDragHighlightTracker_QueryDragInsertInfo(object sender, QueryDragInsertInfoEventArgs args)
{
args.DragInsertColor = Color.Red;
}
private void TreeDragDrop_QueryAllowedPositionsForNode(object sender, QueryAllowedPositionsEventArgs e)
{
if (!this.IsDruckPaket(e.HighlightNode))
{
if (e.HighlightNode != this.currentSourceNode)
e.AllowedPositions = TreeViewDropPositions.AboveNode | TreeViewDropPositions.BelowNode;
else
e.AllowedPositions = TreeViewDropPositions.None;
this.treeViewDragHighlightTracker.EdgeSensitivityOnTop = e.HighlightNode.Bounds.Height / 2;
e.ShowSelectionHighlight = false;
}
else
{
this.treeViewDragHighlightTracker.EdgeSensitivityOnTop = e.HighlightNode.Bounds.Height / 4;
e.ShowSelectionHighlight = false;
}
}
#endregion
private void tsbtnDruckPaketNew_Click(object sender, EventArgs e)
{
Versandpaket newpaket = new Versandpaket();
newpaket.PaketNr= (treeViewAdv1.Nodes.Count + 1).ToString();
newpaket.Versandoption = "1";
newpaket.GAS = "0";
newpaket.GASAdresse = "0";
newpaket.Mitteilung = "";
newpaket.Dokument = new List<Versanddokument>();
string NodeText = "Druckpaket " + (treeViewAdv1.Nodes.Count + 1).ToString();
TreeNodeAdv drucknode = new TreeNodeAdv();
drucknode.Text = NodeText;
drucknode.Tag = "Druckpaket";
drucknode.TagObject=newpaket;
treeViewAdv1.Nodes.Add(drucknode);
}
private void treeViewAdv1_NodeMouseClick(object sender, TreeViewAdvMouseClickEventArgs e)
{
TreeNodeAdv node = e.Node;
if (node.Level == 1) {
GrpPaketDetails.Enabled = true;
Versandpaket paket = node.TagObject as Versandpaket;
switch (paket.Versandoption) {
case "1":
rbversandoption1.Checked= true; break;
case "2":
rbversandoption2.Checked= true;break;
case "3":
rbversandoption3.Checked= true;break;
default:
break;
}
txtnachrichtankunde.Text = "";
txtnachrichtankunde.Text=paket.Mitteilung.ToString();
if (paket.GAS.ToString() == "1"){
chkGAS.Checked= true;
lbgasadresse.SelectedIndex = Convert.ToInt32(paket.GASAdresse.ToString());
} else { chkGAS.Checked= false; }
}
else { GrpPaketDetails.Enabled=false; }
}
private void button1_Click(object sender, EventArgs e)
{
Versandpaket paket = treeViewAdv1.SelectedNode.TagObject as Versandpaket;
if (rbversandoption1.Checked) { paket.Versandoption = "1"; }
if (rbversandoption2.Checked) { paket.Versandoption = "2"; }
if (rbversandoption3.Checked) { paket.Versandoption = "3"; }
paket.Mitteilung = txtnachrichtankunde.Text;
if (chkGAS.Checked) { paket.GAS = "1"; } else { paket.GAS = "0"; }
try { paket.GASAdresse = lbgasadresse.SelectedIndex.ToString(); } catch { paket.GASAdresse= "0"; }
paket.verified = true;
treeViewAdv1.SelectedNode.TagObject = paket;
//pakete.paket.Add(paket);
Reload_Tree();
}
}
}

File diff suppressed because it is too large Load Diff