![]() |
#3 |
Участник
|
Цитата:
Вот метод, который должен возвращать Цитата:
private static decimal FetchResult(Guid quantity, IOrganizationService service)
{ string value_sum = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' aggregate='true'> <entity name='new_insurance_policy'> <attribute name='erpc_payment' alias='totalamount_sum' aggregate='sum'/> <filter type='and'> <condition attribute='new_contact' operator='eq' value='{0}' /> </filter> </entity> </fetch>"; decimal TotalValue = 0; value_sum = string.Format(value_sum, quantity); EntityCollection value_sum_result = (EntityCollection)service.RetrieveMultiple(new FetchExpression(value_sum)); foreach (var c in value_sum_result.Entities) { decimal aggregate2 = (decimal)Convert.ToDecimal(((AliasedValue)c.Attributes["totalamount_sum"]).Value); TotalValue = aggregate2; } return TotalValue; } |
|
|
|