Exemplo n.º 1
0
        public List <Cliente> ObtenerCliente()
        {
            ConexionDataAccess dac        = new ConexionDataAccess();
            List <Cliente>     personas   = new List <Cliente>();
            ArrayList          parametros = new ArrayList();

            try
            {
                DataSet ds = dac.Fill("spSelCliente", parametros);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        personas.Add(new Cliente()
                        {
                            ClienteId       = Int32.Parse(row["ClienteId"].ToString()),
                            Nombre          = row["Nombre"].ToString(),
                            ApellidoPaterno = row["ApellidoPaterno"].ToString(),
                            ApellidoMaterno = row["ApellidoMaterno"].ToString(),
                            Telefono        = row["Telefono"].ToString(),
                            Email           = row["Email"].ToString()
                        });
                    }
                }

                return(personas);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 2
0
        public bool EliminarCliente(int p_ClienteId)
        {
            ConexionDataAccess dac        = new ConexionDataAccess();
            ArrayList          parametros = null;

            try
            {
                parametros = new ArrayList();
                parametros.Add(new SqlParameter {
                    ParameterName = "@ClienteId", SqlDbType = SqlDbType.Int, Value = p_ClienteId
                });
                dac.ExecuteNonQuery("spDelCliente", parametros);
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 3
0
        public bool GuardarCliente(Cliente cliente)
        {
            ConexionDataAccess dac        = new ConexionDataAccess();
            ArrayList          parametros = null;

            try
            {
                if (cliente != null)
                {
                    parametros = new ArrayList();

                    //PARAMETROS DE ENTRADA
                    parametros.Add(new SqlParameter {
                        ParameterName = "@Nombre", SqlDbType = SqlDbType.VarChar, Value = cliente.Nombre
                    });
                    parametros.Add(new SqlParameter {
                        ParameterName = "@ApellidoPaterno", SqlDbType = SqlDbType.VarChar, Value = cliente.ApellidoPaterno
                    });
                    parametros.Add(new SqlParameter {
                        ParameterName = "@ApellidoMaterno", SqlDbType = SqlDbType.VarChar, Value = cliente.ApellidoMaterno
                    });
                    parametros.Add(new SqlParameter {
                        ParameterName = "@Telefono", SqlDbType = SqlDbType.VarChar, Value = cliente.Telefono
                    });
                    parametros.Add(new SqlParameter {
                        ParameterName = "@Email", SqlDbType = SqlDbType.VarChar, Value = cliente.Email
                    });

                    dac.ExecuteNonQuery("spInsCliente", parametros);
                }

                return(true);
            }
            catch (Exception e)
            {
                throw e;
            }
        }