コード例 #1
0
ファイル: SoqlDemo.cs プロジェクト: jayonsoftware/apexsharp
        /**
         * A simple CRUD Example
         */
        public static void CrudExample()
        {
            Contact contactNew = new Contact {
                LastName = "Jay", EMail = "*****@*****.**"
            };

            Soql.insert(contactNew);
            System.debug(contactNew.Id);
            List <Contact> contacts = Soql.query <Contact>("SELECT Id, Email FROM Contact WHERE Id = :contactNew.Id", contactNew.Id);

            foreach (Contact c in contacts)
            {
                System.debug(c.Email);
                c.Email = "*****@*****.**";
            }

            Soql.update(contacts);
            contacts = Soql.query <Contact>("SELECT Id, Email FROM Contact WHERE Id = :contactNew.Id", contactNew.Id);
            foreach (Contact c in contacts)
            {
                System.debug(c.Email);
            }

            Soql.delete(contacts);
            contacts = Soql.query <Contact>("SELECT Id, Email FROM Contact WHERE Id = :contactNew.Id", contactNew.Id);
            if (contacts.isEmpty())
            {
                System.debug("Delete Worked");
            }
        }
コード例 #2
0
ファイル: SoqlDemo_CSharp.cs プロジェクト: yallie/ApexParser
        /**
         * A simple CRUD Example
         */
        public static void CrudExample()
        {
            // Contact contactNew = new Contact(LastName = 'Jay', Email = '*****@*****.**');
            Contact contactNew = new Contact();

            Soql.insert(contactNew);
            System.Debug(contactNew.Id);
            List <Contact> contacts = Soql.query <Contact>(@"SELECT Id, Email FROM Contact WHERE Id = :contactNew.Id", contactNew.Id);

            foreach (Contact c in contacts)
            {
                System.Debug(c.Email);
                c.Email = "*****@*****.**";
            }

            Soql.update(contacts);
            contacts = Soql.query <Contact>(@"SELECT Id, Email FROM Contact WHERE Id = :contactNew.Id", contactNew.Id);
            foreach (Contact c in contacts)
            {
                System.Debug(c.Email);
            }

            Soql.delete(contacts);
            contacts = Soql.query <Contact>(@"SELECT Id, Email FROM Contact WHERE Id = :contactNew.Id", contactNew.Id);
            if (contacts.IsEmpty())
            {
                System.Debug("Delete Worked");
            }
        }
コード例 #3
0
 public static void updateContacts(List <Contact> contacts)
 {
     Soql.update(contacts);
 }
コード例 #4
0
 private static void UpdateContacts(List <Contact> contacts)
 {
     Soql.update(contacts);
 }