public List <ClientesBO> GetAllFiltro([FromBody] eCliente pCliente) { try { if (pCliente.nombre == null && pCliente.nit != "") { var filtro = " WHERE nit LIKE " + "'" + "%" + pCliente.nit + "%" + "'"; List <ClientesBO> lCliente = ClientesBO.GetAllFiltro(pConnection, filtro); return(lCliente); } if (pCliente.nit == null && pCliente.nombre != "") { var filtro = " WHERE nombre LIKE " + "'" + "%" + pCliente.nombre + "%" + "'"; List <ClientesBO> lCliente = ClientesBO.GetAllFiltro(pConnection, filtro); return(lCliente); } else { return(null); } } catch { return(null); } }
protected void Page_Load(object sender, EventArgs e) { obj = new ClientesBO(); objdao = new ClientesDAO(); if (!Page.IsPostBack) { Facade("Select"); } }
public int Delete(ClientesBO obj) { string delete = "delete from Clientes where idCliente = @idCliente"; SqlCommand cmd = new SqlCommand(delete, conn); cmd.Parameters.Add(new SqlParameter("@idCliente", SqlDbType.Int)).Value = obj.idCliente; return(EjecutarSQL(cmd)); }
public int Agregar(ClientesBO Cliente) { SqlCommand sqlCommand = new SqlCommand("INSERT INTO Clientes VALUES(@nombre, @apellido,@telefono)"); sqlCommand.Parameters.Add("@nombre", SqlDbType.VarChar).Value = Cliente.Nombre; sqlCommand.Parameters.Add("@apellido", SqlDbType.VarChar).Value = Cliente.Apellido; sqlCommand.Parameters.Add("@telefono", SqlDbType.VarChar).Value = Cliente.Telefono; return(Conexion.EjecutarComando(sqlCommand)); }
public int Modificar(ClientesBO Cliente) { SqlCommand sqlCommand = new SqlCommand("UPDATE Clientes SET Nombre = @nombre, Apellido = @apellido, Telefono = @telefono where idCliente = @id"); sqlCommand.Parameters.Add("@id", SqlDbType.VarChar).Value = Cliente.CodigoCliente; sqlCommand.Parameters.Add("@nombre", SqlDbType.VarChar).Value = Cliente.Nombre; sqlCommand.Parameters.Add("@apellido", SqlDbType.VarChar).Value = Cliente.Apellido; sqlCommand.Parameters.Add("@telefono", SqlDbType.VarChar).Value = Cliente.Telefono; return(Conexion.EjecutarComando(sqlCommand)); }
public void Eliminar() { ClientesBO cl = InterfaceToData(); if (cl.idCliente > 0) { objdao.Delete(cl); Facade("Select"); } }
public int Eliminar(ClientesBO Cliente) { Conexion.EjecutarComando(new SqlCommand("DELETE FROM Simulaciones where idCliente1='" + Cliente.CodigoCliente + "'")); SqlCommand sqlCommand = new SqlCommand("DELETE FROM Clientes where idCliente = @id"); sqlCommand.Parameters.Add("@id", SqlDbType.VarChar).Value = Cliente.CodigoCliente; sqlCommand.Parameters.Add("@nombre", SqlDbType.VarChar).Value = Cliente.Nombre; sqlCommand.Parameters.Add("@apellido", SqlDbType.VarChar).Value = Cliente.Apellido; sqlCommand.Parameters.Add("@telefono", SqlDbType.VarChar).Value = Cliente.Telefono; return(Conexion.EjecutarComando(sqlCommand)); }
public void Modificar() { ClientesBO cl = InterfaceToData(); if (cl.idCliente != 0) { objdao.Update(cl); } Facade("Select"); Facade("limpiarDatos"); }
public void Guardar() { ClientesBO cl = InterfaceToData(); if (cl.idCliente == 0) { objdao.Insert(cl); } Facade("Select"); Facade("limpiarDatos"); }
public IHttpActionResult DeleteCliente(int id) { try { ClientesBO cliente = new ClientesBO(pConnection, id); cliente.Delete(pConnection); return(Ok()); } catch (Exception e) { return(InternalServerError(e)); } }
protected void Page_Load(object sender, EventArgs e) { oDiscoBO = new DiscosBO(); oDiscoDAO = new DiscosDAO(); oClienteBO = new ClientesBO(); if (Session["Usuario"] != null) { Response.Write(Session["Usuario"].ToString()); oClienteBO.idCliente = Convert.ToInt32(Session["Usuario"]); } FacadeMth("Listar"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["Usuario"] != null) { int idCliente = Convert.ToInt32(Session["Usuario"]); DataTable dt; ClientesBO oClienteBO = new ClientesBO(); ClientesDAO oClienteDAO = new ClientesDAO(); oClienteBO.idCliente = idCliente; dt = oClienteDAO.Select(); txtUser.Text = dt.Rows[0]["Nombre"].ToString(); txtEmail.Text = dt.Rows[0]["CorreoElectronico"].ToString(); lbtnSalir.Visible = true; } }
public IHttpActionResult AddCliente([FromBody] eCliente pCliente) { try { ClientesBO lClientes = new ClientesBO(); lClientes.apellido = pCliente.apellido; lClientes.nombre = pCliente.nombre; lClientes.nit = pCliente.nit; lClientes.Save(pConnection); return(Ok()); } catch (Exception e) { return(InternalServerError(e)); } }
public int Insert(ClientesBO obj) { string insert = "insert into Clientes(Nombre,Ciudad,CorreoElectronico,Password) values(@Nombre,@Ciudad,@CorreoElectronico,@Password)"; SqlCommand cmd = new SqlCommand(insert, conn); cmd.Parameters.Add(new SqlParameter("@Nombre", SqlDbType.NVarChar)); cmd.Parameters.Add(new SqlParameter("@Ciudad", SqlDbType.NVarChar)); cmd.Parameters.Add(new SqlParameter("@CorreoElectronico", SqlDbType.NVarChar)); cmd.Parameters.Add(new SqlParameter("@Password", SqlDbType.NVarChar)); cmd.Parameters["@Nombre"].Value = obj.Nombre; cmd.Parameters["@Ciudad"].Value = obj.Ciudad; cmd.Parameters["@CorreoElectronico"].Value = obj.CorreoElectronico; cmd.Parameters["@Password"].Value = obj.Password; return(EjecutarSQL(cmd)); }
public int Update(ClientesBO obj) { string update = "update Clientes set Nombre = @Nombre, Ciudad = @Ciudad, CorreoElectronico = @CorreoElectronico, Password = @Password where idCliente = @idCliente"; SqlCommand cmd = new SqlCommand(update, conn); cmd.Parameters.Add(new SqlParameter("@Nombre", SqlDbType.NVarChar)); cmd.Parameters.Add(new SqlParameter("@Ciudad", SqlDbType.NVarChar)); cmd.Parameters.Add(new SqlParameter("@CorreoElectronico", SqlDbType.NVarChar)); cmd.Parameters.Add(new SqlParameter("@Password", SqlDbType.NVarChar)); cmd.Parameters.Add(new SqlParameter("@idCliente", SqlDbType.Int)); cmd.Parameters["@Nombre"].Value = obj.Nombre; cmd.Parameters["@Ciudad"].Value = obj.Ciudad; cmd.Parameters["@CorreoElectronico"].Value = obj.CorreoElectronico; cmd.Parameters["@Password"].Value = obj.Password; cmd.Parameters["@idCliente"].Value = obj.idCliente; return(EjecutarSQL(cmd)); }
public ClientesBO BuscarCliente(int id) { ClientesBO Cliente = new ClientesBO(); SqlCommand Comando = new SqlCommand("Select * from Clientes where idCliente='" + id + "'"); SqlDataReader Reader; Comando.Connection = Conexion.ConectarBD(); Conexion.Abrir(); Reader = Comando.ExecuteReader(); if (Reader.Read()) { Cliente.CodigoCliente = int.Parse(Reader[0].ToString()); Cliente.Nombre = Reader[1].ToString(); Cliente.Apellido = Reader[2].ToString(); Cliente.Telefono = Reader[3].ToString(); } Conexion.Cerrar(); return(Cliente); }
public List <ClientesBO> ListaNombreClientes() { List <ClientesBO> Lista = new List <ClientesBO>(); SqlCommand Comando = new SqlCommand("Select * from Clientes"); SqlDataReader Reader; Comando.Connection = Conexion.ConectarBD(); Conexion.Abrir(); Reader = Comando.ExecuteReader(); while (Reader.Read()) { ClientesBO Cliente = new ClientesBO(); Cliente.CodigoCliente = int.Parse(Reader[0].ToString()); Cliente.Nombre = Reader[1].ToString(); Lista.Add(Cliente); } Conexion.Cerrar(); return(Lista); }
public List <ClientesBO> GetAll() { List <ClientesBO> lClientes = ClientesBO.GetAll(pConnection); return(lClientes); }
public ActionResult Guardar(ClientesBO Cliente) { int res = Cliente.CodigoCliente > 1 ? Clientes.Modificar(Cliente) : Clientes.Agregar(Cliente); return(RedirectToAction("Index")); }
public void GenerarPDF(int id, string ruta) { FileStream PFD = new FileStream(ruta, FileMode.Create); //Instancia de la clase clientes DAO para poder buscar al cliente que hace el prestamo ClientesDAO clientes = new ClientesDAO(); //Buscamos el registro de la simulacion SimulacionBO simulacion = BuscarSimulacion(id); //Buscamos el cliente al que se le hizo la simulacion ClientesBO cliente = clientes.BuscarCliente(simulacion.CodigoCliente); //Creamos un nuevo documento de ITextSharp y le pasamos como parametro que queremos que sea de tamaño carta Document Reporte = new Document(PageSize.LETTER); PdfWriter Writer = PdfWriter.GetInstance(Reporte, PFD); //Agregamos un titulo Reporte.AddTitle("Simulacion Prestamo " + simulacion.CodigoPrestamo); //Agregarmos Al creador del documento Reporte.AddCreator("PrestamosUTM"); //Y lo abrimos para editar Reporte.Open(); //Intanciamos la fuente que tendra nuestro documento Font Fuente = new Font(Font.FontFamily.HELVETICA, 12, Font.NORMAL, BaseColor.BLACK); //Agregamos un parrafo nuevo para que sea nuestra cabecera Reporte.Add(new Paragraph("Simulacion de prestamo N." + simulacion.CodigoPrestamo)); Reporte.Add(Chunk.NEWLINE); //Hacemos lo mismp para los datos del cliente Reporte.Add(new Paragraph("Numero de cliente: " + cliente.CodigoCliente + "\nCliente: " + cliente.Nombre + " " + cliente.Apellido)); Reporte.Add(Chunk.NEWLINE); //Creamos una nueva tabla y le pasamos como parametro el numero de columnas PdfPTable tablaPrestamo = new PdfPTable(6); tablaPrestamo.WidthPercentage = 100; //Configuaramos el titulo de las columnas PdfPCell CellNumeroPago = new PdfPCell(new Phrase("No. Pago", Fuente)); CellNumeroPago.BorderWidth = 0; CellNumeroPago.BorderWidthBottom = 0.75f; PdfPCell CellFecha = new PdfPCell(new Phrase("Fecha", Fuente)); CellFecha.BorderWidth = 0; CellFecha.BorderWidthBottom = 0.75f; PdfPCell CellPrincial = new PdfPCell(new Phrase("Principal", Fuente)); CellPrincial.BorderWidth = 0; CellPrincial.BorderWidthBottom = 0.75f; PdfPCell CellInteres = new PdfPCell(new Phrase("Interés", Fuente)); CellInteres.BorderWidth = 0; CellInteres.BorderWidthBottom = 0.75f; PdfPCell CellIVA = new PdfPCell(new Phrase("IVA(16%)", Fuente)); CellIVA.BorderWidth = 0; CellIVA.BorderWidthBottom = 0.75f; PdfPCell CellPago = new PdfPCell(new Phrase("Pago Total", Fuente)); CellPago.BorderWidth = 0; CellPago.BorderWidthBottom = 0.75f; //Agregamos las celdas a la tabla tablaPrestamo.AddCell(CellNumeroPago); tablaPrestamo.AddCell(CellFecha); tablaPrestamo.AddCell(CellPrincial); tablaPrestamo.AddCell(CellInteres); tablaPrestamo.AddCell(CellIVA); tablaPrestamo.AddCell(CellPago); //Pasamos el total a una variable double Monto = simulacion.Monto; DateTime Fecha = simulacion.FechaIncio; for (int i = simulacion.PlazoPago, j = 1; i > 0; i--, j++) { //calculamos los datos que se va a usar double InteresMensual = Monto * simulacion.TazaInteres; double IVA = (Monto + InteresMensual) * .16; double TotalPago = (Monto + InteresMensual + IVA) / i; CellNumeroPago = new PdfPCell(new Phrase(j.ToString(), Fuente)); CellNumeroPago.BorderWidth = 1; CellFecha = new PdfPCell(new Phrase(Fecha.ToShortDateString(), Fuente)); CellFecha.BorderWidth = 1; CellPrincial = new PdfPCell(new Phrase(Math.Round(Monto, 2).ToString(), Fuente)); CellPrincial.BorderWidth = 1; CellInteres = new PdfPCell(new Phrase(Math.Round(InteresMensual, 2).ToString(), Fuente)); CellInteres.BorderWidth = 1; CellIVA = new PdfPCell(new Phrase(Math.Round(IVA, 2).ToString(), Fuente)); CellIVA.BorderWidth = 1; CellPago = new PdfPCell(new Phrase(Math.Round(TotalPago, 2).ToString(), Fuente)); CellPago.BorderWidth = 1; //Añadimos las celdas a la tabla tablaPrestamo.AddCell(CellNumeroPago); tablaPrestamo.AddCell(CellFecha); tablaPrestamo.AddCell(CellPrincial); tablaPrestamo.AddCell(CellInteres); tablaPrestamo.AddCell(CellIVA); tablaPrestamo.AddCell(CellPago); Monto = Monto - TotalPago; Fecha = Fecha.AddMonths(1); } Reporte.Add(tablaPrestamo); Reporte.Close(); PFD.Close(); Writer.Close(); }
public ActionResult Editar(int id = 0) { ClientesBO ObjDev = (id == 0) ? (new ClientesBO()) : (Clientes.BuscarCliente(id)); return(View(ObjDev)); }
public int agregar_cliente(ClientesBO objclientebo) { int id = objConectar.EjecutarComando("insert into Cliente (Nombres,Apellido_Paterno,Apellido_Materno,Fecha_Nacimiento,Imagen,Email,Contrasenia,Ciudad_id,Zona_id,Estado_id,Direccion_especifica) values('" + objclientebo.Nombres1 + "','" + objclientebo.ApellidoP1 + "','" + objclientebo.ApellidoM1 + "','" + objclientebo.Email + "','" + objclientebo.Email + "'," + objclientebo.IdCiudad + "," + objclientebo.IdZona + "," + objclientebo.IdEstado + ",'" + objclientebo.Direccion + "')"); return(id); }
public ClientesBO GetById(int id) { ClientesBO lCliente = new ClientesBO(pConnection, id); return(lCliente); }