Last active
October 9, 2018 04:09
-
-
Save smarenich/3839a2d25e7143317f6a3b1e821199d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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