update 20241121

This commit is contained in:
Stefan Hutter
2024-11-21 19:32:26 +01:00
parent d3bf9458eb
commit 6bdbc4173e
56 changed files with 362 additions and 168 deletions

View File

@@ -18,6 +18,8 @@ using Database;
using OnDoc.Diverses;
using System.Xml.Linq;
using System.Web.UI.WebControls;
using Microsoft.SqlServer.Server;
using System.Collections;
namespace OnDoc.DocMgmt
{
@@ -70,15 +72,21 @@ namespace OnDoc.DocMgmt
{
this.Style.TitleBar.BackColor = Theaming.Titelbar();
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
DB db = new DB(AppParams.connectionstring);
db.Get_Tabledata("select distinct dbo.get_fachverantwortung(dbo.dokument.dokumenttypnr) from dbo.dokumenttyp", false, true);
//foreach (System.Data.DataRow in db.dsdaten.Tables)
if (this.favoriten) { Load_Favoriten(""); }
else { load_standard(""); }
}
TreeNodeAdv[] nodestoexpand = new TreeNodeAdv[50];
int nodextoexpandindex = 1;
public void load_standard(string filter)
{
Cursor = Cursors.WaitCursor;
if (AppParams.connectionstring == "")
{
@@ -87,9 +95,6 @@ namespace OnDoc.DocMgmt
treeViewAdv1.Enabled = false;
treeViewAdv1.Visible = false;
treeViewAdv1.BeginUpdate();
treeViewAdv1.EnableVirtualization=true;
treeViewAdv1.SuspendExpandRecalculate=true;
treeViewAdv1.RecalculateExpansion = false;
treeViewAdv1.Nodes.Clear();
treeViewAdv1.LeftImageList = imageList1;
@@ -101,89 +106,56 @@ namespace OnDoc.DocMgmt
if (vorlagentype == 1)
{
//DB db1 = new DB(AppParams.connectionstring);
//DataTable vorlagen1 = new DataTable();
//DataTable Struktur1 = new DataTable();
//DataSet ds = new DataSet();
//db1.Get_Tabledata("Select dokumenttypnr as id, bezeichnung, node, OnBase_Dokumenttyp from View_Dokumenttypen_Relaunch where aktiv=1 " + where + " order by bezeichnung", false, true);
//vorlagen1 = db1.dsdaten.Tables[0].Copy();
//db1.Get_Tabledata("Select * from Dokumentart_Relaunch order by id", false, true);
this.Text = "Vorlage auswählen";
//Standard Vorlagen
DB db = new DB(AppParams.connectionstring);
DataTable vorlagen = new DataTable();
DataTable Struktur = new DataTable();
DataSet ds = new DataSet();
db.Get_Tabledata("Select dokumenttypnr as id, bezeichnung, node, OnBase_Dokumenttyp from View_Dokumenttypen_Relaunch where aktiv=1 " + where + " order by bezeichnung", false, true);
vorlagen = db.dsdaten.Tables[0].Copy();
db.Get_Tabledata("Select * from Dokumentart_Relaunch order by id", false, true);
//db1.dsdaten.Tables[0].AcceptChanges();
//Struktur1 = db1.dsdaten.Tables[0].Copy();
//Syncfusion.Windows.Forms.Tools.DataRelation childRelation1;
//Syncfusion.Windows.Forms.Tools.DataRelation childRelation2;
//Syncfusion.Windows.Forms.Tools.DataRelation childRelation3;
db.dsdaten.Tables[0].AcceptChanges();
Struktur = db.dsdaten.Tables[0].Copy();
//childRelation1 = new Syncfusion.Windows.Forms.Tools.DataRelation(Struktur1, "struktur1", "bezeichnung", "ChildFolder", "SubFolderChild1", "SubFolderName1", "Checked");
ds.Tables.Add(Struktur.Copy());
ds.Tables[0].TableName = "Struktur";
ds.Tables.Add(vorlagen.Copy());
ds.Relations.Add("TreeParentChild", ds.Tables[0].Columns["ID"], ds.Tables[0].Columns["ParentID"], false);
ds.Relations.Add("VorlagenParent", ds.Tables[0].Columns["ID"], ds.Tables[1].Columns["node"], false);
nodestoexpand = null;
nodestoexpand = new TreeNodeAdv[Struktur.Rows.Count];
nodextoexpandindex = 1;
//if (where == "" && StaticValues.vorlagen.Nodes.Count>1)
//{
// treeViewAdv1.Nodes.Clear();
// TreeNodeAdv copynodes = StaticValues.vorlagen.Nodes[0].Clone();
// treeViewAdv1.Nodes.Add(copynodes);
// copynodes = StaticValues.vorlagen.Nodes[1].Clone();
// treeViewAdv1.Nodes.Add(copynodes);
//}
//else
//{
this.Text = "Vorlage auswählen";
//Standard Vorlagen
DB db = new DB(AppParams.connectionstring);
DataTable vorlagen = new DataTable();
DataTable Struktur = new DataTable();
DataSet ds = new DataSet();
db.Get_Tabledata("Select dokumenttypnr as id, bezeichnung, node, OnBase_Dokumenttyp from View_Dokumenttypen_Relaunch where aktiv=1 " + where + " order by bezeichnung", false, true);
vorlagen = db.dsdaten.Tables[0].Copy();
db.Get_Tabledata("Select * from Dokumentart_Relaunch order by id", false, true);
db.dsdaten.Tables[0].AcceptChanges();
Struktur = db.dsdaten.Tables[0].Copy();
ds.Tables.Add(Struktur.Copy());
ds.Tables[0].TableName = "Struktur";
ds.Tables.Add(vorlagen.Copy());
ds.Relations.Add("TreeParentChild", ds.Tables[0].Columns["ID"], ds.Tables[0].Columns["ParentID"], false);
ds.Relations.Add("VorlagenParent", ds.Tables[0].Columns["ID"], ds.Tables[1].Columns["node"], false);
foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
{
if (dr["Parentid"].ToString() == "0")
{
if (dr["Parentid"].ToString() == "0")
//Creates a TreeNode if the parent equals 0
TreeNodeAdv root = new TreeNodeAdv(dr["bezeichnung"].ToString());
root.Tag = Convert.ToInt32(dr["id"]) * -1;
root.TagObject = dr;
root.LeftImageIndices = new int[] { 0 };
treeViewAdv1.Nodes.Add(root);
PopulateTree(dr, root);
}
}
if (filter == "")
{
try
{
for (int i = 1; i < nodextoexpandindex; i++)
{
//Creates a TreeNode if the parent equals 0
TreeNodeAdv root = new TreeNodeAdv(dr["bezeichnung"].ToString());
root.Tag = Convert.ToInt32(dr["id"]) * -1;
root.TagObject = dr;
root.LeftImageIndices = new int[] { 0 };
treeViewAdv1.Nodes.Add(root);
//Recursively builds the tree
PopulateTree(dr, root);
treeViewAdv1.SelectedNode = nodestoexpand[i];
if (treeViewAdv1.SelectedNode.Nodes[0].Nodes.Count > 0) { treeViewAdv1.SelectedNode.Expand(); }
}
}
// if (StaticValues.vorlagen.Nodes.Count==0)
//{
// Logging.Logging.Debug("Save Static Value Start", "OnDoc", "");
// //StaticValues.vorlagen = treeViewAdv1;
// TreeNodeAdv copynodes = this.treeViewAdv1.Nodes[0].Clone();
// StaticValues.vorlagen.Nodes.Add(copynodes);
// copynodes = this.treeViewAdv1.Nodes[1].Clone();
// StaticValues.vorlagen.Nodes.Add(copynodes);
// Logging.Logging.Debug("Save Static Value Ende", "OnDoc", "");
// }
//}
catch { }
} else
{ treeViewAdv1.ExpandAll();
}
}
else
{
@@ -229,12 +201,14 @@ namespace OnDoc.DocMgmt
//Expands all the tree nodes
treeViewAdv1.SelectedNode = treeViewAdv1.Nodes[0];
treeViewAdv1.EndUpdate();
treeViewAdv1.Enabled = true;
treeViewAdv1.Visible = true;
Logging.Logging.Debug("Tree Expand all Ende", "OnDoc", "");
if (ExternalCall.struktur != "")
{
@@ -247,17 +221,15 @@ namespace OnDoc.DocMgmt
public void PopulateSubTree(System.Data.DataRow dr, TreeNodeAdv pNode)
{
//To iterate through all the rows in the DataSet
foreach (System.Data.DataRow row in dr.GetChildRows("VorlagenParent"))
{
//Creating a TreeNode for each row
TreeNodeAdv cChild = new TreeNodeAdv(row["bezeichnung"].ToString());
cChild.LeftImageIndices = new int[] { 1 };
cChild.Tag = Convert.ToInt32(row["id"]) * 1;
cChild.TagObject = row;
//Add cChild node to the pNode
pNode.Nodes.Add(cChild);
//Recursively build the tree
PopulateSubTree(row, cChild);
}
}
@@ -275,8 +247,11 @@ namespace OnDoc.DocMgmt
cChild.Tag = Convert.ToInt32(row["id"]) * -1;
cChild.LeftImageIndices = new int[] { 0 };
cChild.TagObject = row;
nodestoexpand[nodextoexpandindex] = cChild;
nodextoexpandindex = nodextoexpandindex + 1;
//Add cChild node to the pNode
pNode.Nodes.Add(cChild);
//Recursively build the tree
PopulateTree(row, cChild);
//PopulateSubTree(row, cChild);
@@ -328,6 +303,7 @@ namespace OnDoc.DocMgmt
//Recursively builds the tree
PopulateTree_Favoriten(dr, root);
}
}
treeViewAdv2.ExpandAll();
@@ -801,5 +777,11 @@ namespace OnDoc.DocMgmt
}
}
}
private void ribbonButtonClear_Click(object sender, EventArgs e)
{
RibbonTextSearch.Text = "";
load_standard("");
}
}
}