![]() |
#5 |
CRM
|
Согласен с IgorF
У вас долюна быть связка "Главный объект" (типа Заказ) - "Дочерний объект" (Продукты). Чтобы выбрать все продукты данного заказа пишешь Query (пример из SDK): X++: // Set up the CRM Service. CrmService service = new CrmService(); service.Credentials = System.Net.CredentialCache.DefaultCredentials; // Create the ColumnSet that indicates the fields to be retrieved. ColumnSet cols = new ColumnSet(); // Set the properties of the ColumnSet. cols.Attributes = new string [] {"название", "цена"}; // Create the ConditionExpression. ConditionExpression condition = new ConditionExpression(); // Set the condition for the retrieval to be when the city in the contact's address is Sammamish. condition.AttributeName = "заказId"; condition.Operator = ConditionOperator.Equal; condition.Values = new string [] {"id нужного заказа"}; // Create the FilterExpression. FilterExpression filter = new FilterExpression(); // Set the properties of the filter. filter.FilterOperator = LogicalOperator.And; filter.Conditions = new ConditionExpression[] {condition}; // Create the QueryExpression object. QueryExpression query = new QueryExpression(); // Set the properties of the QueryExpression object. query.EntityName = EntityName.contact.ToString(); query.ColumnSet = cols; query.Criteria = filter; // Retrieve the contacts. BusinessEntityCollection contacts = service.RetrieveMultiple(query); ![]() Найдя все товары данного заказа, проходишь их в цикле. А потом делаешь service.Update(заказ). Где-то так. |
|