예제 #1
0
        private void UpdateTranslation(Entity sourceItem, Entity targetItem)
        {
            Entity targetUpdate = new Entity(targetItem.LogicalName, targetItem.Id);

            targetUpdate["etel_message"] = sourceItem.Attributes["etel_message"].ToString();

            using (var service = new DynamicsService(CredentialType.MasterDev))
            {
                service.Update(targetUpdate);
            }
        }
예제 #2
0
 private void CreateOrUpdate(Entity sourceItem)
 {
     try
     {
         using (var service = new DynamicsService(CredentialType.MasterDev))
         {
             service.Create(sourceItem);
         }
     }
     catch (Exception)
     {
         using (var service = new DynamicsService(CredentialType.MasterDev))
         {
             service.UpdateTranslation(sourceItem);
         }
     }
 }
예제 #3
0
        private TranslationStack GetSourceTranslationList()
        {
            using (var service = new DynamicsService(CredentialType.Dev))
            {
                var query            = service.CreateQueryWithLastDays(LanguageCode.English, 10);
                var entityCollection = service.Execute(query);

                var querySpanish            = service.CreateQueryWithLastDays(LanguageCode.Spanish, 10);
                var entityCollectionSpanish = service.Execute(querySpanish);

                return(new TranslationStack
                {
                    TranslationEnglish = entityCollection,
                    TranslationSpanish = entityCollectionSpanish
                });
            };
        }