|
![]() |
#1 |
Участник
|
Цитата:
2. Написать плагин, который будет при создании/обновлении сущности анализировать равны ли поля и обновлять битовое поле, созданное на шаге 1.
Я щас через Fetch запрос запрашиваю сначала поле1 потом поле2 а далее не знаю что делать). |
|
![]() |
#2 |
Чайный пьяница
|
Код покажите, пожалуйста.
__________________
Эмо разработчик, сначала пишу код, потом плачу над его несовершенством. Подписывайтесь на мой блог, twitter и YouTube канал. Пользуйтесь моим Ultimate Workflow Toolkit |
|
![]() |
#3 |
Участник
|
X++: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel.Description; using System.Net; using Microsoft.Xrm.Sdk.Client; using Microsoft.Xrm.Sdk; namespace ViewsConsole { class Program { static void Main(string[] args) { // string ms = "Bob Train"; ClientCredentials Credentials = new ClientCredentials(); Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials; //This URL needs to be updated to match the servername and Organization for the environment. Uri OrganizationUri = new Uri("http://192.168.55.71:5555/dfnts/XRMServices/2011/Organization.svc"); Uri HomeRealmUri = null; using (Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy serviceProxy = new Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, null)) { serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior()); IOrganizationService service = (IOrganizationService)serviceProxy; //fetch example string contactt = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'> <entity name='account'> <attribute name='name' /> <attribute name='primarycontactid' /> <attribute name='telephone1' /> <attribute name='accountid' /> <order attribute='name' descending='false' /> <filter type='and'> <condition attribute='name' operator='not-null' /> </filter> </entity> </fetch>"; string fontac = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'> <entity name='account'> <attribute name='name' /> <attribute name='primarycontactid' /> <attribute name='telephone1' /> <attribute name='accountid' /> <order attribute='name' descending='false' /> <filter type='and'> <condition attribute='accountnumber' operator='not-null' /> </filter> </entity> </fetch>"; EntityCollection result = service.RetrieveMultiple(new Microsoft.Xrm.Sdk.Query.FetchExpression(contactt)); EntityCollection fesuld = service.RetrieveMultiple(new Microsoft.Xrm.Sdk.Query.FetchExpression(fontac)); foreach (var c in result.Entities) { Console.WriteLine("----------"); System.Console.WriteLine(c.Attributes["name"]); } foreach (var s in fesuld.Entities) System.Console.WriteLine(s.Attributes["name"]); Console.ReadLine(); //end fetch example} // if (contactt == fontac) Console.WriteLine("KRUTO"); //else Console.WriteLine("NeKruto"); //This code will clear the textboxes after the contact is created. } } } } |
|
![]() |
#4 |
Участник
|
Ваш код запрашивает один и тот же набор полей: name, primarycontactid, telephone1, accountid.
Только для первой выборки у вас условие, что поле name не пустое, а для второй, что поле accountnumber не пустое. При это ваш запрос поле accountnumber не вернет вообще. Не очень понятно, что вообще должна была делать эта программа. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|