Created
August 15, 2016 09:56
-
-
Save smarenich/0e0985f974d50afe91c4f2661586548f 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
internal class CompanySelectorAttribute : PXCustomSelectorAttribute | |
{ | |
public CompanySelectorAttribute() | |
: base(typeof(UPCompany.companyID)) | |
{ } | |
protected virtual IEnumerable GetRecords() | |
{ | |
return PXCompanyHelper.SelectCompanies(); | |
} | |
public override void DescriptionFieldSelecting(PXCache sender, PXFieldSelectingEventArgs e, string alias) | |
{ | |
if (e.Row == null || (sender.GetValue(e.Row, _FieldOrdinal) == null)) base.DescriptionFieldSelecting(sender, e, alias); | |
else | |
{ | |
UPCompany item = null; | |
Object value = sender.GetValue(e.Row, _FieldOrdinal); | |
Int32 key = (Int32)value; | |
foreach (UPCompany info in PXCompanyHelper.SelectCompanies()) | |
{ | |
if (info.CompanyID == key) | |
{ | |
item = info; | |
break; | |
} | |
} | |
if(item != null) e.ReturnValue = sender.Graph.Caches[_Type].GetValue(item, _DescriptionField.Name); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment