HierarchyNode

StatusIDPriorityType
Open29306TrivialQuestion
ProfileReply
jsgmbhClient

how can i handle partlists with parts.
parts with or without partlists are handled.
Is there an example for this problem?

Replies

UserDescriptionPosted On
Sasha (Xafari Support)Agent

Hello,

You can see our Demo Center: Start -> Xafari Framework v... -> Demo Center... and documentation.

We hope you find this information helpful.
Feel free to contact us if you have any questions.

Best regards,
Sasha.

jsgmbhClient

Thank you for your answer, but unfortunately it doesn't exactly match our problem.

Our task is to create a tree structure managed preferably by a "data" and a relation table. So that every object can appear multiple times with different parents (m to n relation). Is there a possibility to realise that with your framework?

Sasha (Xafari Support)Agent

Hi,

For your description we can assume additional behavior: 1)one object can be assigned to the one parent several times and 2)one object can be assigned to several parents.

The first and second variants of behavior require additional code. That is, we can not configure such logic using the existing Xafari functionality and without introducing additions to the code.

Let us know if you need further assistance.
Best regards,
Sasha.

jsgmbhClient

Thank you for your reply.
Can you show us an example for this behavior?

Sasha (Xafari Support)Agent

Hello,

Please, give us additional detail about your task or schematics, because we can not decide what behavior you expect.

Thanks, Sasha.

Sasha (Xafari Support)Agent

And send us information about your buy of Xafari license to the email clientservices@galaktikasoft.com

jsgmbhClient

Please see the PartExample file.
we sent an additional email to you.

Attached files:
Sasha (Xafari Support)Agent

Thanks for the information, we are working on your issue and will get back to you as soon as we can.

Best regards,
Sasha.

Sasha (Xafari Support)Agent

Hello,

Sorry for the delay with the answer and thanks for your patience!

Unfortunately, the use of IHierarchyNode requires additional research. But I can suggest you try using the TreeList editor, maybe this editor can implement some of your ideas.

You can correct the class Part:

[DefaultClassOptions]
[NavigationItem("Parts")]
[ImageName("BO_Product")]
[ModelDefault("Caption", "Part")]
[ModelDefault("AllowEdit", "false")]
[ModelDefault("AllowDelete", "false")]
[ModelDefault("AllowNew", "false")]
[ModelDefault("DefaultListViewShowFindPanel", "True")]
[ModelDefault("DefaultListViewShowAutoFilterRow", "True")]
public class Part: XPObject, ITreeNode, ITreeNodeImageProvider
{
public Part(Session session) : base(session) { }
public override void AfterConstruction() { base.AfterConstruction(); }
string fPartName;
[ImmediatePostData]
[HierarchyNodeNameProperty()]
public string PartName
{
get { return fPartName; }
set { SetPropertyValue("PartName", ref fPartName, value); }
}
int fQTY;
public int QTY
{
get { return fQTY; }
set { SetPropertyValue("QTY", ref fQTY, value); }
}
string fPrice;
public string Price
{
get { return fPrice; }
set { SetPropertyValue("Price", ref fPrice, value); }
}
string fMemo;
[Size(SizeAttribute.Unlimited)]
public string Memo
{
get { return fMemo; }
set { SetPropertyValue("Memo", ref fMemo, value); }
}
[Association(@"PartReferencesPart")]
[ChildrenProperty]
public XPCollection PartCollection { get { return GetCollection("PartCollection"); } }
[Association(@"PartReferencesPart")]
[ParentProperty]
public XPCollection PartBelongTo { get { return GetCollection("PartBelongTo"); } }
#region ITreeNode
MembersSystem.ComponentModel.IBindingList ITreeNode.Children
{
get { return PartCollection; }
}
string ITreeNode.Name
{
get { return PartName; }
}
ITreeNode ITreeNode.Parent
{
//get { return PartBelongTo; }
get { return null; }

Image ITreeNodeImageProvider.GetImage(out string imageName)
{
imageName = "BO_User";
return ImageLoader.Instance.GetImageInfo(imageName).Image;
}
#endregion

And add ViewController for WinModule:

public partial class RefreshListViewController : ViewController<DetailView>
{
public RefreshListViewController()
{
InitializeComponent();
this.TargetObjectType = typeof(Part);
}
protected override void OnViewControlsCreated()
{
base.OnViewControlsCreated();
View.Closed += View_Closed;
}
public void View_Closed(object sender, System.EventArgs e)
{
WinShowViewStrategyBase strategy = Application.ShowViewStrategy as WinShowViewStrategyBase;
if (strategy == null) return;
foreach (WinWindow window in strategy.Windows)
{
if (window.View is ListView)
{
window.View.ObjectSpace.Refresh();
}
}
}

We hope you find this information helpful.
And we are working on your issue.

Best regards,
Sasha.