private Entidades.PrecioDeVenta CargarEntidad() { Entidades.PrecioDeVenta _stock = new Entidades.PrecioDeVenta(); DateTime fechaActual = DateTime.Now; _stock.FechaActual = fechaActual; if (String.IsNullOrEmpty(txtReditoPorcentual.Text)) { _stock.ReditoPorcentual = "0 %"; } else { _stock.ReditoPorcentual = txtReditoPorcentual.Text; } if (!String.IsNullOrEmpty(txtPrecioVenta.Text)) { string Valor = txtPrecioVenta.Text; var temp = Valor.Replace(".", "<TEMP>"); var temp2 = temp.Replace(",", ","); var replaced = temp2.Replace("<TEMP>", ","); _stock.Precio = Convert.ToDecimal(replaced); } _stock.idUsuario = Sesion.UsuarioLogueado.IdUsuario; _stock.idProducto = idProductoIngresado; return(_stock); }
private PrecioDeVenta CargarEntidad() { Entidades.PrecioDeVenta _precio = new Entidades.PrecioDeVenta(); int idusuarioLogueado = Sesion.UsuarioLogueado.IdUsuario; _precio.idProducto = ProductoIngresado; _precio.ReditoPorcentual = txtReditoPorcentual.Text; if (txtPrecioVenta.Text != "") { _precio.Precio = Convert.ToDecimal(txtPrecioVenta.Text); } DateTime fechaActual = DateTime.Now; _precio.FechaActual = fechaActual; _precio.idUsuario = idusuarioLogueado; return(_precio); }
private void btnGuardar_Click(object sender, EventArgs e) { try { Entidades.PrecioDeVenta _stock = CargarEntidad(); bool Exito = Negocio.Stock.CargarPrecioDeVenta(_stock); if (Exito == true) { ProgressBar(); const string message2 = "Se registro el stock exitosamente."; const string caption2 = "Éxito"; var result2 = MessageBox.Show(message2, caption2, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); LimpiarCampos(); FuncionListarProductosConPrecios(); } } catch (Exception ex) { } }
private void btnGuardar_Click(object sender, EventArgs e) { try { lblEnProgreso.Visible = true; bool Exito; if (chcMarca.Checked == true) { string marca = txtMarca.Text; string NuevoRedito = txtReditoPorcentual.Text; if (NuevoRedito == "" || NuevoRedito == " %") { const string message3 = "Debe ingresar el rédito porcentual que desea obtener de la marca seleccionada."; const string caption3 = "Atención"; var result3 = MessageBox.Show(message3, caption3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); throw new Exception(); } const string message = "Desea modificar el precio de venta de los productos correspondientes a la marca seleccionada?"; const string caption = "Modificar precio por marca"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); { if (result == DialogResult.Yes) { int idusuarioLogueado = Sesion.UsuarioLogueado.IdUsuario; int idUsuario = idusuarioLogueado; InhabilitarPaneles(); ProgressBar(); Exito = true; //Exito = Negocio.PrecioDeVenta_Negocio.InsertPrecioDeVentaPorMarca(marca, NuevoRedito, idUsuario); if (Exito == true) { const string message2 = "Se registro el nuevo precio de venta exitosamente."; const string caption2 = "Modificar precio por marca"; var result2 = MessageBox.Show(message2, caption2, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); LimpiarCampos(); } else { const string message3 = "Los productos asociados a la marca seleccionada, no tiene un precio de venta predefinido que se pueda modificar."; const string caption3 = "Modificar precio por marca"; var result3 = MessageBox.Show(message3, caption3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } if (chcProveedor.Checked == true) { string proveedor = txtMarca.Text; string NuevoRedito = txtReditoPorcentual.Text; if (NuevoRedito == "" || NuevoRedito == " %") { const string message3 = "Debe ingresar el rédito porcentual que desea obtener de la marca seleccionada."; const string caption3 = "Atención"; var result3 = MessageBox.Show(message3, caption3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); throw new Exception(); } const string message = "Desea modificar el precio de venta de los productos correspondientes al proveedor seleccionada?"; const string caption = "Modificar precio por proveedor"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); { if (result == DialogResult.Yes) { int idusuarioLogueado = Sesion.UsuarioLogueado.IdUsuario; int idUsuario = idusuarioLogueado; ProgressBar(); Exito = true; //Exito = Negocio.PrecioDeVenta_Negocio.InsertPrecioDeVentaPorProveedor(proveedor, NuevoRedito, idUsuario); if (Exito == true) { const string message2 = "Se registro el nuevo precio de venta exitosamente."; const string caption2 = "Modificar precio por proveedor"; var result2 = MessageBox.Show(message2, caption2, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); LimpiarCampos(); } else { const string message3 = "Los productos asociados al proveedor seleccionada, no tiene un precio de venta predefinido que se pueda modificar."; const string caption3 = "Modificar precio por marca"; var result3 = MessageBox.Show(message3, caption3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } else { Entidades.PrecioDeVenta _precio = CargarEntidad(); ProgressBar(); Exito = Negocio.PrecioDeVenta_Negocio.InsertPrecioDeVenta(_precio); if (Exito == true) { const string message = "Se registro el nuevo precio de venta exitosamente."; const string caption = "Modificar precio por marca"; var result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); LimpiarCampos(); } } lblEnProgreso.Visible = false; } catch (Exception ex) { MessageBox.Show("Error en el sistema. Intente nuevamente o comuniquese con el administrador."); throw new Exception(); } LimpiarCampos(); }