public void ShouldBeAbleToGetAccount() { SugarEntry entry = _cw.GetEntry(SugarModules.Accounts, GetAccountId()); Assert.IsNotNull(entry); Assert.IsNotEmpty(entry); Console.WriteLine(entry["name"]); }
public void DemonstarteUsingPattern() { //Calls logout when done being used via IDisposable. using (var cw = new CandyWrapper(URL, USER, PWD)) { SugarEntry entry = cw.GetEntry(SugarModules.Accounts, GetAccountId()); Assert.IsNotNull(entry); Assert.IsNotEmpty(entry); Console.WriteLine(entry["name"]); } }
public void ShouldBeAbleToAssignedUserForAccount() { SugarEntry account = _cw.GetEntry(SugarModules.Accounts, GetAccountId()); string userId = account["assigned_user_id"]; Assert.IsNotEmpty(userId); SugarEntry user = _cw.GetEntry(SugarModules.Users, userId); Assert.IsNotNull(user); Console.WriteLine(user); }
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 void ShouldBeAbleToUpdateAccount() { var random = new Random(); var randonNumber = random.Next(0, 1000); SugarEntry entry = _cw.GetEntry(SugarModules.Accounts, GetAccountId()); Assert.IsNotNull(entry); Assert.IsNotEmpty(entry); Console.WriteLine(entry["name"]); entry["employees"] = randonNumber.ToString(); var test = _cw.SetEntry(entry); Console.WriteLine(test); entry = _cw.GetEntry(SugarModules.Accounts, GetAccountId()); Assert.AreEqual(randonNumber.ToString(), entry["employees"]); }
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 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 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); }
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 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 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; }
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; }