Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class SOARDocTypesListAttribute : PXStringListAttribute, IPXRowSelectedSubscriber
{
public Type _Module;
public class OrderTypesDefinition : IPrefetchable
{
public Dictionary<String, String> list = new Dictionary<String, String>();
public void Prefetch()
{
list.Clear();
foreach (PXDataRecord rec in PXDatabase.SelectMulti<SOOrderType>(
new PXDataField<SOOrderType.orderType>(),
new PXDataField<SOOrderType.descr>()))
{
list[rec.GetString(0)] = rec.GetString(1);
}
}
}
public SOARDocTypesListAttribute(Type module)
: base()
{
_Module = module;
}
public void RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
Object row = e.Row as Object;
String module = (String)sender.GetValue(row, _Module.Name);
if (row != null && module != null)
{
if (module == arModule.value)
{
PXStringListAttribute.SetList(sender, row, _FieldName, new ARDocType.ListAttribute());
}
if (module == soModule.value)
{
OrderTypesDefinition def = PXDatabase.GetSlot<OrderTypesDefinition>(typeof(OrderTypesDefinition).Name, typeof(SOOrderType));
PXStringListAttribute.SetList(sender, row, _FieldName, def.list.Keys.ToArray(), def.list.Values.ToArray());
}
}
}
}
#endregion
[Serializable]
public class DAC : IBqlTable
{
#region DocType
[PXDBString(3, IsKey = true, IsFixed = false)]
[PXUIField(DisplayName = "Doc Type", Enabled = false)]
[SOARDocTypesListAttribute(typeof(DAC.module))]
public string DocType { get; set; }
public class docType : IBqlField { }
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.