private void btn_agregar_Click(object sender, EventArgs e) { Proveedor proveedor = new Proveedor(); proveedor.Id_proveedor = this.proveedor.Id_proveedor; //FALTA VALIDAR Email secundario y terciario (formato) if (ControladorFuncVariadas.validarTextBoxVacios(txt_codigo_postal, txt_direccion, txt_proveedor, txt_provincia, txt_telefono)) { proveedor.Nombre_proveedor = txt_proveedor.Text; proveedor.Telefono = long.Parse(txt_telefono.Text); proveedor.Direccion = txt_direccion.Text; proveedor.Provincia = txt_provincia.Text; proveedor.Codigo_postal = int.Parse(txt_codigo_postal.Text); proveedor.Nombre1 = txt_nombre1.Text; proveedor.Nombre2 = txt_nombre2.Text; proveedor.Nombre3 = txt_nombre3.Text; proveedor.Telefono1 = txt_telefono1.Text; proveedor.Telefono2 = txt_telefono2.Text; proveedor.Telefono3 = txt_telefono3.Text; proveedor.Email = txt_email.Text; proveedor.Email2 = txt_email2.Text; proveedor.Email3 = txt_email3.Text; //proveedor.puntaje = new PuntajeProveedor(); //Transporte proveedor.puntaje.transporte_posicion = Convert.ToInt32(combo_transporte_posicion.Text); proveedor.puntaje.transporte_Prestigio = Convert.ToInt32(combo_transporte_prestigio.Text); proveedor.puntaje.transporte_antecedentes = Convert.ToInt32(combo_transporte_antecedentes.Text); proveedor.puntaje.transporte_financiera = Convert.ToInt32(combo_transporte_financiera.Text); proveedor.puntaje.transporte_transporte = Convert.ToInt32(combo_transporte_pais.Text); proveedor.puntaje.transporte_capacidad = Convert.ToInt32(combo_transporte_capacidad.Text); //Calidad proveedor.puntaje.calidad_plazos = Convert.ToInt32(combo_calidad_plazo.Text); proveedor.puntaje.calidad_costo = Convert.ToInt32(combo_calidad_costo.Text); proveedor.puntaje.calidad_cuidado = Convert.ToInt32(combo_calidad_cuidado.Text); //Pagos proveedor.puntaje.pago_plazo = Convert.ToInt32(combo_pagos_plazo.Text); proveedor.puntaje.pago_descuento = Convert.ToInt32(combo_pago_descuento.Text); //Otros proveedor.puntaje.otros_respuesta = Convert.ToInt32(combo_otros_respuesta.Text); proveedor.puntaje.otros_administrativa = Convert.ToInt32(combo_otros_administrativa.Text); proveedor.puntaje.otros_pedidos = Convert.ToInt32(combo_otros_capacidad.Text); if (ControlProveedor.ModificarProveedor(proveedor) == 1) { MessageBox.Show("Se modificó correctamente!"); ControladorFuncVariadas.limpiarTextBox(txt_codigo_postal, txt_direccion, txt_email, txt_email2, txt_email3, txt_proveedor, txt_provincia, txt_telefono); this.Close(); } } }
private void Modificar() { Modelo.Venta a = new Modelo.Venta(); a.id = venta.id; a.nrofactura = txt_factura.Text; a.remito = long.Parse(txt_remito.Text); if (combo_cobrada.SelectedIndex == 0) { a.cobrada = true; } else { a.cobrada = false; } if (ControladorFuncVariadas.validarTextBoxVacios(txt_remito, txt_factura)) { if (ControlVentas.ModificarVenta(a) == 1) { MessageBox.Show("Se actualizaron los datos correctamente"); modificar = true; this.Close(); } else { Console.WriteLine("Error en el update"); } } }
private void button1_Click(object sender, EventArgs e) { Modelo.Reparacion reparacion_update = new Modelo.Reparacion(); FinalizarReparacion finalizar; if (ControladorFuncVariadas.validarTextBoxVacios(txt_problema) && ControladorFuncVariadas.validarFechaPasada(txt_fecha)) { reparacion_update.id = reparacion.id; reparacion_update.problema = txt_problema.Text; reparacion_update.comentarios = txt_comentarios.Text; reparacion_update.fecha_salida = txt_fecha.Value; reparacion_update.entregado = false; ControlReparaciones.sumarStockEliminadoDeDetalle(tabla_reestablecer_stock, reparacion.id); if (ControlReparaciones.actualizarReparacion(reparacion_update, tabla_reparacion, nuevasFilas()) == 1) { // ControladorFuncVariadas.limpiarTextBox(txt_cliente, txt_maquina, txt_nmotor, txt_problema, txt_comentarios); if (validarManoDeObra()) { finalizar = new FinalizarReparacion(ControlCliente.obtenerCliente(reparacion.documento), Convert.ToDecimal(lbl_subtotal.Text), tabla_reparacion, reparacion.id, this); finalizar.ShowDialog(); } else { MessageBox.Show("Debe agregar el costo de la mano de obra!"); } } else { MessageBox.Show("Hubo un error en la base de datos"); } } }
private void CrearCliente_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape && ControladorFuncVariadas.comboBoxAbierto(combo_provincia, combo_documento, combo_condicion, combo_lista)) { this.Close(); } }
private void crearFiltro() { string filtro_fecha = string.Empty; string filtro_razon = string.Empty; string filtro_npresupuesto = string.Empty; bool and = false; if (txt_filtro_razon.Text.Trim() != "" || !string.IsNullOrEmpty(txt_filtro_razon.Text)) { if (and) { filtro_razon = string.Format(" AND convert([Razon Social], 'System.String') like '%{0}%'", txt_filtro_razon.Text.Trim().Replace("'", "''")); } else { filtro_razon = string.Format(" convert([Razon Social], 'System.String') like '%{0}%'", txt_filtro_razon.Text.Trim().Replace("'", "''")); } and = true; } if (txt_filtro_npresupuesto.Text.Trim() != "" || !string.IsNullOrEmpty(txt_filtro_npresupuesto.Text)) { if (and) { filtro_npresupuesto = string.Format(" AND convert([Id], 'System.String') like '%{0}%'", txt_filtro_npresupuesto.Text.Trim().Replace("'", "''")); } else { filtro_npresupuesto = string.Format(" convert([Id], 'System.String') like '%{0}%'", txt_filtro_npresupuesto.Text.Trim().Replace("'", "''")); } and = true; } if (txt_desde.Value != DateTime.Now.Date || txt_hasta.Value != DateTime.Now.Date) { if (and) { filtro_fecha = string.Format(" AND " + ControladorFuncVariadas.filtro_desde_hasta(txt_desde, txt_hasta)); } else { filtro_fecha = string.Format(" " + ControladorFuncVariadas.filtro_desde_hasta(txt_desde, txt_hasta)); } and = true; } var bd = (BindingSource)dgv_tabla.DataSource; var dt = (DataTable)bd.DataSource; string query = filtro_razon + filtro_npresupuesto + filtro_fecha; dt.DefaultView.RowFilter = query; dgv_tabla.Refresh(); }
private void btn_cambiar_Click(object sender, EventArgs e) { if (ControladorFuncVariadas.validarTextBoxVacios(txt_nuevo)) { if (ControlProducto.modificarDolar(Convert.ToDecimal(txt_nuevo.Text)) == 1) { MessageBox.Show("Se modificó correctamente!"); this.Close(); } else { MessageBox.Show("Hubo un problema.."); } } }
private void btn_crear_Click(object sender, EventArgs e) { Omega3.Modelo.erogaciones erogacion = new erogaciones(); if (ControladorFuncVariadas.validarTextBoxVacios(txt_destino, txt_monto, txt_motivo)) { erogacion.Id_usuario = txt_usuario.Text; erogacion.Motivo = txt_motivo.Text; erogacion.Destino = txt_destino.Text; erogacion.Monto = Convert.ToDecimal(txt_monto.Text); erogacion.Tipogasto = txt_tpo_gasto.Text; Omega3.Controlador.ControlAdministracion.insertarerogacion(erogacion); MessageBox.Show("Se inserto correctamente"); ControladorFuncVariadas.limpiarTextBox(txt_motivo, txt_monto, txt_destino); } }
private void Venta_1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape && ControladorFuncVariadas.comboBoxAbierto(combo_cliente, combo_comprobante, combo_iva, combo_pago, combo_producto)) { this.Close(); } if (e.KeyCode == Keys.F6) { if (!btn_no_factura.Visible) { btn_no_factura.Visible = true; } else { btn_no_factura.Visible = false; } } }
private void btn_guardar_Click(object sender, EventArgs e) { Modelo.Reparacion reparacion_update = new Modelo.Reparacion(); if (ControladorFuncVariadas.validarTextBoxVacios(txt_problema) && ControladorFuncVariadas.validarFechaPasada(txt_fecha)) { reparacion_update.id = reparacion.id; reparacion_update.problema = txt_problema.Text; reparacion_update.comentarios = txt_comentarios.Text; reparacion_update.fecha_salida = txt_fecha.Value; reparacion_update.entregado = false; ControlReparaciones.sumarStockEliminadoDeDetalle(tabla_reestablecer_stock, reparacion.id); if (ControlReparaciones.actualizarReparacion(reparacion_update, tabla_reparacion, nuevasFilas()) == 1) { MessageBox.Show("Se guardó correctamente"); ControladorFuncVariadas.limpiarTextBox(txt_cliente, txt_maquina, txt_nmotor, txt_problema, txt_comentarios); txt_fecha.Value = DateTime.Now; tabla_reparacion.DataSource = null; tabla_reparacion.Rows.Clear(); tabla_reestablecer_stock.DataSource = null; tabla_reestablecer_stock.Rows.Clear(); btn_buscar_producto.Enabled = false; btn_buscar_reparacion.Enabled = true; btn_mano_de_obra.Enabled = false; txt_maquina.Text = string.Empty; } else { MessageBox.Show("Hubo un error en la base de datos"); } } Cliente a = new Cliente(); a = ControlCliente.obtenerCliente(reparacion.documento); }
private void cargarReparacionEntregada(long id) { //Hacer los botones invisibles. ControladorFuncVariadas.cambiarVisibilidadBoton(false, btn_buscar_reparacion, btn_buscar_producto, btn_agregar_producto, txt_guardar, button1, btn_mano_de_obra); ControladorFuncVariadas.cambiarVisibilidadLabel(false, lbl_nombre_producto, lbl_stock_actual, lbl_precio, label5, label6, label7, label3, label4, label2); ControladorFuncVariadas.cambiarVisibilidadTextBox(false, txt_cantidad, txt_descuento); ControladorFuncVariadas.cambiarVisibilidadCombos(false, combo_iva); Modelo.Reparacion modelo = new Modelo.Reparacion(); modelo = ControlReparaciones.obtenerReparacion(id); txt_cliente.Text = modelo.razon_social; txt_fecha.Value = modelo.fecha_salida; txt_maquina.Text = modelo.maquina; txt_comentarios.Text = modelo.comentarios; txt_problema.Text = modelo.problema; txt_nmotor.Text = modelo.id_motor; tabla_reparacion.Enabled = true; ControlReparaciones.llenarTablaArticulosReparacion(tabla_reparacion, id); tabla_reparacion.Columns.Remove("Borrar"); calcularTotal(); }
private void txt_precio_costo_KeyPress(object sender, KeyPressEventArgs e) { ControladorFuncVariadas.validarNumerosConComas(sender, e); }
private void txt_cantidad_KeyPress(object sender, KeyPressEventArgs e) { ControladorFuncVariadas.validarSoloNumeros(sender, e); }
private void txt_retencion_suss_KeyPress(object sender, KeyPressEventArgs e) { ControladorFuncVariadas.validarNumerosConComas(sender, e); }
private void cargar_Click(object sender, EventArgs e) { datos a = new datos(); if (ControladorFuncVariadas.AccesoInternet()) { if (combo_documento.Text == "CUIT") { if (txt_cuit.Text.Trim().Length < 11) { MessageBox.Show("El campo CUIT se encuentra incompleto"); } else { a = JsonConvert.DeserializeObject <datos>(GET(txt_cuit.Text)); if (a.data.nombre != null) { txt_razon_social.Text = a.data.nombre; } if (a.data.domicilioFiscal.direccion != null) { txt_direccion.Text = a.data.domicilioFiscal.direccion; } if (Convert.ToString(a.data.domicilioFiscal.codPostal) != "0") { txt_cod_postal.Text = Convert.ToString(a.data.domicilioFiscal.codPostal); } combo_provincia.SelectedIndex = a.data.domicilioFiscal.idProvincia; } } else if (combo_documento.Text == "CUIL") { if (txt_cuit.Text.Trim().Length < 11) { MessageBox.Show("El campo CUIL se encuentra incompleto"); } else { a = JsonConvert.DeserializeObject <datos>(GET(txt_cuit.Text)); if (a.data.nombre != null) { txt_razon_social.Text = a.data.nombre; } if (a.data.domicilioFiscal.direccion != null) { txt_direccion.Text = a.data.domicilioFiscal.direccion; } if (Convert.ToString(a.data.domicilioFiscal.codPostal) != "0") { txt_cod_postal.Text = Convert.ToString(a.data.domicilioFiscal.codPostal); } combo_provincia.SelectedIndex = a.data.domicilioFiscal.idProvincia; } } } else { MessageBox.Show("No es posible autocompletar los datos, debido a que no hay conexión a internet"); } }
private bool validarCampos() { if (txt_direccion.Text.Trim() == "") { MessageBox.Show("La dirección es obligatoria"); //lbl_direccion.ForeColor = Color.Red; txt_direccion.Focus(); return(false); } ///LISTA else if (combo_lista.SelectedIndex == -1) { MessageBox.Show("Debe seleccionar una lista"); //lbl_provincia.ForeColor = Color.Red; combo_lista.Focus(); return(false); } else if (combo_provincia.SelectedIndex == -1) { MessageBox.Show("Debe seleccionar una provincia"); //lbl_provincia.ForeColor = Color.Red; combo_provincia.Focus(); return(false); } else if (txt_contacto.Text.Trim() == "") { MessageBox.Show("El contacto es obligatorio"); //lbl_contacto.ForeColor = Color.Red; txt_contacto.Focus(); return(false); } else if (txt_mail_contacto.Text.Trim() == "") { MessageBox.Show("El mail de contacto es obligatorio"); //lbl_mail.ForeColor = Color.Red; txt_mail_contacto.Focus(); return(false); } else if (txt_mail_contacto.Text.Trim() != "") { if (!ControladorFuncVariadas.validarEmail(txt_mail_contacto.Text)) { MessageBox.Show("El E-mail no contiene el formato requerido"); return(false); } } else if (txt_razon_social.Text.Trim() == "") { MessageBox.Show("La razón social es obligatoria"); //lbl_razon.ForeColor = Color.Red; txt_razon_social.Focus(); return(false); } else if (txt_telefono.Text.Trim() == "") { MessageBox.Show("El telefono es obligatorio"); //lbl_telefono.ForeColor = Color.Red; txt_telefono.Focus(); return(false); } else if (txt_localidad.Text.Trim() == "") { MessageBox.Show("El campo localidad es obligatorio"); //lbl_localidad.ForeColor = Color.Red; txt_localidad.Focus(); return(false); } else if (txt_cod_postal.Text.Trim() == "" || string.IsNullOrEmpty(txt_cod_postal.Text.Trim())) { MessageBox.Show("El campo código postal es obligatorio"); txt_cod_postal.Focus(); return(false); } return(true); }
private void combo_producto_KeyPress(object sender, KeyPressEventArgs e) { ControladorFuncVariadas.autoCompletarCombo(sender, e, combo_producto); //var a = new ControladorFuncVariadas(); //a.AutoComplete(combo_producto, e); }
private void combo_cliente_KeyPress(object sender, KeyPressEventArgs e) { var a = new ControladorFuncVariadas(); a.AutoComplete(combo_cliente, e); }
private void crearFiltro() { string filtro_estado = string.Empty; string filtro_razon = string.Empty; string filtro_nfactura = string.Empty; string filtro_fecha = string.Empty; bool and = false; if (filtro_estado_venta.SelectedIndex != -1) { and = true; if (filtro_estado_venta.SelectedIndex == 2) { filtro_estado = string.Format("[Cobrada] = 0"); } else if (filtro_estado_venta.SelectedIndex == 0) { and = false; filtro_estado = string.Empty; } else if (filtro_estado_venta.SelectedIndex == 1) { filtro_estado = string.Format("[Cobrada] = 1"); } } if (txt_filtro_razon.Text.Trim() != "" || !string.IsNullOrEmpty(txt_filtro_razon.Text)) { if (and) { filtro_razon = string.Format(" AND convert([Razon Social], 'System.String') like '%{0}%'", txt_filtro_razon.Text.Trim().Replace("'", "''")); } else { filtro_razon = string.Format(" convert([Razon Social], 'System.String') like '%{0}%'", txt_filtro_razon.Text.Trim().Replace("'", "''")); } and = true; } if (txt_filtro_factura.Text.Trim() != "" || !string.IsNullOrEmpty(txt_filtro_factura.Text)) { if (and) { filtro_nfactura = string.Format(" AND convert([Nro Factura], 'System.String') like '%{0}%'", txt_filtro_factura.Text.Trim().Replace("'", "''")); } else { filtro_nfactura = string.Format(" convert([Nro Factura], 'System.String') like '%{0}%'", txt_filtro_factura.Text.Trim().Replace("'", "''")); } and = true; } if (txt_desde.Value != DateTime.Now.Date || txt_hasta.Value != DateTime.Now.Date) { if (and) { filtro_fecha = string.Format(" AND " + ControladorFuncVariadas.filtro_desde_hasta(txt_desde, txt_hasta)); } else { filtro_fecha = string.Format(" " + ControladorFuncVariadas.filtro_desde_hasta(txt_desde, txt_hasta)); } and = true; } var bd = (BindingSource)dgv_tabla.DataSource; var dt = (System.Data.DataTable)bd.DataSource; string query = filtro_estado + filtro_razon + filtro_nfactura + filtro_fecha; dt.DefaultView.RowFilter = query; dgv_tabla.Refresh(); }
private void txt_ventas_lista_KeyPress(object sender, KeyPressEventArgs e) { ControladorFuncVariadas.validarNumerosConComas(sender, e); }