Example #1
0
        public SugarHelper()
        {
            //Create a new instance of the client proxy
            this.sugarClient = new sugarsoapPortTypeClient(new BasicHttpBinding(), new EndpointAddress("http://crm.sipsorcery.com/soap.php"));

            //Set the default value
            this.sessionId = String.Empty;
        }
Example #2
0
        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;
        }
Example #3
0
        public DataTable GetMeetings(string SessionId, sugarsoapPortTypeClient SugarSoap,
            string Query, string OrderBy, int Offset, int MaxResults, bool GetDeleted)
        {
            //Define the array
            string[] fields = new string[14];

            //Fill the array
            fields[0] = "id";
            fields[1] = "date_entered";
            fields[2] = "date_modified";
            fields[3] = "assigned_user";
            fields[4] = "modified_user";
            fields[5] = "created_by";
            fields[6] = "name";
            fields[7] = "location";
            fields[8] = "duration_hours";
            fields[9] = "duration_minutes";
            fields[10] = "date_start";
            fields[11] = "date_end";
            fields[12] = "status";
            fields[13] = "description";

            //Create a DataTable
            DataTable meetings = new DataTable("MEETINGS");

            //Define the Columns
            foreach (string field in fields)
            {
                meetings.Columns.Add(field);
            }

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

            //Loop trough the entries
            foreach (entry_value entry in entryList.entry_list)
            {
                //Create a new DataRow
                DataRow meeting = meetings.NewRow();

                //Loop trough the columns
                foreach (name_value value in entry.name_value_list)
                {
                    meeting[value.name] = value.value;
                }

                //Add the DataRow to the DataTable
                meetings.Rows.Add(meeting);
            }

            return meetings;
        }