protected void ButtonGuardar_Click(object sender, EventArgs e) { if (Page.IsValid) { RepositorioFactura rb = new RepositorioFactura();; int id = 0; if (ComprobarID(id) == 0) { if (rb.Guardar(LlenaClase())) { ScriptManager.RegisterStartupScript(this, typeof(Page), "toastr_message", script: "toastr['success']('Facturas Guardada');", addScriptTags: true); ClearAll(); total = 0; } } else { if (rb.Modificar(LlenaClase())) { ScriptManager.RegisterStartupScript(this, typeof(Page), "toastr_message", script: "toastr['success']('Factura Modificada');", addScriptTags: true); } ClearAll(); } } }
private void Eliminarbutton_Click(object sender, EventArgs e) { if (EsAdmin() == false) { MessageBox.Show("No tienes permiso para eliminar Facturas.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } int ID = Convert.ToInt32(IDnumericUpDown.Value); bool paso; RepositorioFactura repositorio = new RepositorioFactura(); if (!Existe()) { MessageBox.Show("No se puede eliminar porque no existe.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var resultado = MessageBox.Show("De eliminar esta Factura perdera información importante importante." + " Desea Continuar?", "ButterSoft", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultado == DialogResult.Yes) { paso = repositorio.Eliminar(ID); if (paso) { Limpiar(); MessageBox.Show("Factura eliminada!!", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo eliminar la Factura", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void Eliminarbutton_Click(object sender, EventArgs e) { int id = Convert.ToInt32(IdnumericUpDown.Value); RepositorioBase <Factura> repositorio = new RepositorioBase <Factura>(); Factura factura = repositorio.Buscar(id); if (factura != null) { if (factura.TipoPago == "Contado") { if (repositorio.Eliminar(id)) { MessageBox.Show("Eliminado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } } else if (factura.TipoPago == "Credito") { RepositorioFactura repo = new RepositorioFactura(); if (repo.Eliminar(id)) { MessageBox.Show("Eliminado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } } else { MessageBox.Show("No se pudo eliminar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("No existe!!", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void GetListTest() { RepositorioFactura repositorio = new RepositorioFactura(); var Listar = repositorio.GetList(x => true); Assert.IsNotNull(Listar); }
private void Guardarbutton_Click(object sender, EventArgs e) { Factura factura; bool Paso = false; RepositorioFactura repositorio = new RepositorioFactura(); if (HayErrores()) { MessageBox.Show("Favor revisar todos los campos!!", "Validación!!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } factura = LlenaClase(); if (IdnumericUpDown.Value == 0) { int num = Convert.ToInt32(TipoPagocomboBox.SelectedIndex); if (num == 0) { Paso = repositorio.GuardarNormal(factura); MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (num == 1) { Paso = repositorio.Guardar(factura); MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { int id = Convert.ToInt32(IdnumericUpDown.Value); RepositorioBase <Factura> repositorioDos = new RepositorioBase <Factura>(); Factura fac = repositorioDos.Buscar(id); if (fac != null) { Paso = repositorio.Modificar(factura); MessageBox.Show("Modificado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Id no existe", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (Paso) { Nuevobutton.PerformClick(); } else { MessageBox.Show("No se pudo guardar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ImprimirButton_Click(object sender, EventArgs e) { RepositorioFactura repo3 = new RepositorioFactura(); var Lista2 = repo3.GetList(p => true); Form formulario = new ReporteVentasDiarias(Lista2); formulario.Show(); }
public void Eliminar() { RepositorioFactura repositorio = new RepositorioFactura(); int id = 2; bool paso = repositorio.Eliminar(id); Assert.AreEqual(true, paso); }
public void BuscarTest() { RepositorioFactura repositorio = new RepositorioFactura(); Facturas factura = new Facturas(); factura = repositorio.Buscar(4); Assert.IsNotNull(factura); }
public void EliminarTest() { RepositorioFactura repositorio = new RepositorioFactura(); bool paso; int id = 1; paso = repositorio.Eliminar(id); Assert.AreEqual(paso, true); }
public void BuscarTest() { RepositorioFactura repositorio = new RepositorioFactura(); int idVenta = repositorio.GetList(x => true)[0].IdFactura; Facturas ventas = repositorio.Buscar(idVenta); bool paso = ventas.Lista.Count > 0; Assert.AreEqual(true, paso); }
public void ModificarTest() { RepositorioFactura repo = new RepositorioFactura(); Facturas factura = repo.Buscar(2); bool paso = repo.Modificar(factura); Assert.AreEqual(paso, true); }
public void Buscar() { int id = 1; RepositorioFactura repositorio = new RepositorioFactura(); Factura factura = new Factura(); bool paso = factura.Detalle.Count > 0; factura = repositorio.Buscar(id); Assert.IsNotNull(factura); }
private void LlenarImporte() { RepositorioFactura repositorio = new RepositorioFactura(); decimal cantidad = 0; decimal precio = 0; cantidad = ToDecimal(CantidadtextBox.Text); precio = ToDecimal(PreciotextBox.Text); ImportetextBox.Text = repositorio.Importe(cantidad, precio).ToString(); }
public void Modificar() { RepositorioFactura repositorio = new RepositorioFactura(); int id = 15; var factura = repositorio.Buscar(id); factura.Detalle.Add(new FacturaDetalle(20, 15, 1, "Salami Induveca", 2, 150, 300)); bool paso = repositorio.Modificar(factura); Assert.AreEqual(true, paso); }
protected void ButtonImprimir_Click(object sender, EventArgs e) { RepositorioFactura repositorio = new RepositorioFactura(); Expression <Func <Facturas, bool> > filtro = x => true; FacturaReportViewer.LocalReport.DataSources.Clear(); FacturaReportViewer.LocalReport.DataSources.Add(new ReportDataSource("Recibos", repositorio.GetList(filtro))); FacturaReportViewer.LocalReport.Refresh(); ScriptManager.RegisterStartupScript(this, this.GetType(), "ReporteModal", "$('#ReporteModal').modal();", true); }
public void ModificarTest() { RepositorioFactura repositorio = new RepositorioFactura(); Facturas factura = new Facturas(); List <DetalleFactura> detalle = new List <DetalleFactura>(); factura.FacturaId = 4; factura.ClienteId = 2; factura.Fecha = DateTime.Now; factura.UsuarioId = 1; factura.Detalles = detalle; factura.Total = 0; Assert.IsTrue(repositorio.Modificar(factura)); }
protected void guardarButton_Click(object sender, EventArgs e) { bool paso = false; RepositorioFactura repositorio = new RepositorioFactura(); Factura factura = new Factura(); if (HayErrores()) { return; } else { factura = LlenarClase(); if (Utils.ToInt(facturaIdTextBox.Text) == 0) { paso = repositorio.Guardar(factura); Utils.ShowToastr(this, "Guardado", "Exito", "success"); LimpiaObjetos(); } else { RepositorioFactura repository = new RepositorioFactura(); int id = Utils.ToInt(facturaIdTextBox.Text); factura = repository.Buscar(id); if (factura != null) { paso = repository.Modificar(LlenarClase()); Utils.ShowToastr(this, "Modificado", "Exito", "success"); LimpiaObjetos(); } else { Utils.ShowToastr(this, "Id no existe", "Error", "error"); } } if (paso) { LimpiaObjetos(); } else { Utils.ShowToastr(this, "No se pudo guardar", "Error", "error"); } } }
public void ModificarTest() { bool paso; Facturas ventas = new Facturas(); RepositorioFactura repositorio = new RepositorioFactura(); ventas.IdFactura = 1; ventas.IdCliente = 1; ventas.Fecha = DateTime.Now; ventas.Monto = 400; ventas.Observacion = "Venta a credito"; ventas.Cantidad = 1; ventas.Lista.Add(new FacturasDetalle(1, 1, 1, 2, "Maria", 200, 400)); paso = repositorio.Modificar(ventas); Assert.AreEqual(paso, true); }
protected void BuscarLinkButton_Click(object sender, EventArgs e) { RepositorioFactura repositorio = new RepositorioFactura(); var factura = repositorio.Buscar(Utils.ToInt(facturaIdTextBox.Text)); lista = Metodos.ListaDetalle(Utils.ToInt(facturaIdTextBox.Text)); if (factura != null) { Utils.ShowToastr(this, "Busqueda exitosa", "Exito", "success"); LlenarCampos(factura); } else { LimpiaObjetos(); Utils.ShowToastr(this, "No existe la Factura especificada", "Error", "error"); } }
private void Imprimirbutton_Click(object sender, EventArgs e) { RepositorioFactura factura = new RepositorioFactura(); List <DetalleFactura> lista = new List <DetalleFactura>(); lista = factura.Buscar((int)IDnumericUpDown.Value).Detalles; if (Detalle.Count > 0) { ReporteFacturaConsumidor reporte = new ReporteFacturaConsumidor(lista); reporte.ShowDialog(); } else { MyerrorProvider.Clear(); MyerrorProvider.SetError(Imprimirbutton, "No hay datos para imprimir."); } }
private void Guardarbutton_Click(object sender, EventArgs e) { if (!Validar()) { return; } bool paso; Facturas facturas; RepositorioFactura repositorio = new RepositorioFactura(); facturas = LlenaClase(); if (IDnumericUpDown.Value == 0) { paso = repositorio.Guardar(facturas); } else { if (!Existe()) { MessageBox.Show("No se puede modificar porque no existe en la base de datos.", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorio.Modificar(facturas); } if (paso) { MessageBox.Show("Guardado!!", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information); var resultado = MessageBox.Show("Deseas imprimir esta factura?.", "ButterSoft", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultado == DialogResult.Yes) { ReporteFacturaConsumidor reporte = new ReporteFacturaConsumidor(Detalle); reporte.ShowDialog(); } Limpiar(); } else { MessageBox.Show("No fue posible guardar!!", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void ButtonEliminar_Click(object sender, EventArgs e) { RepositorioFactura rep = new RepositorioFactura(); Facturas facturas = rep.Buscar(int.Parse(TextBoxFacturaID.Text)); if (facturas != null) { if (rep.Eliminar(int.Parse(TextBoxFacturaID.Text))) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Factura eliminada')", true); ClearAll(); //Invisible(); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('No se pudo eliminar la factura')", true); } } }
private void Buscarbutton_Click(object sender, EventArgs e) { int ID = Convert.ToInt32(IDnumericUpDown.Value); Facturas facturas = new Facturas(); RepositorioFactura repositorio = new RepositorioFactura(); facturas = repositorio.Buscar(ID); if (facturas != null) { Limpiar(); LlenaCampos(facturas); //Imprimirbutton.Visible = true; } else { MessageBox.Show("Factura no encontrada."); } }
private void GuardarButton_Click(object sender, EventArgs e) { bool paso = false; RepositorioFactura repof = new RepositorioFactura(); Facturas factura = new Facturas(); if (!Validar()) { return; } factura = LlenarClase(); int Id = Convert.ToInt32(ClienteComboBox.SelectedValue.ToString()); if (IDNumericUpDown.Value == 0) { paso = repof.Guardar(factura, Id); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar", "Facturacion no registrada", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repof.Modificar(factura); } if (paso) { Limpiar(); MessageBox.Show("Guardado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No fue posible guardar", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void EliminarButton_Click(object sender, EventArgs e) { GridViewRow grid = DetalleGridView.SelectedRow; RepositorioFactura repositorio = new RepositorioFactura(); int id = Utils.ToInt(IDTextBox.Text); var evaluacion = repositorio.Buscar(id); if (evaluacion != null) { if (repositorio.Eliminar(id)) { Utils.ShowToastr(this.Page, "Exito Eliminado", "error"); Limpiar(); } else { Utils.ShowToastr(this.Page, "No Eliminado", "error"); } } }
private void LlenaValores() { RepositorioFactura repositorio = new RepositorioFactura(); int total = 0; List <FacturaDetalle> lista = (List <FacturaDetalle>)ViewState["Detalle"]; foreach (var item in lista) { total += item.Importe; } double Itbis = 0; double SubTotal = 0; Itbis = total * 0.18f; SubTotal = total - Itbis; subtotalTextBox.Text = SubTotal.ToString(); itbisTextBox.Text = Itbis.ToString(); totalTextBox.Text = total.ToString(); }
protected void ButtonBuscarFactura_Click(object sender, EventArgs e) { RepositorioFactura rep = new RepositorioFactura(); Facturas facturas = rep.Buscar(int.Parse(TextBoxFacturaID.Text)); if (facturas != null) { LlenarCamposFactura(facturas); active = true; ViewState["Active"] = active; //_Visible(); ScriptManager.RegisterStartupScript(this, typeof(Page), "toastr_message", script: "toastr['success']('Factura encontrada');", addScriptTags: true); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "toastr_message", script: "toastr['error']('Factura no Encontrada');", addScriptTags: true); } }
public void Guardar() { RepositorioFactura repositorio = new RepositorioFactura(); Factura factura = new Factura(); factura.FacturaId = 15; factura.Fecha = DateTime.Now; factura.UsuarioId = 1; factura.NombreUsuario = "Lenington"; factura.ClienteId = 1; factura.NombreUsuario = "Albert"; factura.Itbis = 200f; factura.SubTotal = 800f; factura.Total = 1000; factura.Detalle.Add(new FacturaDetalle(18, 15, 1, "Salami Induveca", 2, 150, 300)); factura.Detalle.Add(new FacturaDetalle(19, 15, 1, "Salami Don Pedro", 1, 200, 200)); bool paso = repositorio.Guardar(factura); Assert.AreEqual(true, paso); }
private void EliminarButton_Click(object sender, EventArgs e) { MyErrorProvider.Clear(); int id = 0; int.TryParse(IDNumericUpDown.Text, out id); RepositorioBase <Facturas> repo = new RepositorioBase <Facturas>(); RepositorioFactura repof = new RepositorioFactura(); int id2 = Convert.ToInt32(ClienteComboBox.SelectedValue.ToString()); Limpiar(); var Resultado = MessageBox.Show("Esta seguro que desea eliminar este Articulo", "Ferreteria Nelson", MessageBoxButtons.YesNo, MessageBoxIcon.Information); Limpiar(); if (Resultado == DialogResult.Yes) { if (repo.Buscar(id) != null) { if (repof.Eliminar(id, id2, this.detalle)) { MessageBox.Show("Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo eliminar este registro", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Registro no encontrado", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
protected void eliminarutton_Click(object sender, EventArgs e) { RepositorioFactura repositorio = new RepositorioFactura(); int id = Utils.ToInt(facturaIdTextBox.Text); var factura = repositorio.Buscar(id); if (factura != null) { if (repositorio.Eliminar(id)) { Utils.ShowToastr(this, "Eliminado", "Exito", "success"); LimpiaObjetos(); } else { Utils.ShowToastr(this, "No se pudo eliminar", "Error", "error"); } } else { Utils.ShowToastr(this, "No existe", "Error", "error"); } }