private string Login(string user, string pass, string version, string appName) { var auth = new user_auth(); set_entry_result result; string str = GetMD5Hash(pass); string id; auth.user_name = user; auth.password = str; auth.version = version; result = _sugarsoap.login(auth, appName); VerifySugarResult.Verify(result.error); return(result.id); }
public SugarEntry GetEntry(string module, string id, string[] fields) { module = ConvertToProper(module); get_entry_result result = _sugarsoap.get_entry(_session, module, id, fields); VerifySugarResult.Verify(result.error); var entry = new SugarEntry(module); name_value[] valueList = result.entry_list[0].name_value_list; foreach (name_value value in valueList) { entry.Add(value.name, value.value); } return(entry); }
public string SetEntry(SugarEntry entry) { var valueArray = new name_value[entry.Count]; int i = 0; foreach (var sugarEntry in entry) { valueArray[i] = new name_value(); valueArray[i].name = sugarEntry.Key; valueArray[i].value = sugarEntry.Value; i++; } set_entry_result result = _sugarsoap.set_entry(_session, entry.Module, valueArray); VerifySugarResult.Verify(result.error); return(result.id); }
public string[] GetRelationships(string module, string id, string sRelMod, string sRelModQuery, int deleted) { module = ConvertToProper(module); get_relationships_result result = _sugarsoap.get_relationships(_session, module, id, sRelMod, sRelModQuery, deleted); VerifySugarResult.Verify(result.error); id_mod[] ids = result.ids; var strArray2 = new string[ids.Length]; int index = 0; foreach (id_mod mod in ids) { strArray2[index] = mod.id; index++; } return(strArray2); }
public List <SugarEntry> SearchByModule(string search, string[] modules, int offset, int limit) { var result = _sugarsoap.search_by_module(_username, this.GetMD5Hash(_password), search, modules, offset, limit); VerifySugarResult.Verify(result.error); var entryList = new List <SugarEntry>(); entry_value[] valueList1 = result.entry_list; foreach (entry_value value1 in valueList1) { name_value[] valueList2 = value1.name_value_list; var entry = new SugarEntry(value1.module_name); foreach (name_value value2 in valueList2) { entry.Add(value2.name, value2.value); } entryList.Add(entry); } return(entryList); }
public string[] GetAvailableModules() { module_list list = _sugarsoap.get_available_modules(_session); error_value error = list.error; VerifySugarResult.Verify(error); int length = 1; if (list.modules.Length > 0) { length = list.modules.Length; } var strArray = new string[length]; int index = 0; foreach (string str in list.modules) { strArray[index] = str; index++; } return(strArray); }
public List <SugarEntry> GetEntryList(string module, string query, string order, int offset, string[] fields, int limit, int del) { module = ConvertToProper(module); get_entry_list_result result = _sugarsoap.get_entry_list(_session, module, query, order, offset, fields, limit, del); VerifySugarResult.Verify(result.error); var entryList = new List <SugarEntry>(); entry_value[] valueList1 = result.entry_list; foreach (entry_value value1 in valueList1) { name_value[] valueList2 = value1.name_value_list; var entry = new SugarEntry(module); foreach (name_value value2 in valueList2) { entry.Add(value2.name, value2.value); } entryList.Add(entry); } return(entryList); }