Compare commits
No commits in common. "f65644f553136b7c58a99d5934cf9a33d06cb45c" and "301c4c2c9772b4a83d2d843a453e981f1315b308" have entirely different histories.
f65644f553
...
301c4c2c97
@ -19,7 +19,6 @@ using System.Drawing;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
@ -144,8 +143,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region SortingChildren
|
#region SortingChildren
|
||||||
private static bool IsInManualOrderNullFix = false;
|
|
||||||
|
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
public Csla.SortedBindingList<FolderInfo> _SortedChildFolders;
|
public Csla.SortedBindingList<FolderInfo> _SortedChildFolders;
|
||||||
public Csla.SortedBindingList<FolderInfo> SortedChildFolders
|
public Csla.SortedBindingList<FolderInfo> SortedChildFolders
|
||||||
@ -154,29 +151,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
if (ChildFolders != null)
|
if (ChildFolders != null)
|
||||||
{
|
{
|
||||||
//B2025-018 Issues with folder order in tree view
|
|
||||||
// if any ChildFolders with a missing Manual Order
|
|
||||||
// set them to the end of the list
|
|
||||||
// use IsInManualOrderNullFix - so, if setting ChildFolders Currently,
|
|
||||||
// do not try to set them (thus creating an infinite loop)
|
|
||||||
if (!IsInManualOrderNullFix && ChildFolders.Any(x => x.ManualOrder == null))
|
|
||||||
{
|
|
||||||
IsInManualOrderNullFix = true;
|
|
||||||
foreach (FolderInfo fi in ChildFolders.Where(x => x.ManualOrder == null))
|
|
||||||
{
|
|
||||||
using (FolderInfo parfolderinfo = FolderInfo.Get(fi.ParentID))
|
|
||||||
{
|
|
||||||
using (Folder fldr = fi.Get())
|
|
||||||
{
|
|
||||||
fldr.ManualOrder = parfolderinfo.NewManualOrder(9999);
|
|
||||||
fldr.Save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RefreshChildFolders();
|
|
||||||
IsInManualOrderNullFix = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_SortedChildFolders == null)
|
if (_SortedChildFolders == null)
|
||||||
{
|
{
|
||||||
_SortedChildFolders = new SortedBindingList<FolderInfo>(ChildFolders);
|
_SortedChildFolders = new SortedBindingList<FolderInfo>(ChildFolders);
|
||||||
@ -192,10 +166,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return _SortedChildFolders;
|
return _SortedChildFolders;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//B2025-018 Issues with folder order in tree view
|
|
||||||
//Note: this should be called from the parent item
|
|
||||||
//As you want to put this into the sorted order of the parent item
|
|
||||||
public double? NewManualOrder(int index)
|
public double? NewManualOrder(int index)
|
||||||
{
|
{
|
||||||
double? retval = 1;
|
double? retval = 1;
|
||||||
@ -204,27 +174,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
else if (index == 0)
|
else if (index == 0)
|
||||||
{
|
{
|
||||||
if (retval >= SortedChildFolders[index].ManualOrder) // If one is too big, then divide first value in half
|
if (retval >= SortedChildFolders[index].ManualOrder) // If one is too big, then divide first value in half
|
||||||
retval = SortedChildFolders[index].ManualOrder / 2.0;
|
retval = SortedChildFolders[index].ManualOrder / 2;
|
||||||
}
|
}
|
||||||
else if (SortedChildFolders.Count > index)
|
else if (SortedChildFolders.Count > index)
|
||||||
{
|
{
|
||||||
//B2025-018 Issues with folder order in tree view
|
retval += SortedChildFolders[index - 1].ManualOrder; // Just go to the next whole number
|
||||||
//filter to just items with the same parent
|
if (retval >= SortedChildFolders[index].ManualOrder)
|
||||||
//want new order to be halfway between the previous item
|
retval = (SortedChildFolders[index - 1].ManualOrder + SortedChildFolders[index].ManualOrder) / 2;
|
||||||
//and the next ManualOrder
|
|
||||||
var tmp = SortedChildFolders.Where(x => x.ParentID == FolderID);
|
|
||||||
var lbound = SortedChildFolders[index - 1].ManualOrder;
|
|
||||||
var ubound = tmp.OrderBy(y => y.ManualOrder).FirstOrDefault(x => x.ManualOrder > lbound)?.ManualOrder;
|
|
||||||
if (ubound != null)
|
|
||||||
{
|
|
||||||
retval = ((ubound - lbound) / 2.0) + lbound;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//in this case, item before is highest for that parent
|
|
||||||
//so just make this 1 more
|
|
||||||
retval = lbound + 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -769,15 +769,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
tmp.MyParent = myParent;
|
tmp.MyParent = myParent;
|
||||||
tmp.Name = name;
|
tmp.Name = name;
|
||||||
tmp.ShortName = shortName;
|
tmp.ShortName = shortName;
|
||||||
|
|
||||||
//B2025-018 Issues with folder order in tree view
|
|
||||||
//if no manual order is set, add it at the end
|
|
||||||
if (myParent != null)
|
|
||||||
{
|
|
||||||
using (FolderInfo parfolderinfo = FolderInfo.Get(myParent.FolderID))
|
|
||||||
tmp.ManualOrder = parfolderinfo.NewManualOrder(9999);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
public static Folder New(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, double? manualOrder, string config, DateTime dts, string usrID)
|
public static Folder New(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, double? manualOrder, string config, DateTime dts, string usrID)
|
||||||
@ -793,15 +784,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
tmp.Config = config;
|
tmp.Config = config;
|
||||||
tmp.DTS = dts;
|
tmp.DTS = dts;
|
||||||
tmp.UsrID = usrID;
|
tmp.UsrID = usrID;
|
||||||
|
|
||||||
//B2025-018 Issues with folder order in tree view
|
|
||||||
//if no manual order is set, add it at the end
|
|
||||||
if (myParent != null && manualOrder == null)
|
|
||||||
{
|
|
||||||
using (FolderInfo parfolderinfo = FolderInfo.Get(myParent.FolderID))
|
|
||||||
tmp.ManualOrder = parfolderinfo.NewManualOrder(9999);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, double? manualOrder, string config, DateTime dts, string usrID)
|
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, double? manualOrder, string config, DateTime dts, string usrID)
|
||||||
@ -831,15 +813,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
tmp.MyFormat = myFormat;
|
tmp.MyFormat = myFormat;
|
||||||
tmp.ManualOrder = manualOrder;
|
tmp.ManualOrder = manualOrder;
|
||||||
tmp.Config = config;
|
tmp.Config = config;
|
||||||
|
|
||||||
//B2025-018 Issues with folder order in tree view
|
|
||||||
//if no manual order is set, add it at the end
|
|
||||||
if (myParent != null && manualOrder == null)
|
|
||||||
{
|
|
||||||
using (FolderInfo parfolderinfo = FolderInfo.Get(myParent.FolderID))
|
|
||||||
tmp.ManualOrder = parfolderinfo.NewManualOrder(9999);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, double? manualOrder, string config)
|
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, double? manualOrder, string config)
|
||||||
|
@ -2812,11 +2812,8 @@ namespace Volian.Controls.Library
|
|||||||
int f2 = -1;
|
int f2 = -1;
|
||||||
string uniquename = _LastFolderInfo.MyParent.UniqueChildName("New Folder");
|
string uniquename = _LastFolderInfo.MyParent.UniqueChildName("New Folder");
|
||||||
int myindex = SelectedNode.Index + ((newtype == MenuSelections.FolderAfter) ? 1 : 0);
|
int myindex = SelectedNode.Index + ((newtype == MenuSelections.FolderAfter) ? 1 : 0);
|
||||||
//B2025-018 Issues with folder order in tree view
|
FolderInfo parfolderinfo = FolderInfo.Get(parentfolder.FolderID);
|
||||||
//since before/after folder is at same level as current folder
|
double? myorder = parfolderinfo.NewManualOrder(myindex);
|
||||||
//so need to use the parents order to determine where to place it
|
|
||||||
using (FolderInfo parfolderinfo = FolderInfo.Get(parentfolder.MyParent.FolderID))
|
|
||||||
{ double? myorder = parfolderinfo.NewManualOrder(myindex);
|
|
||||||
using (Folder folder = Folder.MakeFolder(parentfolder.MyParent, parentfolder.MyConnection, uniquename, string.Empty, "Short Name", null, myorder, string.Empty, DateTime.Now, VlnSettings.UserID))
|
using (Folder folder = Folder.MakeFolder(parentfolder.MyParent, parentfolder.MyConnection, uniquename, string.Empty, "Short Name", null, myorder, string.Empty, DateTime.Now, VlnSettings.UserID))
|
||||||
{
|
{
|
||||||
ShowBrokenRules(folder.BrokenRulesCollection);
|
ShowBrokenRules(folder.BrokenRulesCollection);
|
||||||
@ -2835,7 +2832,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
#region InsertProcedure
|
#region InsertProcedure
|
||||||
else if (newtype == MenuSelections.Procedure)
|
else if (newtype == MenuSelections.Procedure)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user