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(); } }
private void btnEliminar_Click(object sender, EventArgs e) { string msj = "Seguro que quiere ELIMINAR el CLIENTE \"" + dataGridView1.SelectedCells[4].Value.ToString() + ", " + dataGridView1.SelectedCells[3].Value.ToString() + " (" + dataGridView1.SelectedCells[0].Value.ToString() + ")\"?\n"; msj += "SE REALIZA UNA BAJA LÓGICA"; var result = MessageBox.Show(msj, "Eliminar cliente", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);//, MessageBoxDefaultButton.Button2); if (result == DialogResult.OK) { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros( "@cliente_id", dataGridView1.SelectedCells[0].Value.ToString()); Herramientas.EjecutarStoredProcedure("SARASA.eliminar_cliente", lista); } }
private void btnCambiar_Click(object sender, EventArgs e) { bool passActualOK = false, passValidacionOK = false; if (usuario.Password.Equals(Herramientas.sha256_hash(txtPasswordActual.Text.ToString()))) { passActualOK = true; lblPassActual.ForeColor = Color.Black; } else { passActualOK = false; lblPassActual.ForeColor = Color.Red; } if ((txtPasswordNuevo.Text != "") && (txtPasswordNuevo.Text.Equals(txtPasswordNuevoVal.Text))) { passValidacionOK = true; lblPassNuevo.ForeColor = Color.Black; lblPassNuevoVal.ForeColor = Color.Black; } else { passValidacionOK = false; lblPassNuevo.ForeColor = Color.Red; lblPassNuevoVal.ForeColor = Color.Red; } if (passActualOK && passValidacionOK) { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros("@usuario_id", usuario.UsuarioId, "@usuario_pass", Herramientas.sha256_hash(txtPasswordNuevo.Text.ToString())); if (Herramientas.EjecutarStoredProcedure("SARASA.modificar_pass_usuario", lista) != null) { this.Dispose(); formPadre.Show(); } } }
private void btnRenovar_Click(object sender, EventArgs e) { string msj = "Seguro que quiere RENOVAR la CUENTA \"" + dataGridView1.SelectedCells[1].Value.ToString() + "\"\n" + "del Cliente: " + dataGridView1.SelectedCells[17].Value.ToString() + ", " + dataGridView1.SelectedCells[16].Value.ToString() + " (" + dataGridView1.SelectedCells[0].Value.ToString() + ") ?\n\n"; msj += "LA RENOVACIÓN PUEDE GENERAR UN GASTO"; var result = MessageBox.Show(msj, "Renovar cuenta", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);//, MessageBoxDefaultButton.Button2); if (result == DialogResult.OK) { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros( "@cuenta_numero", dataGridView1.SelectedCells[1].Value.ToString()); Herramientas.EjecutarStoredProcedure("SARASA.renovar_suscripcion", lista); } }
// Desasociar (LO ELIMINA DE LA BASE) private void btnDesasociar_Click(object sender, EventArgs e) { string msj = "Seguro que quiere DESASOCIAR la TARJETA " + dataGridView1.SelectedCells[4].Value.ToString() + " (" + dataGridView1.SelectedCells[5].Value.ToString() + ")\n" + "del Cliente: " + dataGridView1.SelectedCells[2].Value.ToString() + ", " + dataGridView1.SelectedCells[1].Value.ToString() + " (" + dataGridView1.SelectedCells[0].Value.ToString() + ") ?\n\n" + "SE REALIZA UNA BAJA LOGICA"; var result = MessageBox.Show(msj, "Desasociar tarjeta", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);//, MessageBoxDefaultButton.Button2); if (result == DialogResult.OK) { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros( "@cliente_id", dataGridView1.SelectedCells[0].Value.ToString(), "@tc_num", dataGridView1.SelectedCells[3].Value.ToString()); Herramientas.EjecutarStoredProcedure("SARASA.Desasociar_Tarjeta", lista); } }
private void btnEliminar_Click(object sender, EventArgs e) { if (this.dataGridView1.CurrentRow != null) //Valida que se haya seleccionado una fila del DataGridView { try { List <SqlParameter> lista = Utils.Herramientas.GenerarListaDeParametros( "@Usuario_Id", dataGridView1.CurrentRow.Cells[0].Value.ToString()); Herramientas.EjecutarStoredProcedure("SARASA.eliminar_usuario", lista); } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString()); } } else { Utils.Herramientas.msebox_informacion("Por favor, seleccionar una fila de usuario"); } }
private void btnModificar_Click(object sender, EventArgs e) { string msj = "Seguro que quiere MODIFICAR la información de la CUENTA " + txtNumero.Text + "\n" + "del Cliente: " + txtCliente.Text + "?"; var result = MessageBox.Show(msj, "Modificar cuenta", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);//, MessageBoxDefaultButton.Button2); if (result == DialogResult.OK) { List <SqlParameter> lista = Utils.Herramientas.GenerarListaDeParametros( "@cliente_id", cuenta.IdCliente, "@cuenta_numero", cuenta.Numero, "@tipo_cuenta_deseado", ((KeyValuePair <string, string>)cbxTipoCta.SelectedItem).Key, "@estado_deseado", ((KeyValuePair <string, string>)cbxEstado.SelectedItem).Key); Herramientas.EjecutarStoredProcedure("SARASA.modificar_cuenta", lista); this.Dispose(); this.formPadre.Show(); } }
private void btnBaja_Click(object sender, EventArgs e) { string msj = "Seguro que quiere CERRAR la CUENTA \"" + dataGridView1.SelectedCells[1].Value.ToString() + "\"\n" + "del Cliente: " + dataGridView1.SelectedCells[17].Value.ToString() + ", " + dataGridView1.SelectedCells[16].Value.ToString() + " (" + dataGridView1.SelectedCells[0].Value.ToString() + ") ?\n\n"; msj += "UNA CUENTA CERRADA NO PUEDE VOLVER A ACTIVARSE"; var result = MessageBox.Show(msj, "Cerrar cuenta", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);//, MessageBoxDefaultButton.Button2); if (result == DialogResult.OK) { List <SqlParameter> lista = Utils.Herramientas.GenerarListaDeParametros( "@cliente_id", dataGridView1.SelectedCells[0].Value.ToString(), "@cuenta_numero", dataGridView1.SelectedCells[1].Value.ToString(), "@tipo_cuenta_deseado", dataGridView1.SelectedCells[2].Value.ToString(), "@estado_deseado", 2); // El estado con ID 2 es "Cerrada" Herramientas.EjecutarStoredProcedure("SARASA.modificar_cuenta", lista); } }
private void btnModificar_Click(object sender, EventArgs e) { int hab; if (checkBox1.Checked) { hab = 1; } else { hab = 0; } bool passwordOK = false, preguntaOK = false, respuestaOK = false; if (txtPassword.Text != "") { passwordOK = true; lblPassword.ForeColor = Color.Black; } else { passwordOK = false; lblPassword.ForeColor = Color.Red; } if (txtPreguntaSec.Text != "") { preguntaOK = true; lblPregunta.ForeColor = Color.Black; } else { preguntaOK = false; lblPregunta.ForeColor = Color.Red; } if (txtRespuestaSec.Text != "") { respuestaOK = true; lblRespuesta.ForeColor = Color.Black; } else { respuestaOK = false; lblRespuesta.ForeColor = Color.Red; } if (passwordOK && preguntaOK && respuestaOK) { if (lbxRoles.SelectedItems.Count != 0) { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros( "@usuario_id", this.id, "@pass", Herramientas.sha256_hash(txtPassword.Text.ToString()), "@preg", txtPreguntaSec.Text, "@resp", Herramientas.sha256_hash(txtRespuestaSec.Text.ToString()), "@hab", hab); Herramientas.EjecutarStoredProcedure("SARASA.modificar_usuario", lista); foreach (Utils.ItemRol item in lbxRoles.SelectedItems) { lista = Herramientas.GenerarListaDeParametros( "@usuario_id", this.id, "@rol", item.Id); Herramientas.EjecutarStoredProcedure("SARASA.insertar_rol_usuario", lista); } Herramientas.msebox_informacion("Usuario modificado con éxito"); this.Dispose(); this.formPadre.Show(); } else { Herramientas.msebox_informacion("Debe seleccionar al menos un rol"); } } else { Herramientas.msebox_informacion("Completar todos los campos"); } }
private void btnRetirar_Click(object sender, EventArgs e) { bool clienteOK = false, documentoOK = false, cuentaOK = false, monedaOK = false, importeOK = false, bancoOK = false; if (txtCliente.Text != "") { clienteOK = true; lklCliente.LinkColor = Color.Blue; } else { clienteOK = false; lklCliente.LinkColor = Color.Red; } if (Herramientas.IsDecimal(txtImporte.Text)) { lblImporte.ForeColor = Color.Black; importeOK = true; } else { lblImporte.ForeColor = Color.Red; importeOK = false; } if (clienteDocumento.Equals(txtDocumento.Text)) { lblDocumento.ForeColor = Color.Black; documentoOK = true; } else { lblDocumento.ForeColor = Color.Red; documentoOK = false; } if (cbxCuenta.DataSource != null) { cuentaOK = true; lblCuenta.ForeColor = Color.Black; } else { cuentaOK = false; lblCuenta.ForeColor = Color.Red; } if (cbxBanco.DataSource != null) { bancoOK = true; lblBanco.ForeColor = Color.Black; } else { bancoOK = false; lblBanco.ForeColor = Color.Red; } if (cbxMoneda.DataSource != null) { monedaOK = true; lblMoneda.ForeColor = Color.Black; } else { monedaOK = false; lblMoneda.ForeColor = Color.Red; } if (clienteOK && documentoOK && importeOK && bancoOK && monedaOK && cuentaOK) { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros( "@cliente_id", clienteId, "@cliente_documento", txtDocumento.Text, "@cuenta_nro", ((KeyValuePair <string, string>)cbxCuenta.SelectedItem).Key, "@moneda_id", ((KeyValuePair <string, string>)cbxMoneda.SelectedItem).Key, "@importe", txtImporte.Text, "@banco_codigo", ((KeyValuePair <string, string>)cbxBanco.SelectedItem).Key); if (Herramientas.EjecutarStoredProcedure("SARASA.retirar_efectivo", lista) != null) { string boleta = "CLIENTE: " + txtCliente.Text + "\n" + "CUENTA: " + ((KeyValuePair <string, string>)cbxCuenta.SelectedItem).Key + "\n" + "IMPORTE: $" + txtImporte.Text + " (" + ((KeyValuePair <string, string>)cbxMoneda.SelectedItem).Value + ")\n" + "BANCO: " + ((KeyValuePair <string, string>)cbxBanco.SelectedItem).Value + "\n"; MessageBox.Show(boleta, "RETIRO - COMPROBANTE", MessageBoxButtons.OK, MessageBoxIcon.Information); txtDocumento.Text = ""; txtImporte.Text = ""; cbxBanco.SelectedIndex = 0; cbxCuenta.SelectedIndex = 0; cbxMoneda.SelectedIndex = 0; } } }
private void txtCrear_Click(object sender, EventArgs e) { string resultado; string tipodoc = ((KeyValuePair <string, string>)cbxTipoDoc.SelectedItem).Key; resultado = Herramientas.comprobarDocMail(tipodoc, txtNumDoc.Text, txtMail.Text); label4.ForeColor = Color.Black; label5.ForeColor = Color.Black; label6.ForeColor = Color.Black; if (resultado == "1") { label4.ForeColor = Color.Red; label5.ForeColor = Color.Red; labelResultado.Text = "Tipo y Nro de Documento ya existentes"; labelResultado.ForeColor = Color.Red; labelResultado.Visible = true; } if (resultado == "2") { label6.ForeColor = Color.Red; labelResultado.Text = "Mail ya existente"; labelResultado.ForeColor = Color.Red; labelResultado.Visible = true; } if (resultado == "3") { label4.ForeColor = Color.Red; label5.ForeColor = Color.Red; label6.ForeColor = Color.Red; labelResultado.Text = "Tipo Doc, Nro de Documento y Mail ya existentes"; labelResultado.ForeColor = Color.Red; labelResultado.Visible = true; } if (resultado == "0") { // EJECUTA EL STORE PROCEDURE QUE GRABA LOS DATOS EN LA TABLA try { List <SqlParameter> lista; if (txtPiso.Text == "" && txtDepto.Text == "") { lista = Herramientas.GenerarListaDeParametros( "@Cliente_Nombre", txtNombre.Text, "@Cliente_Apellido", txtApellido.Text, "@Cliente_Tipodoc_Id", ((KeyValuePair <string, string>)cbxTipoDoc.SelectedItem).Key, "@Cliente_Doc_Nro", txtNumDoc.Text, "@Cliente_Dom_Calle", txtCalle.Text, "@Cliente_Dom_Numero", txtCalleNum.Text, "@Cliente_Dom_Piso", "0", "@Cliente_Dom_Depto", "0", "@Cliente_Mail", txtMail.Text, "@Cliente_Pais_Id", ((KeyValuePair <string, string>)cbxPais.SelectedItem).Key, "@Cliente_Fecha_Nacimiento", dtpFechaNac.Value.ToShortDateString(), "@Cliente_Habilitado", chkEstado.Checked, "@Usuario_Id", userId, "@Usuario_Username", txtUsuario.Text, "@Usuario_Password", Herramientas.sha256_hash(txtPassword.Text), "@Usuario_Pregunta_Sec", txtPreguntaSec.Text, "@Usuario_Respuesta_Sec", Herramientas.sha256_hash(txtRespuestaSec.Text), "@Rol_Id", ((KeyValuePair <string, string>)cbxRol.SelectedItem).Key); } else { lista = Herramientas.GenerarListaDeParametros( "@Cliente_Nombre", txtNombre.Text, "@Cliente_Apellido", txtApellido.Text, "@Cliente_Tipodoc_Id", ((KeyValuePair <string, string>)cbxTipoDoc.SelectedItem).Key, "@Cliente_Doc_Nro", txtNumDoc.Text, "@Cliente_Dom_Calle", txtCalle.Text, "@Cliente_Dom_Numero", txtCalleNum.Text, "@Cliente_Dom_Piso", txtPiso.Text, "@Cliente_Dom_Depto", txtDepto.Text, "@Cliente_Mail", txtMail.Text, "@Cliente_Pais_Id", ((KeyValuePair <string, string>)cbxPais.SelectedItem).Key, "@Cliente_Fecha_Nacimiento", dtpFechaNac.Value.ToShortDateString(), "@Cliente_Habilitado", chkEstado.Checked, "@Usuario_Id", userId, "@Usuario_Username", txtUsuario.Text, "@Usuario_Password", Herramientas.sha256_hash(txtPassword.Text), "@Usuario_Pregunta_Sec", txtPreguntaSec.Text, "@Usuario_Respuesta_Sec", Herramientas.sha256_hash(txtRespuestaSec.Text), "@Rol_Id", ((KeyValuePair <string, string>)cbxRol.SelectedItem).Key); } Herramientas.EjecutarStoredProcedure("SARASA.crear_cliente", lista); Herramientas.msebox_informacion("Cliente nueva creada (ID_USER: "******")"); this.Close(); this.formPadre.Show(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString()); } } }
private void btnCrear_Click(object sender, EventArgs e) { bool usernameOK = false, passwordOK = false, preguntaOK = false, respuestaOK = false; if (txtUsuario.Text != "") { usernameOK = true; lblUsuario.ForeColor = Color.Black; } else { usernameOK = false; lblUsuario.ForeColor = Color.Red; } if (txtPassword.Text != "") { passwordOK = true; lblPassword.ForeColor = Color.Black; } else { passwordOK = false; lblPassword.ForeColor = Color.Red; } if (txtPreguntaSec.Text != "") { preguntaOK = true; lblPregunta.ForeColor = Color.Black; } else { preguntaOK = false; lblPregunta.ForeColor = Color.Red; } if (txtRespuestaSec.Text != "") { respuestaOK = true; lblRespuesta.ForeColor = Color.Black; } else { respuestaOK = false; lblRespuesta.ForeColor = Color.Red; } if (usernameOK && passwordOK && preguntaOK && respuestaOK) { string resul; try { string nombreSP = "SARASA.comprobar_usuario_existente"; List <SqlParameter> listaParametros = Herramientas.GenerarListaDeParametros( "@username", txtUsuario.Text); conexion cn = new conexion(); SqlCommand query = new SqlCommand(nombreSP, cn.abrir_conexion()); query.CommandType = CommandType.StoredProcedure; // Agregar los parametros del tipo INPUT query.Parameters.AddRange(listaParametros.ToArray()); // Definir el parametro del tipo OUTPUT SqlParameter factura = new SqlParameter("@resul", 0); factura.Direction = ParameterDirection.Output; query.Parameters.Add(factura); query.ExecuteNonQuery(); resul = (query.Parameters["@resul"].SqlValue.ToString()); if (resul == "0") { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros( "@Usuario_Username", txtUsuario.Text, "@Usuario_Password", Herramientas.sha256_hash(txtPassword.Text.ToString()), "@Usuario_Pregunta_Sec", txtPreguntaSec.Text, "@Usuario_Respuesta_Sec", Herramientas.sha256_hash(txtRespuestaSec.Text.ToString()), "@Rol_Id", ((KeyValuePair <string, string>)cbxRol.SelectedItem).Key); if (Herramientas.EjecutarStoredProcedure("SARASA.crear_usuario", lista) == null) { } else { this.Dispose(); formPadre.Show(); } } else { lblUsuario.ForeColor = Color.Red; Herramientas.msebox_informacion("Nombre de usuario ya existente"); } } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString()); } } }
// 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 btnTransferir_Click(object sender, EventArgs e) { bool importeOK = false, clienteOK = false, ctaOrigenOK = false, ctaDestinoOK = false; if (txtCliente.Text != "") { clienteOK = true; lklCliente.LinkColor = Color.Blue; } else { clienteOK = false; lklCliente.LinkColor = Color.Red; } if (Herramientas.IsDecimal(txtImporte.Text)) { lblImporte.ForeColor = Color.Black; importeOK = true; } else { lblImporte.ForeColor = Color.Red; importeOK = false; } if (cbxCuenta.DataSource != null) { ctaOrigenOK = true; lblCuenta.ForeColor = Color.Black; } else { ctaOrigenOK = false; lblCuenta.ForeColor = Color.Red; } if (cbxCuentaDestino.DataSource != null) { ctaDestinoOK = true; lklCuentaDestino.LinkColor = Color.Blue; } else { ctaDestinoOK = false; lklCuentaDestino.LinkColor = Color.Red; } if (clienteOK && ctaOrigenOK && ctaDestinoOK && importeOK) { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros( "@cliente_id", this.clienteId, "@cuenta_origen", ((KeyValuePair <string, string>)cbxCuenta.SelectedItem).Key, "@cuenta_destino", numeroCuenta, "@importe", txtImporte.Text); if (Herramientas.EjecutarStoredProcedure("SARASA.realizar_transferencia", lista) != null) { string msj = "CLIENTE: " + usuario.Apellido + ", " + usuario.Nombre + " (" + usuario.ClienteId + ")\n" + "CUENTA ORIGEN: " + ((KeyValuePair <string, string>)cbxCuenta.SelectedItem).Key + "\n" + "CUENTA DESTINO: " + numeroCuenta + "\n" + "IMPORTE: $" + txtImporte.Text + "\n"; MessageBox.Show(msj, "TRANSFERENCIA - COMPROBANTE", MessageBoxButtons.OK, MessageBoxIcon.Information); cbxCuenta.SelectedIndex = 0; cbxCuentaDestino.SelectedIndex = 0; txtImporte.Text = ""; } } }
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; } }
private void btnGuardar_Click(object sender, EventArgs e) { bool docNumeroOK = false, domPisoOK = false, domNumeroOK = false; string msj = "Seguro que quiere MODIFICAR la información del CLIENTE \"" + cliente.Apellido + ", " + cliente.Nombre + " (" + cliente.ClienteId + ")\"?"; if (Herramientas.IsNumericLong(txtNumDoc.Text)) { docNumeroOK = true; lblNroDocumento.ForeColor = Color.Black; } else { docNumeroOK = false; lblNroDocumento.ForeColor = Color.Red; } if (Herramientas.IsNumericLong(txtCalleNum.Text)) { domNumeroOK = true; lblDomNum.ForeColor = Color.Black; } else { domNumeroOK = false; lblDomNum.ForeColor = Color.Red; } if (Herramientas.IsNumericLong(txtPiso.Text)) { domPisoOK = true; lblDomPiso.ForeColor = Color.Black; } else { domPisoOK = false; lblDomPiso.ForeColor = Color.Red; } if (docNumeroOK && domNumeroOK && domPisoOK) { var result = MessageBox.Show(msj, "Modificar cliente", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);//, MessageBoxDefaultButton.Button2); if (result == DialogResult.OK) { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros( "@Cliente_Id", cliente.ClienteId, "@Cliente_Nombre", txtNombre.Text, "@Cliente_Apellido", txtApellido.Text, "@Cliente_Tipodoc_Id", ((KeyValuePair <string, string>)cbxTipoDoc.SelectedItem).Key, "@Cliente_Doc_Nro", txtNumDoc.Text, "@Cliente_Dom_Calle", txtCalle.Text, "@Cliente_Dom_Numero", txtCalleNum.Text, "@Cliente_Dom_Piso", txtPiso.Text, "@Cliente_Dom_Depto", txtDepto.Text, "@Cliente_Mail", txtMail.Text, "@Cliente_Pais_Id", ((KeyValuePair <string, string>)cbxPais.SelectedItem).Key, "@Cliente_Fecha_Nacimiento", dtpFechaNac.Value.ToShortDateString(), "@Cliente_Habilitado", chkEstado.Checked); Herramientas.EjecutarStoredProcedure("SARASA.modificar_cliente", lista); this.Dispose(); this.formPadre.Show(); } } }
private void btnDepositar_Click(object sender, EventArgs e) { bool importeOK = false, cuentaOK = false, tarjetaOK = false, monedaOK = false, clienteOK = false; if (Herramientas.IsDecimal(txtImporte.Text)) { importeOK = true; lblImporte.ForeColor = Color.Black; } else { importeOK = false; lblImporte.ForeColor = Color.Red; } if (cbxCuenta.DataSource != null) { cuentaOK = true; lblCuenta.ForeColor = Color.Black; } else { cuentaOK = false; lblCuenta.ForeColor = Color.Red; } if (cbxTarjeta.DataSource != null) { tarjetaOK = true; lblTarjeta.ForeColor = Color.Black; } else { tarjetaOK = false; lblTarjeta.ForeColor = Color.Red; } if (cbxMoneda.DataSource != null) { monedaOK = true; lblMoneda.ForeColor = Color.Black; } else { monedaOK = false; lblMoneda.ForeColor = Color.Red; } if (txtCliente.Text != "") { clienteOK = true; lklCliente.LinkColor = Color.Blue; } else { clienteOK = false; lklCliente.LinkColor = Color.Red; } if (clienteOK && importeOK && cuentaOK && tarjetaOK && monedaOK) { List <SqlParameter> lista = Herramientas.GenerarListaDeParametros( "@cliente_id", this.clienteId, "@deposito_fecha", dtpFecha.Value.ToShortDateString(), "@deposito_importe", txtImporte.Text, "@deposito_moneda_id", ((KeyValuePair <string, string>)cbxMoneda.SelectedItem).Key, "@deposito_tarjeta_num", ((KeyValuePair <string, string>)cbxTarjeta.SelectedItem).Key, "@deposito_cuenta_num", ((KeyValuePair <string, string>)cbxCuenta.SelectedItem).Key); if (Herramientas.EjecutarStoredProcedure("SARASA.realizar_deposito", lista) != null) { string msj = "CLIENTE: " + usuario.Apellido + ", " + usuario.Nombre + " (" + this.clienteId + ")\n" + "CUENTA: " + ((KeyValuePair <string, string>)cbxCuenta.SelectedItem).Key + "\n" + "TARJETA: " + ((KeyValuePair <string, string>)cbxTarjeta.SelectedItem).Value + "\n" + "IMPORTE: $" + txtImporte.Text + "\n"; MessageBox.Show(msj, "DEPOSITO - COMPROBANTE", MessageBoxButtons.OK, MessageBoxIcon.Information); cbxCuenta.SelectedIndex = 0; cbxMoneda.SelectedIndex = 0; cbxTarjeta.SelectedIndex = 0; txtImporte.Text = ""; } else { MessageBox.Show("Verificar que el formulario este completo", "Depositos", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }