Code Sample
Xperience
>
API Reference
>
EASSrch
>
Code Sample
SoapAction | n/a |
Input Name | EASSrch |
Output Name | EASSrchResponse |
Input Namespace | n/a |
Group Name | Xperience |
Container | XP_MsgBus.xsd |
EASSrch.cs
private void ButtonAuditSearchClick(object sender, RoutedEventArgs e)
{
var auditSearch = new EASSrchRq_MType()
{
IMSSubj = this.CurrentUserIMSSubj,
AppId = Application.ApplicationId,
AccountId = this.lastAddedAccountId,
InstEnv = "Development",
InstId = Application.ApplicationId
};
int max;
if (!int.TryParse(this.TextBoxMaxRecords.Text, out max))
{
max = 3;
}
Helper.FillHeader(auditSearch, max);
this.messageBus
.Send(auditSearch)
.RegisterResponseHandler(this.OnAuditSearchResponse);
}
private void OnAuditSearchResponse(IMessageContext context)
{
if (context.MessageErrors != null && context.MessageErrors.Count > 0)
{
foreach (var item in context.MessageErrors)
{
if (item.ErrCode.Contains("2009", true))
{
this.UpdateListbox("ERROR 2009 PLEASE ADD A VALUE OVER 0 IN THE SEARCH MAX TEXTBOX", false, true);
this.MessageError(context);
}
else
{
this.MessageError(context);
}
}
}
else
{
var response = context.DeserializeMessage();
const string Tab = " ";
var sb = new StringBuilder("AUDIT SEARCH RESPONSE");
sb.AppendLine();
sb.AppendLine();
sb.Append($"AccountId.AcctId : {response.AccountId.AcctId.Value}");
sb.AppendLine();
sb.Append($"AccountId.AcctType : {response.AccountId.AcctType.Value}");
sb.AppendLine();
sb.Append($"AppId : {response.AppId.Value}");
sb.AppendLine();
sb.Append(
$"AuditEventActn : {(response.AuditEventActn != null ? response.AuditEventActn.Value : "null")}");
sb.AppendLine();
sb.Append(
$"AuditWsId : {(response.AuditWsId != null ? response.AuditWsId.Value : "null")}");
sb.AppendLine();
sb.Append(
$"BusCorrelId : {(response.BusCorrelId != null ? response.BusCorrelId.Value : "null")}");
sb.AppendLine();
sb.Append(
$"ConsumerProd : {(response.ConsumerProd != null ? response.ConsumerProd.Value : "null")}");
sb.AppendLine();
sb.Append($"CustId : {(response.CustId != null ? response.CustId.Value : "null")}");
sb.AppendLine();
if (response.EASIdxArray != null && response.EASIdxArray.Any())
{
foreach (var item in response.EASIdxArray)
{
sb.Append($"{Tab}AuditKeyName : {item.AuditKeyName.Value}");
sb.AppendLine();
sb.Append($"{Tab}AuditKeyVal : {item.AuditKeyVal.Value}");
sb.AppendLine();
}
}
sb.Append(
$"EASItemSrchInfoRec.ItemName : {(response.EASItemSrchInfoRec != null ? response.EASItemSrchInfoRec.ItemName.Value : "null")}");
sb.AppendLine();
sb.Append(
$"EASItemSrchInfoRec.ItemVal : {(response.EASItemSrchInfoRec != null ? response.EASItemSrchInfoRec.ItemVal.Value : "null")}");
sb.AppendLine();
if (response.EASSrchArray != null && response.EASSrchArray.Any())
{
foreach (var item in response.EASSrchArray)
{
sb.Append($"{Tab}IMSSubj : {item.IMSSubj.Value}");
sb.AppendLine();
if (item.EASInfoArray != null && item.EASInfoArray.Any())
{
foreach (var info in item.EASInfoArray)
{
sb.Append(
$"{Tab}EASInfoArray.AccountId.AcctId : {info.AccountId.AcctId.Value}");
sb.AppendLine();
sb.Append(
$"{Tab}EASInfoArray.AuditEventActn : {info.AuditEventActn.Value}");
sb.AppendLine();
sb.Append(
$"{Tab}EASInfoArray.AuditEventRmk : {(info.AuditEventRmk != null ? info.AuditEventRmk.Value : "null")}");
sb.AppendLine();
sb.Append(
$"{Tab}EASInfoArray.AuditEventStat : {info.AuditEventStat.Value}");
sb.AppendLine();
sb.Append(
$"{Tab}EASInfoArray.AuditEventStatRmk : {(info.AuditEventStatRmk != null ? info.AuditEventStatRmk.Value : "null")}");
sb.AppendLine();
sb.Append($"{Tab}EASInfoArray.CustId : {info.CustId.Value}");
sb.AppendLine();
sb.Append(
$"{Tab}EASInfoArray.EASDtTime : {info.EASDtTime.Value.ToShortDateString()}");
sb.AppendLine();
foreach (var infoInfo in info.EASIdxArray)
{
sb.AppendFormat("{0}{0}AuditKeyName : {1}", Tab, infoInfo.AuditKeyName.Value);
sb.AppendLine();
sb.AppendFormat("{0}{0}AuditKeyVal : {1}", Tab, infoInfo.AuditKeyVal.Value);
sb.AppendLine();
}
if (info.EASItemArray != null && info.EASItemArray.Any())
{
foreach (var infoItem in info.EASItemArray)
{
sb.AppendFormat("{0}{0}ItemName : {1}", Tab, infoItem.ItemName.Value);
sb.AppendLine();
sb.AppendFormat("{0}{0}NewVal : {1}", Tab, infoItem.NewVal.Value);
sb.AppendLine();
sb.AppendFormat("{0}{0}OldVal : {1}", Tab, infoItem.OldVal.Value);
sb.AppendLine();
}
}
}
}
}
}
sb.Append(
$"EndDtTime : {response.EndDtTime?.Value.ToShortDateString() ?? "null"}");
sb.AppendLine();
sb.Append(
$"EventCode : {(response.EventCode != null ? response.EventCode.Value : "null")}");
sb.AppendLine();
sb.Append($"IMSSubj : {response.IMSSubj.Value}");
sb.AppendLine();
sb.Append($"InstEnv : {response.InstEnv.Value}");
sb.AppendLine();
sb.Append($"InstId : {response.InstId.Value}");
sb.AppendLine();
sb.Append(
$"StartDtTime : {response.StartDtTime?.Value.ToShortDateString() ?? "null"}");
this.UpdateListbox(sb.ToString());
}
}
Have a Question?
Have a how-to question? Seeing a weird error? Get help on
StackOverflow.
Register for the Digital Toolkit Meetup
where we answer technical Q&A from the audience.
Last updated Mon Apr 11 2022