SIPSorcery.CRM.SugarCRM.SugarHelper.GetContacts C# (CSharp) Метод

GetContacts() публичный Метод

public GetContacts ( string SessionId, sugarsoapPortTypeClient SugarSoap, string Query, string OrderBy, int Offset, int MaxResults, bool GetDeleted ) : get_entry_list_result
SessionId string
SugarSoap sugarsoapPortTypeClient
Query string
OrderBy string
Offset int
MaxResults int
GetDeleted bool
Результат get_entry_list_result
        public get_entry_list_result GetContacts(string SessionId, sugarsoapPortTypeClient SugarSoap,
            string Query, string OrderBy, int Offset, int MaxResults, bool GetDeleted)
        {
            string[] fields = new string[]{ "phone_work" };

            //Get a list of entries
            get_entry_list_result contactsList = this.sugarClient.get_entry_list(this.sessionId, "Contacts",
                Query, OrderBy, Offset, fields, MaxResults, Convert.ToInt32(GetDeleted));

            return contactsList;
        }

Usage Example

        public void GetContactsForPhoneNumberUnitTest()
        {
            //Create a new instance of the helper class
            SugarHelper helper = new SugarHelper();

            //Authenticate
            if (helper.Authenticate(m_username, m_password))
            {
                //Get the meetings
                string query = "contacts.phone_work like '%99663311%'";
                //string query = String.Format("SELECT CONCAT(first_name,' ',last_name) AS name FROM contacts WHERE (phone_home LIKE '{0}' OR phone_mobile LIKE '{0}' OR phone_work LIKE '{0}' OR phone_other LIKE '{0}')", "99663311");
                //string query = String.Format("SELECT id FROM contacts WHERE (phone_home = '{0}' OR phone_mobile = '{0}' OR phone_work LIKE '{0}' OR phone_other = '{0}')", "99663311");
                Console.WriteLine(query);
                var contacts = helper.GetContacts("", null, query, "", 0, 100, false);
                Console.WriteLine("Contacts count=" + contacts.result_count + ".");

                foreach (var contact in contacts.entry_list)
                {
                    foreach (var field in contact.name_value_list)
                    {
                        //Console.WriteLine(contact.name_value_list[0] + " " + contact.name_value_list[1]);
                        Console.WriteLine(field.name + ": " + field.value);
                    }
                }
            }
        }
All Usage Examples Of SIPSorcery.CRM.SugarCRM.SugarHelper::GetContacts