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(); } } }
// 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"); }