private void btnModificar_Click(object sender, EventArgs e) { bool codSeguridadOK = false, fechasOk = false; string msj = "Seguro que quiere MODIFICAR la información de la TARJERTA " + tarjeta.Descripcion + "(" + tarjeta.Emisor + ")\n" + "del Cliente: " + txtCliente.Text + "?"; if (Herramientas.IsNumeric(txtCodSeguridad.Text)) { codSeguridadOK = true; lblCodSeguridad.ForeColor = Color.Black; } else { codSeguridadOK = false; lblCodSeguridad.ForeColor = Color.Red; } if (dtpFechaEmision.Value.ToShortDateString().Equals(dtpFechaVencimiento.Value.ToShortDateString())) {// EMISION Y VENCIMIENTO IGUALES, ERROR AL GUARDAR // Utils.Herramientas.msebox_informacion("Existen valores inválidos: " + dtpFechaEmision.Value.ToShortTimeString() + "=" + dtpFechaVencimiento.Value.ToShortTimeString()); fechasOk = false; lblFechaEmision.ForeColor = Color.Red; lblFechaVencimiento.ForeColor = Color.Red; } else { fechasOk = true; lblFechaEmision.ForeColor = Color.Black; lblFechaVencimiento.ForeColor = Color.Black; } if (fechasOk && codSeguridadOK) { var result = MessageBox.Show(msj, "Desasociar tarjeta", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);//, MessageBoxDefaultButton.Button2); if (result == DialogResult.OK) { List <SqlParameter> lista = Utils.Herramientas.GenerarListaDeParametros( "@cliente_id", this.tarjeta.ClienteId, "@tc_num", this.tarjeta.Numero, "@tc_emision", dtpFechaEmision.Value.ToShortDateString(), "@tc_vencimiento", dtpFechaVencimiento.Value.ToShortDateString(), "@tc_codseg", txtCodSeguridad.Text, "@tc_emisor", cbxEmisor.Text); Herramientas.EjecutarStoredProcedure("SARASA.Modificar_Tarjeta", lista); } this.Dispose(); this.formPadre.Show(); } }
// Asociar: Ejecutar SP asociarTarjeta(idcliente, demas_parametros) private void btnAsociar_Click(object sender, EventArgs e) { bool numeroOk = false, codSeguridadOK = false, fechasOk = false; if (Herramientas.IsNumericLong(txtNumero.Text) && (txtNumero.Text.ToString().Length == 16)) { numeroOk = true; lblNumero.ForeColor = Color.Black; } else { numeroOk = false; lblNumero.ForeColor = Color.Red; } if (Herramientas.IsNumeric(txtCodSeguridad.Text)) { codSeguridadOK = true; lblCodSeguridad.ForeColor = Color.Black; } else { codSeguridadOK = false; lblCodSeguridad.ForeColor = Color.Red; } if (dtpFechaEmision.Value.ToShortDateString().Equals(dtpFechaVencimiento.Value.ToShortDateString())) {// EMISION Y VENCIMIENTO IGUALES, ERROR AL GUARDAR // Utils.Herramientas.msebox_informacion("Existen valores inválidos: " + dtpFechaEmision.Value.ToShortTimeString() + "=" + dtpFechaVencimiento.Value.ToShortTimeString()); fechasOk = false; lblFechaEmision.ForeColor = Color.Red; lblFechaVencimiento.ForeColor = Color.Red; } else { fechasOk = true; lblFechaEmision.ForeColor = Color.Black; lblFechaVencimiento.ForeColor = Color.Black; } if (fechasOk && numeroOk && codSeguridadOK) { try { List <SqlParameter> lista = Utils.Herramientas.GenerarListaDeParametros( "@cliente_id", clienteId, "@tc_num", Herramientas.sha256_hash(txtNumero.Text),//Convert.ToString(txtNumero.Text), "@tc_ultimoscuatro", Convert.ToString(Utils.Herramientas.stringRight(txtNumero.Text, 4)), "@tc_emision", dtpFechaEmision.Value.ToShortDateString(), "@tc_vencimiento", dtpFechaVencimiento.Value.ToShortDateString(), "@tc_codseg", Convert.ToString(txtCodSeguridad.Text), "@tc_emisor", Convert.ToString(cbxEmisor.Text)); Herramientas.EjecutarStoredProcedure("SARASA.Asociar_Tarjeta", lista); Herramientas.msebox_informacion("Tarjeta asociada con éxito"); this.Close(); this.formPadre.Show(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString()); } /*String msj = "Nueva Tarjetan\n"; * msj += "@clienteId = 'PRUEBA'\n"; * msj += "@tarjetaNumero = '" + txtNumero.Text + "'\n"; * msj += "@tarjetaFechaEmision = '" + dtpFechaEmision.Value.ToShortDateString() + "'\n"; * msj += "@tarjetaFechaVencimiento = '" + dtpFechaVencimiento.Value.ToShortDateString() + "'\n"; * msj += "@tarjetaCodigoSeg = '" + txtCodSeguridad.Text + "'\n"; * msj += "@tarjetaEmisorDescripcion = '" + cbxEmisor.Text + "'\n"; * * Utils.Herramientas.msebox_informacion(msj); * * txtCodSeguridad.Text = ""; * txtNumero.Text = ""; * cbxEmisor.Text = ""; * dtpFechaEmision.Value = DateTime.Now; * dtpFechaVencimiento.Value = DateTime.Now;*/ } // dtpFechaEmision.Value = DateTime.Parse("12/05/1988"); // dtpFechaVencimiento.Value = DateTime.Parse("2015-12-05 00:00:00.000"); }
private void btnBuscar_Click(object sender, EventArgs e) { dgvListado.DataSource = null; if (Herramientas.IsNumeric(txtAño.Text)) { lblAño.ForeColor = Color.Black; string idConsulta = ((KeyValuePair <string, string>)cbxConsulta.SelectedItem).Key; string idTrimestre = ((KeyValuePair <string, string>)cbxTrimestre.SelectedItem).Key; string año = txtAño.Text; string fechaDesde = "", fechaHasta = ""; switch (idTrimestre) { case "1": // Enero, Febrero, Marzo fechaDesde = "01/01/" + año; fechaHasta = "31/03/" + año; break; case "2": // Abril, Mayo, Junio fechaDesde = "01/04/" + año; fechaHasta = "30/06/" + año; break; case "3": // Julio, Agosto, Septiembre fechaDesde = "01/07/" + año; fechaHasta = "30/09/" + año; break; case "4": // Octubre, Noviembre, Diciembre fechaDesde = "01/10/" + año; fechaHasta = "31/12/" + año; break; } List <SqlParameter> parametros = Herramientas.GenerarListaDeParametros("@fecha_desde", fechaDesde, "@fecha_hasta", fechaHasta); switch (idConsulta) { case "1": //EJECUTA EL PROCEDURE DE LA CONSULTA 1 dgvListado.DataSource = Herramientas.EjecutarStoredProcedure("SARASA.inhabilitaciones_por_cliente", parametros); break; case "2": //EJECUTA EL PROCEDURE DE LA CONSULTA 2 dgvListado.DataSource = Herramientas.EjecutarStoredProcedure("SARASA.clientes_mas_comisiones_facturadas", parametros); break; case "3": //EJECUTA EL PROCEDURE DE LA CONSULTA 3 dgvListado.DataSource = Herramientas.EjecutarStoredProcedure("SARASA.clientes_transferencias_entre_si", parametros); break; case "4": //EJECUTA EL PROCEDURE DE LA CONSULTA 4 dgvListado.DataSource = Herramientas.EjecutarStoredProcedure("SARASA.movimientos_por_paises", parametros); break; case "5": //EJECUTA EL PROCEDURE DE LA CONSULTA 5 dgvListado.DataSource = Herramientas.EjecutarStoredProcedure("SARASA.total_facturado_por_tipo_cuenta", parametros); break; } } else { lblAño.ForeColor = Color.Red; } }