public DataTable GetTestPersonDataTable() { List <Contact> contacts = new List <Contact>() { GetTestPersonContact() }; DataTable dt = new DataTable(); dt = (DataTable)_conv.ConvertTo(null, null, contacts, typeof(DataTable)); // Wahrscheinlich besser den dt händisch zu befüllen Zwecks entkoppelung von ContactListConverter return(dt); }
public RPResult Execute(RPCall call) { List <Contact> companies = DatabaseFactory.Factory().GetCompanies(); ContactListConverter conv = new ContactListConverter(); RPResult ret = new RPResult(); ret.dt = (DataTable)conv.ConvertTo(null, null, companies, typeof(DataTable)); ret.dt.TableName = "Companies"; return(ret); }
public RPResult Execute(RPCall call) { if (call.procedureArgs == null || call.procedureArgs.Length < 1) { throw new InvalidOperationException(); } List <Contact> contacts = DatabaseFactory.Factory().SearchContacts(call.procedureArgs[0]); ContactListConverter conv = new ContactListConverter(); RPResult retVal = new RPResult(); retVal.dt = (DataTable)conv.ConvertTo(null, null, contacts, typeof(DataTable)); retVal.dt.TableName = "Contacts"; return(retVal); }
/// <summary> /// Send a Contact object to be updated or Inserted /// into the database if it does not already exist. /// </summary> /// <param name="contact">The contact to be inserted or updated</param> /// <returns> /// A RPResult object its success field determines /// wether the query was successful(1) or not(0). /// </returns> public async Task <RPResult> SendContactAsync(Contact contact) { if (contact == null) { throw new ArgumentNullException(); } RPCall call = new RPCall("CommandUpsert"); List <Contact> temp = new List <Contact>() { contact }; ContactListConverter conv = new ContactListConverter(); call.dt = (DataTable)conv.ConvertTo(null, null, temp, typeof(DataTable)); return(await _client.SendAndReceiveAsync(call)); }