public static List <Cliente> GetListaClientesVendedores() { List <Cliente> theList = new List <Cliente>(); Cliente theData = null; try { ClienteDSTableAdapters.ClienteTableAdapter localAdapter = new ClienteDSTableAdapters.ClienteTableAdapter(); ClienteDS.ClienteDataTable table = localAdapter.GetListaClientes(); if (table != null && table.Rows.Count > 0) { foreach (var row in table) { theData = FillReccord(row); if (theData.EsVendedor) { theList.Add(theData); } } } } catch (Exception q) { throw new ArgumentException(q.Message, q); } return(theList); }
public static void UpdateCliente(Cliente theData) { try { ClienteDSTableAdapters.ClienteTableAdapter localAdapter = new ClienteDSTableAdapters.ClienteTableAdapter(); localAdapter.UpdateCliente(theData.CI, theData.NombreCompleto, theData.EsVendedor, theData.ClienteId); } catch (Exception q) { throw new ArgumentException(q.Message, q); } }
public static void DeleteCliente(int ClienteId) { try { ClienteDSTableAdapters.ClienteTableAdapter localAdapter = new ClienteDSTableAdapters.ClienteTableAdapter(); localAdapter.DeleteCliente(ClienteId); } catch (Exception q) { throw new ArgumentException(q.Message, q); } }
public static void InsertCliente(Cliente theData) { try { int?clienteId = 0; ClienteDSTableAdapters.ClienteTableAdapter localAdapter = new ClienteDSTableAdapters.ClienteTableAdapter(); localAdapter.InsertCliente(theData.CI, theData.NombreCompleto, theData.EsVendedor, ref clienteId); if (clienteId.Value <= 0) { throw new ArgumentException("Error al registrar Cliente."); } } catch (Exception q) { throw new ArgumentException(q.Message, q); } }
public static Cliente GetClienteById(int ClienteId) { Cliente theData = null; try { ClienteDSTableAdapters.ClienteTableAdapter localAdapter = new ClienteDSTableAdapters.ClienteTableAdapter(); ClienteDS.ClienteDataTable table = localAdapter.GetClienteById(ClienteId); if (table != null && table.Rows.Count > 0) { ClienteDS.ClienteRow row = table[0]; theData = FillReccord(row); } } catch (Exception q) { throw new ArgumentException(q.Message, q); } return(theData); }