// Update is called once per frame void Update() { vida = Mathf.Clamp(vida, 0, 100); barraDeVida.fillAmount = vida / 100; //Lo intente asi pero no cargo bien el menu quiza tu si lo veas bien, si no probar otra opcion if (vida == 0 || LimiteTiempo.text.Equals("03:00")) { TextoPerdido.text = "Lo siento, ¡Has Perdido!"; TextoPerdido.gameObject.SetActive(true); tiempo += Time.deltaTime; if (tiempo >= 4) { ConsultasSQL sql = new ConsultasSQL(); CameraSettings camera = GameObject.Find("LeftEye").GetComponent <CameraSettings>(); string paciente = camera.idPaciente; string especialista = camera.idEspecialista; //Debug.Log("Paciente " + paciente + " Especialista "+ especialista); string duracion = LimiteTiempo.text.ToString(); sql.insertTratamiento("Manejo de Contrastes", "Sin especificar", duracion, paciente, especialista); //Debug.Log(paciente + " " + especialista + " " + LimiteTiempo.text); SceneManager.LoadScene("Menu"); } } }
public List <TipoCorrespondencia> getAllTipoCorrespondencia(ref string mensaje) { List <TipoCorrespondencia> tipoCorrespondencia = new List <TipoCorrespondencia>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "sp_getListTipoCorrespondencia"; try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { tipoCorrespondencia.Add(TipoCorrespondencia.CreateTipoCorrespondenciaFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(tipoCorrespondencia); }
public Estado getEstado(int id, ref string mensaje) { Estado estados = new Estado(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "sp_getEstado"; sql.Comando.Parameters.AddWithValue("@idEstado", id); try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { estados = Estado.CreateEstadoFromDataRecord(reader); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(estados); }
public List <Facultad> getAllFacultad(ref string mensaje) { List <Facultad> facultades = new List <Facultad>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getAllFacultad"; try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { facultades.Add(Facultad.CreateFacultadFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(facultades); }
public BandejaEntrada getBandejaEntrada(int id, ref string mensaje) { BandejaEntrada procesosEntrada = new BandejaEntrada(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "sp_getBandejaEntrada"; sql.Comando.Parameters.AddWithValue("@IdProceso", id); try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { procesosEntrada = BandejaEntrada.CreateBandejaEntradaFromDataRecord(reader); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(procesosEntrada); }
public Usuario getUsuario(string alias, ref string mensaje) { Usuario usuario = null; sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getUsuario"; sql.Comando.Parameters.AddWithValue("@UserName", alias); try { IDataReader reader = sql.EjecutaReader(ref mensaje); if (reader.Read()) { usuario = new Usuario(); usuario = Usuario.CreateUsuarioFromDataRecord(reader); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(usuario); }
public List <Pasantia> getAllPasantia(ref string mensaje) { List <Pasantia> pasantias = new List <Pasantia>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getAllPasantia"; try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { pasantias.Add(Pasantia.CreatePasantiaFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(pasantias); }
public Facultad getFacultad(int id, ref string mensaje) { Facultad facultad = new Facultad(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getFacultad"; sql.Comando.Parameters.AddWithValue("@FacultadID", id); try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { facultad = Facultad.CreateFacultadFromDataRecord(reader); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(facultad); }
public Entidades.Proceso.Proceso getProceso(int id, ref string mensaje) { Entidades.Proceso.Proceso proceso = new Entidades.Proceso.Proceso(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "sp_getProceso"; sql.Comando.Parameters.AddWithValue("@IdProceso", id); try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { proceso = Entidades.Proceso.Proceso.CreateProcesoFromDataRecord(reader); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(proceso); }
public List <Usuario> getAllUsuario(ref string mensaje) { List <Usuario> usuarios = new List <Usuario>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "sp_getListUsuario"; try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { usuarios.Add(Usuario.CreateUsuarioFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(usuarios); }
void Awake() { cam = gameObject.GetComponent <Camera>(); // Aquí se escoge si esta cámara corresponde al ojo estrábico. ConsultasSQL sql = new ConsultasSQL(); string[] eyes = sql.getAngleEyes(); //Debug.Log("Ojos: " + eyes[0] + "--" +eyes[1]); idPaciente = eyes[2]; idEspecialista = eyes[3]; /*Establece que ve cada ojo*/ if (!eyes[0].Equals("0") || !eyes[1].Equals("0")) { if (gameObject.transform.name == "LeftEye" && !eyes[0].Equals("0")) // Ojo Izquierdo con estrabismo { cam.cullingMask = 1 << 0 | 1 << 2 | 1 << 5 | 1 << 9 | 1 << 10 | 1 << 11 | 1 << 12 | 1 << 16; //cam.cullingMask = 1 << 0 | 1 << 2 | 1 << 5 | 1 << 9 | 1 << 10 | 1 << 13 | 1 << 14 | 1 << 16; } else if (gameObject.transform.name == "RightEye" && !eyes[1].Equals("0")) // Ojo derecho con estrabismo { cam.cullingMask = 1 << 0 | 1 << 2 | 1 << 5 | 1 << 9 | 1 << 10 | 1 << 11 | 1 << 12 | 1 << 16; //cam.cullingMask = 1 << 0 | 1 << 2 | 1 << 5 | 1 << 9 | 1 << 10 | 1 << 13 | 1 << 14 | 1 << 16; } else { cam.cullingMask = 1 << 0 | 1 << 2 | 1 << 5 | 1 << 9 | 1 << 10 | 1 << 13 | 1 << 14 | 1 << 16; //cam.cullingMask = 1 << 0 | 1 << 2 | 1 << 5 | 1 << 9 | 1 << 10 | 1 << 11 | 1 << 12 | 1 << 16; } } else { cam.cullingMask = 1 << 0 | 1 << 2 | 1 << 5 | 1 << 9 | 1 << 10 | 1 << 11 | 1 << 12 | 1 << 16; } }
public List <AppMenu> getAllbyRol(int rolid, ref string mensaje) { List <AppMenu> menus = new List <AppMenu>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getMenu"; sql.Comando.Parameters.AddWithValue("@RolID", rolid); try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { menus.Add(AppMenu.CreateAppMenuFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(menus); }
public List <BandejaHistorial> getAllBandejaHistorial(ref string mensaje) { List <BandejaHistorial> procesosHistorial = new List <BandejaHistorial>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "sp_getListBandejaHistorial"; try { sql.AbrirConexion(); IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { procesosHistorial.Add(BandejaHistorial.CreateBandejaHistorialFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } finally { sql.CerrarConexion(); } return(procesosHistorial); }
private void buttonAgregar_Click(object sender, EventArgs e) { if (textBoxRazonSocial.Text.Trim() == " " | textBoxCuit.Text.Trim() == " " | textBoxTelefono.Text.Trim() == "" | textBoxMail.Text.Trim() == " " | textBoxCodigoPostal.Text.Trim() == " " | textBoxNroCalle.Text.Trim() == " " | textBoxNroCalle.Text.Trim() == " ") { MessageBox.Show("Faltan completar campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!System.Text.RegularExpressions.Regex.IsMatch(textBoxCuit.Text, @"^\d+$")) { MessageBox.Show("Sólo se permiten numeros en el CUIT", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!System.Text.RegularExpressions.Regex.IsMatch(textBoxNroCalle.Text, @"^\d+$")) { MessageBox.Show("Sólo se permiten numeros en el Nro de calle", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!System.Text.RegularExpressions.Regex.IsMatch(textBoxPiso.Text, @"^\d+$")) { MessageBox.Show("Sólo se permiten numeros en el Piso", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!System.Text.RegularExpressions.Regex.IsMatch(textBoxTelefono.Text, @"^\d+$")) { MessageBox.Show("Sólo se permiten numeros en el Telefono", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (textBoxCuit.TextLength != 11) { MessageBox.Show("El cuit tiene que tener 11 digitos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ConsultasSQL.existeCuit(textBoxCuit.Text, "empresa")) { MessageBox.Show("Ya se encuentra registrado el numero de CUIT", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } String razonSocial = textBoxRazonSocial.Text; String cuit = armarCuit(textBoxCuit.Text); String ciudad = textBoxCiudad.Text; String mail = textBoxMail.Text; String telefono = textBoxTelefono.Text; int nroCalle = Convert.ToInt32(textBoxNroCalle.Text); String calle = textBoxCalle.Text; String codPostal = textBoxCodigoPostal.Text; String dto = textBoxDto.Text; int piso = Convert.ToInt32(textBoxPiso.Text); String localidad = textBoxLocalidad.Text; DateTime hoy = DateTime.Today; ConsultasSQLEmpresa.AgregarEmpresa(razonSocial, cuit, ciudad, mail, telefono, usuario, hoy); ConsultasSQLEmpresa.AgregarDomicilio(calle, nroCalle, piso, dto, localidad, codPostal, "Empresa"); this.limpiarCuadrosDeTexto(); }
void Awake() { //cam = gameObject.GetComponent<Camera>(); // Aquí se escoge si esta cámara corresponde al ojo estrábico. //ConsultasSQL sql = new ConsultasSQL(); /*BD bd = GameObject.Find("BD").GetComponent<BD>(); * string[] eyes = new string[2]; * eyes[0] = bd.eyes[0]; * eyes[1] = bd.eyes[1];*/ // Aquí se escoge si esta cámara corresponde al ojo estrábico. ConsultasSQL sql = new ConsultasSQL(); string[] eyes = sql.getAngleEyes(); Debug.Log("Ojos: " + eyes[0] + "--" + eyes[1]); /*Variables de la BD*/ /*idPaciente = eyes[2]; * idEspecialista = eyes[3]; * tiempoBD = eyes[4];*/ /*Establece que ve cada ojo*/ if (!eyes[0].Equals("0") || !eyes[1].Equals("0")) { if (gameObject.transform.name == "LeftEye" && !eyes[0].Equals("0")) { // Ojo Izquierdo con estrabismo //cam.cullingMask = 1 << 0 | 1 << 1 | 1 << 2 | 1 << 4 | 1 << 5 | 1 << 8 | 1 << 9; /*GameObject ReticleRight = GameObject.Find("GvrReticlePointerR"); * ReticleRight.gameObject.SetActive(false); * Destroy(ReticleRight);*/ } else if (gameObject.transform.name == "RightEye" && !eyes[1].Equals("0")) { // Ojo derecho con estrabismo //cam.cullingMask = 1 << 0 | 1 << 1 | 1 << 2 | 1 << 4 | 1 << 5 | 1 << 8 | 1 << 9; /* GameObject ReticleLeft = GameObject.Find("GvrReticlePointerL"); * ReticleLeft.gameObject.SetActive(false); * Destroy(ReticleLeft);*/ } else { //cam.cullingMask = 1 << 0 | 1 << 1 | 1 << 2 | 1 << 4 | 1 << 5 | 1 << 9; gameObject.tag = "Untagged"; gameObject.SetActive(false); } } else { //cam.cullingMask = 1 << 0 | 1 << 2 | 1 << 5 | 1 << 9 | 1 << 10 | 1 << 11 | 1 << 12 | 1 << 16; } }
void Awake() { ConsultasSQL sql = new ConsultasSQL(); string[] data = sql.getAngleEyes(); eyes[0] = data[0]; eyes[1] = data[1]; idPaciente = data[2]; idEspecialista = data[3]; tiempoBD = data[4]; //Debug.Log(eyes[0] + " " +eyes[1] + " " + idPaciente + " " + idEspecialista + " " + tiempoBD); }
public void terminar() { Time.timeScale = 0; // Se detiene el tiempo ConsultasSQL sql = new ConsultasSQL(); BD bd = GameObject.Find("BD").GetComponent <BD>(); string paciente = bd.idPaciente; string especialista = bd.idEspecialista; //string duracion = Tiempo.text.ToString(); /*duracion*/ Reloj reloj = GameObject.Find("Reloj").GetComponent <Reloj>(); //Debug.Log("Tiempo inicial" + reloj.tiempoInicial); int minutos = int.Parse(Tiempo.text.ToString().Substring(0, 2)); int segundos = int.Parse(Tiempo.text.ToString().Substring(3, 2)); int mintoseg = minutos * 60; int resultado = reloj.tiempoInicial - (mintoseg + segundos); //Debug.Log(resultado); /*Conversion a string*/ minutos = (int)resultado / 60; segundos = (int)resultado % 60; string duracion = minutos.ToString("00") + ":" + segundos.ToString("00"); Debug.Log(duracion); /**/ string puntuacion = Puntuacion.text.ToString(); reloj.tiempoMostrarEnSegundos = reloj.tiempoInicial; Time.timeScale = 0; // Se detiene el tiempo sql.insertTratamiento("Relajación", puntuacion, duracion, paciente, especialista); /*Ocultar los tiempos y el canvas de puntuacion*/ //TextoTiempo.gameObject.SetActive(false); //Tiempo.gameObject.SetActive(false); //Text t = Tiempo.GetComponent<Text>(); //t.color = new Color(1f, 1f, 1f, 0f); //PanelPuntuacion.gameObject.SetActive(false); /*Ocultar figuras para que no se pueda interactuar*/ /*obj1.gameObject.SetActive(false); * obj2.gameObject.SetActive(false); * obj3.gameObject.SetActive(false);*/ /*Poner el canvas con el puntaje y tiempo*/ PuntuacionFinal.text = "Obtuviste una puntuación de " + Puntuacion.text + " puntos"; TiempoFinal.text = "Tu tiempo final fue de: " + duracion; PanelFinal.gameObject.SetActive(true); }
public List <Actividad> getAllActividad(ref string mensaje) { List <Actividad> actividades = new List <Actividad>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getAllActividad"; try { IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { actividades.Add(Actividad.CreateActividadFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } return(actividades); }
public List <Institucion> getAllInstitucion(ref string mensaje) { List <Institucion> instituciones = new List <Institucion>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getAllInstitucion"; try { IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { instituciones.Add(Institucion.CreateInstitucionFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } return(instituciones); }
// Update is called once per frame void Update() { if (enemy1 == null && enemy2 == null && enemy3 == null && enemy4 == null && enemy5 == null && enemy6 == null && enemy7 == null && enemy8 == null) //if (enemy4 == null) { TextoVictoria.text = "¡Has Ganado!"; TextoVictoria.gameObject.SetActive(true); tiempo += Time.deltaTime; /*Guardar los resultados de la terapia*/ /*Regresar al menu principal*/ if (tiempo >= 4) { ConsultasSQL sql = new ConsultasSQL(); CameraSettings camera = GameObject.Find("LeftEye").GetComponent <CameraSettings>(); string paciente = camera.idPaciente; string especialista = camera.idEspecialista; string duracion = LimiteTiempo.text.ToString(); sql.insertTratamiento("Manejo de Contrastes", "Sin especificar", duracion, paciente, especialista); SceneManager.LoadScene("Menu"); } } }
public List <TipoIdentificacion> getAllTipoIdentificacion(ref string mensaje) { List <TipoIdentificacion> tiposidentificacion = new List <TipoIdentificacion>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getAllTipoIdentificacion"; try { IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { tiposidentificacion.Add(TipoIdentificacion.CreateTipoIdentificacionFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } return(tiposidentificacion); }
public List <Proceso> getAllProceso(ref string mensaje) { List <Proceso> procesos = new List <Proceso>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getAllProceso"; try { IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { procesos.Add(Proceso.CreateProcesoFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } return(procesos); }
public List <Carrera> getAllCarrera(ref string mensaje) { List <Carrera> carreras = new List <Carrera>(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getAllCarrera"; try { IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { carreras.Add(Carrera.CreateCarreraFromDataRecord(reader)); } } catch (Exception ex) { mensaje = ex.Message; } return(carreras); }
public Proceso getProceso(int id, ref string mensaje) { Proceso proceso = new Proceso(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getProceso"; sql.Comando.Parameters.AddWithValue("@PersonaID", id); try { IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { proceso = Proceso.CreateProcesoFromDataRecord(reader); } } catch (Exception ex) { mensaje = ex.Message; } return(proceso); }
public Carrera getCarrera(int id, ref string mensaje) { Carrera carrera = new Carrera(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getCarrera"; sql.Comando.Parameters.AddWithValue("@CarreraID", id); try { IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { carrera = Carrera.CreateCarreraFromDataRecord(reader); } } catch (Exception ex) { mensaje = ex.Message; } return(carrera); }
public Persona getPersonabyUser(int user, ref string mensaje) { Persona persona = new Persona(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getPersonabyUser"; sql.Comando.Parameters.AddWithValue("@UsuarioID", user); try { IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { persona = Persona.CreatePersonaFromDataRecord(reader); } } catch (Exception ex) { mensaje = ex.Message; } return(persona); }
public Institucion getInstitucion(int id, ref string mensaje) { Institucion institucion = new Institucion(); sql = new ConsultasSQL(); sql.Comando.CommandType = CommandType.StoredProcedure; sql.Comando.CommandText = "pa_getInstitucion"; sql.Comando.Parameters.AddWithValue("@InstitucionID", id); try { IDataReader reader = sql.EjecutaReader(ref mensaje); while (reader.Read()) { institucion = Institucion.CreateInstitucionFromDataRecord(reader); } } catch (Exception ex) { mensaje = ex.Message; } return(institucion); }
void Start() { ConsultasSQL sql = new ConsultasSQL(); eye = sql.getAngleEyes(); }
private void buttonAgregar_Click(object sender, EventArgs e) { if (camposInvalidos()) { return; } // Porque no es campo obligatorio bool ingresoPisoYDPT = false; String error = ""; if (textBoxPiso.Text.Trim() != "" && textBoxDto.Text.Trim() != "") { if (!AyudaExtra.esStringNumerico(textBoxPiso.Text.Trim())) { error += "Debe ingresar el numero de piso\n"; // MessageBox.Show("Debe ingresar el numero de piso", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; } else { ingresoPisoYDPT = true; } // debeSerTodoNumero(textBoxPiso.Text, "Piso"); } // debeSerTodoNumero(textBoxTelefono.Text, "Telefono"); String tipo = "Cliente"; DBConsulta.conexionAbrir(); if (consultasSQLCliente.existeCuit(textBoxCuit.Text, tipo)) { error += "Ya se encuentra registrado el numero de CUIT\n"; // MessageBox.Show("Ya se encuentra registrado el numero de CUIT", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; } DBConsulta.conexionCerrar(); if (error != "") { MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } /* if (!cuitYNroDocumentoSonCorrectos(textBoxCuit.Text, textBoxDOCNUMERO.Text)) { * MessageBox.Show("El CUIT y el numero de documento no coindiden", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); * return; * } */ String nombre = textBoxNombre.Text.Trim(); String apellido = textBoxApellido.Text.Trim(); String tipo_documento = textBoxTIPODOC.Text.Trim(); String cuit = armarCuit(textBoxCuit.Text); String mail = textBoxMail.Text.Trim(); String fecha_nacimiento = dateFecha.Value.ToString("yyyy-MM-dd"); String calle = textBoxCalle.Text.Trim(); String codPostal = textBoxCodigoPostal.Text.Trim(); String dto = textBoxDto.Text; long numero_documento = Convert.ToInt64(textBoxDOCNUMERO.Text); String telefono = textBoxTelefono.Text.Trim(); int nroCalle = Convert.ToInt32(textBoxNroCalle.Text); String nro_tarjeta = textBoxTarjeta.Text.Trim(); int piso; if (ingresoPisoYDPT) { piso = Convert.ToInt32(textBoxPiso.Text); } else { piso = 0; } String localidad = textBoxLocalidad.Text; bool creacionAbortada = false; DBConsulta.conexionAbrir(); if (DBConsulta.repeticion_de_campo_tipoDOC_numero_o_CUIL(cuit, textBoxDOCNUMERO.Text.Trim().ToString(), tipo_documento)) { MessageBox.Show("Hay repetición en CUIL, o en Tipo de documento y su número, correspondiente a la DB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DBConsulta.conexionCerrar(); return; } DBConsulta.conexionCerrar(); DBConsulta.conexionAbrir(); if (mailRepetido(mail)) { MessageBox.Show("El Email ingresado ya existe en la DB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DBConsulta.conexionCerrar(); return; } bool errors = false; bool autocontra = false; String contraAutogenerada = autogenerarContrasenia.contraGeneradaAString(); if (textBoxContrasenia.Text.Trim() == "") { autocontra = true; int usuarioNuevo = ConsultasSQL.crearUser(nombre.Replace(" ", "_") + "_" + apellido.Replace(" ", "_"), creacionAbortada, contraAutogenerada, "Cliente"); } else { if (AyudaExtra.esStringNumerico(textBoxContrasenia.Text.Trim())) { int usuarioNuevo = ConsultasSQL.crearUser(nombre.Replace(" ", "_") + "_" + apellido.Replace(" ", "_"), creacionAbortada, textBoxContrasenia.Text.Trim(), "Cliente"); } else { MessageBox.Show("La contraseña debe ser numérica", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); errors = true; } } DBConsulta.conexionCerrar(); if (!errors) { if (creacionAbortada == false) { consultasSQLCliente.AgregarCliente(nombre, apellido, tipo_documento, numero_documento, mail, nro_tarjeta, cuit, telefono, fecha_nacimiento, DateTime.Today); DBConsulta.conexionAbrir(); consultasSQLCliente.AgregarDomicilio(calle, nroCalle, piso, dto, localidad, codPostal, "Cliente"); string cmd = "Select TOP 1 usuario_nombre from SQLEADOS.Usuario order by usuario_Id DESC"; DataTable dt = DBConsulta.obtenerConsultaEspecifica(cmd); String comentario = "Usuario creado: " + dt.Rows[0][0].ToString(); if (autocontra) { comentario += "\n\nContraseña autogenerada: " + contraAutogenerada; } MessageBox.Show(comentario); DBConsulta.conexionCerrar(); if (esRegistro) { registro.terminar(); this.Close(); } } else { MessageBox.Show("Error al crear el nuevo usuario al consultar la base de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DBConsulta.conexionCerrar(); return; } } this.limpiarCuadrosDeTexto(); }
private void buttonAgregar_Click(object sender, EventArgs e) { if (camposInvalidos()) { return; } /* * if (textBoxNombre.Text.Trim() == " " | textBoxApellido.Text.Trim() == " " | textBoxCuit.Text.Trim() == " " | textBoxTelefono.Text.Trim() == "" | textBoxMail.Text.Trim() == " " | textBoxTIPODOC.Text.Trim() == " " | textBoxDOCNUMERO.Text.Trim()==" " | textBoxTarjeta.Text.Trim()==" " | textBoxCodigoPostal.Text.Trim() == " " | textBoxNroCalle.Text.Trim() == " " | textBoxNroCalle.Text.Trim() == " ") | { | | MessageBox.Show("Faltan completar campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | return; | | } | | if (!AyudaExtra.esStringNumerico(textBoxNroCalle.Text.Trim())) { | MessageBox.Show("El numero de calle debe ser numerico", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | return; | } | | AyudaExtra.esStringNumerico(textBoxDOCNUMERO.Text.Trim()); | | | | // if (contieneNumeroTIPODocumento(textBoxTIPODOC.Text)) | // { | // MessageBox.Show("Sólo se permiten letras en el Tipo de documento", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | // return; | // } | | | if (textBoxTIPODOC.TextLength != 3) | { | MessageBox.Show("El cuit tiene que tener 3 digitos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | return; | } | | // Porque no es campo obligatorio | if(textBoxPiso.Text != "") { | // debeSerTodoNumero(textBoxPiso.Text, "Piso"); | } | | // debeSerTodoNumero(textBoxTelefono.Text, "Telefono"); | | if (textBoxDOCNUMERO.TextLength != 7) | { | MessageBox.Show("El documento debe tener 7 digitos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | return; | } | | if (textBoxCuit.TextLength != 11) | { | MessageBox.Show("El cuit tiene que tener 11 digitos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | return; | } | String tipo = "cliente"; | if (consultasSQLCliente.existeCuit(textBoxCuit.Text, tipo)) | { | | MessageBox.Show("Ya se encuentra registrado el numero de CUIT", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | return; | } | */ /* if (!cuitYNroDocumentoSonCorrectos(textBoxCuit.Text, textBoxDOCNUMERO.Text)) { * MessageBox.Show("El CUIT y el numero de documento no coindiden", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); * return; * } */ String nombre = textBoxNombre.Text.Trim(); String apellido = textBoxApellido.Text.Trim(); String tipo_documento = textBoxTIPODOC.Text.Trim(); String cuit = armarCuit(textBoxCuit.Text); String mail = textBoxMail.Text.Trim(); String fecha_nacimiento = dateFecha.Value.ToString("yyyy-MM-dd"); String calle = textBoxCalle.Text.Trim(); String codPostal = textBoxCodigoPostal.Text.Trim(); String dto = textBoxDto.Text; int numero_documento = Convert.ToInt32(textBoxDOCNUMERO.Text); String telefono = textBoxTelefono.Text.Trim(); int nroCalle = Convert.ToInt32(textBoxNroCalle.Text); String nro_tarjeta = textBoxTarjeta.Text.Trim(); int piso; if (textBoxPiso.Text != "") { piso = Convert.ToInt32(textBoxPiso.Text); } else { piso = 0; } String localidad = textBoxLocalidad.Text; bool creacionAbortada = false; int usuarioNuevo = ConsultasSQL.crearUser(nombre.Replace(" ", "_") + "_" + apellido.Replace(" ", "_"), creacionAbortada, autogenerarContrasenia.contraGeneradaAString(), "Cliente"); if (creacionAbortada == false) { consultasSQLCliente.AgregarCliente(nombre, apellido, tipo_documento, numero_documento, mail, nro_tarjeta, cuit, telefono, fecha_nacimiento, DateTime.Today); consultasSQLCliente.AgregarDomicilio(calle, nroCalle, piso, dto, localidad, codPostal, "Cliente"); } else { MessageBox.Show("Error al crear el nuevo usuario al consultar la base de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // this.limpiarCuadrosDeTexto(); return; }