Esempio n. 1
0
    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);
    }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
    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);
        }
    }
Esempio n. 5
0
    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);
    }