コード例 #1
0
        private void CreateEvent(string nameEvent, string uuid, Int32 timestamp, Int32 version, bool isActive)
        {
            EEvent__c event1 = new EEvent__c();

            event1.UUID__c = uuid;
            event1.Name    = nameEvent;

            event1.IsActive__cSpecified  = true;
            event1.timestamp__cSpecified = true;
            event1.Version__cSpecified   = true;
            event1.timestamp__c          = timestamp;
            event1.Version__c            = version;
            event1.IsActive__c           = isActive;

            var x = client.createAsync(header, null, null, null, null, null, null, null, null, null, null, null, new sObject[] { event1 });

            x.Wait();
            SaveResult[] createResult = x.Result.result;

            if (createResult[0].success)
            {
                string id = createResult[0].id;

                Console.WriteLine("Event:" + nameEvent + " succesfully added ");
            }
            else
            {
                string resultaat = createResult[0].errors[0].message;
                Console.WriteLine("Error, event " + nameEvent + " not added. " + Environment.NewLine + "ERROR> " + resultaat);
            }
        }
コード例 #2
0
        private void UpdateRecordEvent(string messageType, string idEvent, string nameEvent, string uuid, Int32 timestamp, Int32 version, bool isActive)
        {
            EEvent__c[] updates = new EEvent__c[1];

            EEvent__c event1 = new EEvent__c();

            event1.Id = idEvent;


            event1.UUID__c = uuid;
            event1.Name    = nameEvent;

            event1.IsActive__cSpecified  = true;
            event1.timestamp__cSpecified = true;
            event1.timestamp__c          = timestamp;
            event1.Version__c            = version;
            event1.IsActive__c           = isActive;

            updates[0] = event1;
            //event1.Id, new { event1 }
            var x = client.updateAsync(header, null, null, null, null, null, null, null, null, null, null, null, null, updates);

            x.Wait();
            //?zelfde data  doorsturen lukt niet.
            SaveResult[] createResult = x.Result.result;
            if (createResult[0].success)
            {
                string id = createResult[0].id;

                Console.WriteLine("Updated!");
            }
            else
            {
                string resultaat = createResult[0].errors[0].message;
                Console.WriteLine("ERROR> " + resultaat);
            }
        }