public static void insertCliente(String dni, String fecha, String nombre, String apellido, String sexo, String discapacidad, String direccion, String telefono, String mail) { String query = "insert into BUGDEVELOPING.CLIENTE (CLIENTE_DNI, CLIENTE_FECHA_NACIMIENTO, CLIENTE_NOMBRE, CLIENTE_APELLIDO, CLIENTE_SEXO, CLIENTE_DISCAPACIDAD, CLIENTE_DIRECCION, CLIENTE_TELEFONO, CLIENTE_MAIL) values ('" + dni + "', cast('" + fecha + "' as datetime), '" + nombre + "', '" + apellido + "', '" + sexo + "', '" + discapacidad + "', '" + direccion + "', '" + telefono + "', '" + mail + "')"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }
public static void DarDeBajaARecorrido(string codigoRecorrido) { string query = "UPDATE BUGDEVELOPING.RECORRIDO SET RECORRIDO_ACTIVO = 0 WHERE RECORRIDO_CODIGO ='" + codigoRecorrido + "'"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }
public static void modificarNombreYHabilitacion(String codRol, String rolNombre, String rolHabilitacion) { String query = "UPDATE BUGDEVELOPING.ROL SET ROL_NOMBRE = '" + rolNombre + "', ROL_HABILITACION = '" + rolHabilitacion + "' WHERE (ROL_ID = " + codRol + " )"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }
public static bool microEstaFueraDeServicioDurante(string patante, DateTime fechaComienzo, DateTime fechaFin) { bool estaFueraDeServicio = false; DataTable Dt; string comienzo = "'" + fechaComienzo.ToString("yyyyMMdd HH:mm:ss") + "'"; string fin = "'" + fechaFin.ToString("yyyyMMdd HH:mm:ss") + "'"; /*Chequeo que el micro no este fuera de servicio en esas fechas*/ string select = "SELECT *"; string from = "FROM BUGDEVELOPING.MICRO_FUERA_SERVICIO "; String whereCondition1 = "WHERE MICRO_FUERA_SERVICIO_PATENTE = '" + patante + "'"; string whereCondition2a = "and" + "((" + comienzo + " between MICRO_FUERA_SERVICIO_FECHA_INICIO and MICRO_FUERA_SERVICIO_FECHA_REINCORPORACION)"; string whereContition2b = "or" + "(" + fin + "between MICRO_FUERA_SERVICIO_FECHA_INICIO and MICRO_FUERA_SERVICIO_FECHA_REINCORPORACION))"; String query = select + from + whereCondition1 + whereCondition2a + whereContition2b; ConnectorClass conexion = ConnectorClass.Instance; Dt = conexion.executeQuery(query); if (Dt.Rows.Count > 0) { estaFueraDeServicio = true; } return(estaFueraDeServicio); }
public static DataTable obtenerCamposDeRecorrido(object codigoDeRecorrido) { String query = "SELECT * FROM BUGDEVELOPING.V_RECORRIDO WHERE BUGDEVELOPING.V_RECORRIDO.RECORRIDO_CODIGO ='" + codigoDeRecorrido + "'"; ConnectorClass conexion = ConnectorClass.Instance; return(conexion.executeQuery(query)); }
private void InfoProfesionalSeleccionado_Load(object sender, EventArgs e) { if (quienEs2 != "Administrador del Sistema") { agregarAfiliado.Enabled = false; numeroDeAfiliado.Enabled = false; } else { agregarAfiliado.Enabled = true; numeroDeAfiliado.Enabled = true; diasDeLaSemana.Enabled = false; buscarHorario.Enabled = false; limpiarGrilla.Enabled = false; fechasDisponibles.Enabled = false; } AgregarFechasALaLista(); generarComboboxFechas(); ConnectorClass Conexion = ConnectorClass.Instance; DataTable Dt; Dt = Conexion.executeQuery("select distinct DIA_NOMBRE, DIA_ID from BUGDEVELOPING.AGENDA_PERSONAL inner join BUGDEVELOPING.AGENDA_DIA on (AG_CODIGO = AGD_AG_CODIGO) inner join BUGDEVELOPING.DIA on (AGD_DIA_ID = DIA_ID) where AG_MEDICO = " + idProfesional + "and DIA_ID != 7"); diasDeLaSemana.DataSource = Dt; diasDeLaSemana.DisplayMember = "DIA_NOMBRE"; diasDeLaSemana.ValueMember = "DIA_ID"; diasDeLaSemana.SelectedItem = null; fechasDisponibles.SelectedItem = null; }
public static void borrarRolXUsuario(int codRol) { String query = "UPDATE BUGDEVELOPING.USUARIO SET USUARIO_ROL = NULL WHERE ( USUARIO_ROL = " + codRol + ")"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }
public static void actualizarCancelacion(String codigoPasajeEncomienda, String motivoCancelacion) { String fecha = ConfigurationManager.AppSettings["SystemYear"] + ConfigurationManager.AppSettings["SystemMonth"] + ConfigurationManager.AppSettings["SystemDay"]; String query = "insert into BUGDEVELOPING.CANCELACION(CANCELACION_CODIGO_PASAJE_ENCOMIENDA, CANCELACION_FECHA_DEVOLUCION, CANCELACION_MOTIVO) values ('" + codigoPasajeEncomienda + "', cast('" + fecha + "' as datetime), '" + motivoCancelacion + "')"; ConnectorClass conexion = ConnectorClass.Instance; DataTable dt = conexion.executeQuery(query); }
private string obtenerIdDePersona(AfiliadoPersona persona) { DataTable Dt; String query = "SELECT pe_id FROM BUGDEVELOPING.PERSONA WHERE '" + persona.nombre + "' = pe_nombre AND '" + persona.apellido + "' = pe_apellido AND '" + //persona.direccion + "' = pe_direccion AND " + //persona.telefono + " = pe_telefono AND '" + //persona.sexo + "' = pe_sexo AND '" + //persona.mail + "' = pe_mail AND '" + persona.tipoDoc + "' = pe_tipo_doc AND " + persona.nroDoc + " = pe_num_doc"; //String query = "SELECT pa_nAfiliado FROM BUGDEVELOPING.PERSONA join BUGDEVELOPING.PACIENTE on (pa_persona = pe_id)WHERE " + this.titular.nombre + " = pe_nombre AND " + // persona.apellido + " = pe_apellido AND " + // persona.direccion + " = pe_direccion AND " + // persona.telefono + " = pe_telefono AND " + // persona.sexo + " = pe_sexo AND " + // persona.mail + " = pe_mail AND " + // persona.tipoDoc + " = pe_tipo_doc AND " + // persona.nroDoc + " = pe_numdoc"; ConnectorClass conexion = ConnectorClass.Instance; Dt = conexion.executeQuery(query); if (Dt.Rows.Count == 0) { return(""); } return(Dt.Rows[0].ItemArray[0].ToString()); }
private void grillaProfesional_CellContentClick(object sender, DataGridViewCellEventArgs e) { TimeSpan horaDelTurno = (TimeSpan)grillaProfesional.CurrentRow.Cells[3].Value; if ((grillaProfesional.Rows.Count > 0) && (grillaProfesional.Columns[e.ColumnIndex].HeaderText == "Seleccionar") && llegoEnHorario(horaDelTurno)) { if (existeAfiliado()) { ConnectorClass con = ConnectorClass.Instance; // String query3 = "SELECT TOP 1 bc.ID_BONO_CONSULTA FROM HARDWELL.BONO_CONSULTA as bc inner join HARDWELL.COMPRA_BONO_CONSULTA as cbc on (bc.ID_BONO_CONSULTA=cbc.ID_BONO_CONSULTA) WHERE CBC.NRO_AFILIADO=" + nombreAfiliado.Text + "AND BC.NUMERO_CONSULTA is NULL"; // DataTable dt2 = con.executeQuery(query3); if (idBonoAUsar.Text != "" && existeBonoAUsar()) //si tiene bonos { String idTurno = grillaProfesional.CurrentRow.Cells[1].Value.ToString(); DateTime fechaConsulta = (DateTime)grillaProfesional.CurrentRow.Cells[2].Value; //String patternInsertarTurno = "INSERT INTO HARDWELL.TURNO (NRO_AFILIADO, ID_PROFESIONAL, ID_AGENDA, FECHA, HORA) VALUES ({0},{1},{2},CONVERT(DATE,'{3}',112),CONVERT(TIME,'{4}',112))"; //String queryInsertarTurno = String.Format(patternInsertarTurno, idAfiliado, idProfesional, idAgenda, fecha.ToString("yyyyMMdd"), hora); //con.executeQuery(queryInsertarTurno); //TOQUE ACA Y ARREGLE !! String patternInsertarConsulta = "insert into BUGDEVELOPING.CONSULTA (ID_TURNO,FECHA_CONSULTA,HORA_LLEGADA,HORA_INICIO) values ({0},CONVERT(DATE,'{1}',112),CONVERT(TIME,'{2}',112),CONVERT(TIME,'{3}',112))"; String query = String.Format(patternInsertarConsulta, idTurno, fechaConsulta.ToString("yyyyMMdd"), horaLlegada, horaDelTurno); //" values ('" + idTurno + "','" + fechaConsulta + "', '" + horaLlegada + "' ,'" + horaDelTurno + "')"; con.executeQuery(query); String query2 = "select CON_NUMERO from BUGDEVELOPING.CONSULTA where CON_TURNO=" + idTurno; DataTable dt = con.executeQuery(query2); String nroConsulta = dt.Rows[0].ItemArray[0].ToString(); //String idBono = dt2.Rows[0].ItemArray[0].ToString(); String query4 = "update BUGDEVELPING.BONO_CONSULTA set BC_NUMERO_CONSULTA=" + nroConsulta + "where BC_BONO_NUMERO=" + idBonoAUsar.Text; con.executeQuery(query4); MessageBox.Show("Consulta creda exitosamente"); LlenarTurnos(); this.Close(); } else { MessageBox.Show("Coloque el nro de bono a usar correcto"); LlenarTurnos(); } } else { MessageBox.Show("Numero de Afiliado Invalido"); } } else { MessageBox.Show("El turno esta perdido, llego tarde"); } }
private void CancelacionAfiliado_Load(object sender, EventArgs e) { String fechaSistema = ConfigurationManager.AppSettings["fechaSistema"]; year = fechaSistema.Substring(1, 4); month = fechaSistema.Substring(5, 2); day = fechaSistema.Substring(7, 2); time = fechaSistema.Substring(10, 8); ConnectorClass con = ConnectorClass.Instance; if (CancelacionAdmSist.nroAfilOProf != 0) { textBoxNroAfil.Text = CancelacionAdmSist.nroAfilOProf.ToString(); } else { String idUsuario = "select usuario_id from bugdeveloping.usuario where usuario_username = '******' "; DataTable id_Usuario = con.executeQuery(idUsuario); String numeroAfiliado = "select PA_NAFILIADO from BUGDEVELOPING.PERSONA JOIN BUGDEVELOPING.PACIENTE ON (PE_ID = PA_PERSONA) where PE_USUARIO_ID = '" + id_Usuario.Rows[0][0] + "'"; DataTable nroAfiliado = con.executeQuery(numeroAfiliado); textBoxNroAfil.Text = nroAfiliado.Rows[0][0].ToString(); } }
public static void insertCompraTarjeta(String pasajeEncomiendaNro, String fecha, String dni, String compraNro, String tarjetaNro, String cuotas) { String query = "insert into BUGDEVELOPING.COMPRA (COMPRA_CODIGO_PASAJE_ENCOMIENDA, COMPRA_FECHA, COMPRA_COMPRADOR, COMPRA_MODALIDAD_PAGO, COMPRA_NUMERO_TARJETA, COMPRA_NUMERO_CUOTAS, COMPRA_NUMERO_VOUCHER) values ('" + pasajeEncomiendaNro + "', cast('" + fecha + "' as datetime), '" + dni + "', 'Tarjeta', '" + tarjetaNro + "', '" + cuotas + "', '" + compraNro + "')"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }
public static void insertEncomienda(String nro, String kgs) { String query = "insert into BUGDEVELOPING.ENCOMIENDA (ENCOMIENDA_CODIGO, ENCOMIENDA_KG_UTILIZADOS) values ('" + nro + "', '" + kgs + "')"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }
public static void insertPasaje(String nro, String patente, String butacaNro, String butacaPiso) { String query = "insert into BUGDEVELOPING.PASAJE (PASAJE_CODIGO, PASAJE_MICRO_PATENTE, PASAJE_NUMERO_BUTACA, PASAJE_PISO_BUTACA) values ('" + nro + "', '" + patente + "', '" + butacaNro + "', '" + butacaPiso + "')"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }
private void modificarAfiliado() { String pattern; String query; ConnectorClass con = ConnectorClass.Instance; System.Diagnostics.Debug.WriteLine("Se modificará el afiliado.."); pattern = "UPDATE BUGDEVELOPING.PERSONA SET PE_NOMBRE = '{0}', PE_APELLIDO = '{1}', PE_NUM_DOC = {2}, PE_DIRECCION = '{3}', PE_TELEFONO = '{4}', PE_MAIL = '{5}', PE_TIPO_DOC = {6}, PE_SEXO = {7}, PE_FECHA_NAC = '{8}' WHERE PE_ID = {9}"; query = String.Format(pattern, maskedNombre.Text.Trim(), maskedApellido.Text.Trim(), documento.Text, maskedDireccion.Text.Trim(), maskedTelefono.Text.Trim(), mail.Text, tipoDocumento.SelectedValue, sexo.SelectedValue, fechaNacimiento.Value.Date.ToString("yyyy-dd-MM"), selected.Cells["PE_ID"].Value.ToString()); System.Diagnostics.Debug.WriteLine(query); con.executeQuery(query); pattern = "UPDATE BUGDEVELOPING.PACIENTE SET PA_ESTADO_CIVIL = {0} WHERE PA_NAFILIADO = {1}"; query = String.Format(pattern, estadoCivil.SelectedValue, selected.Cells["NRO_AFILIADO"].Value.ToString()); System.Diagnostics.Debug.WriteLine(query); con.executeQuery(query); if (!selected.Cells["ID_PLAN_MEDICO"].Value.Equals(planMedico.SelectedValue)) { ConfirmarCambioPlan window = new ConfirmarCambioPlan(); DialogResult resultSeleccion = window.ShowDialog(); if (resultSeleccion == DialogResult.OK) { pattern = "EXECUTE BUGDEVELOPING.CAMBIO_PLAN_MEDICO_PACIENTE {0},{1},{2},'{3}'"; query = String.Format(pattern, planMedico.SelectedValue, selected.Cells["NRO_AFILIADO"].Value.ToString(), ConfigurationManager.AppSettings["fechaSistema"], window.motivo); System.Diagnostics.Debug.WriteLine(query); con.executeQuery(query); } } }
private void cargarDatosDeAfiliado() { DataTable Dt; String query = "SELECT pa_nAfiliado, pl_codigo, pe_nombre, pe_apellido, pe_tipo_doc, pe_num_doc, pe_direccion, pe_fecha_nac, pe_telefono, pe_sexo, pe_mail, pa_estado_civil, pa_cantidad_asignado,pe_id from BUGDEVELOPING.PERSONA join BUGDEVELOPING.PACIENTE on(pe_id = pa_persona) join BUGDEVELOPING.PLAN_MEDICO on (pa_plan = pl_codigo) WHERE pa_nAfiliado =" + this.numeroAfiliado; ConnectorClass conexion = ConnectorClass.Instance; Dt = conexion.executeQuery(query); label_NumeroAfiliado.Text = Dt.Rows[0].ItemArray[0].ToString(); comboBox_planMedico.SelectedValue = Dt.Rows[0].ItemArray[1].ToString(); textBox_Nom.Text = Dt.Rows[0].ItemArray[2].ToString(); textBox_Apellido.Text = Dt.Rows[0].ItemArray[3].ToString(); comboBox_tipoDocumento.SelectedValue = (Dt.Rows[0].ItemArray[4].ToString() == "") ? "0" : Dt.Rows[0].ItemArray[4].ToString(); if (comboBox_tipoDocumento.Text == "Seleccione") { comboBox_tipoDocumento.Enabled = true; } textBox_NumeroDoc.Text = Dt.Rows[0].ItemArray[5].ToString(); textBox_Direccion.Text = Dt.Rows[0].ItemArray[6].ToString(); dateTimePicker1.Text = Dt.Rows[0].ItemArray[7].ToString(); textBox_Telefono.Text = Dt.Rows[0].ItemArray[8].ToString(); comboBox_sexo.SelectedValue = (Dt.Rows[0].ItemArray[9].ToString() == "") ? "0" : Dt.Rows[0].ItemArray[9].ToString(); textBox_Mail.Text = Dt.Rows[0].ItemArray[10].ToString(); comboBox_EstadoCivil.SelectedValue = (Dt.Rows[0].ItemArray[11].ToString() == "") ? "0" : Dt.Rows[0].ItemArray[11].ToString(); nAfiliadosRelativos = Convert.ToInt32(Dt.Rows[0].ItemArray[12].ToString()); persona_iDDB = Dt.Rows[0].ItemArray[13].ToString(); this.viejoPlan = comboBox_planMedico.Text; this.originalPlan = this.viejoPlan; }
private void button2_Click(object sender, EventArgs e) { int result = 0; if (!int.TryParse(numeroDeAfiliado.Text, out result)) { numeroDeAfiliado.Text = ""; MessageBox.Show("Solo se permiten numeros"); } else { idPaciente2 = numeroDeAfiliado.Text; ConnectorClass con = ConnectorClass.Instance; string query = "select * from BUGDEVELOPING.PACIENTE where PA_NAFILIADO = " + idPaciente2; DataTable data = new DataTable(); data = con.executeQuery(query); if (data.Rows.Count != 0) { //osea el profesional existe agregarAfiliado.Enabled = false; numeroDeAfiliado.Enabled = false; diasDeLaSemana.Enabled = true; buscarHorario.Enabled = true; limpiarGrilla.Enabled = true; fechasDisponibles.Enabled = true; } else { MessageBox.Show("El afiliado elegido no existe"); } } }
public static void insertarReceta_Droga(String idReceta, String idMedicamento, String cantidad, String aclaracion) { ConnectorClass con = ConnectorClass.Instance; String query = "INSERT INTO BUGDEVELOPING.MEDICAMENTOS_X_RECETA (MXR_RECETA, MXR_MEDICAMENTO, MXR_CANTIDAD, MXR_CANTIDAD_ACLARACION) VALUES (" + idReceta + "," + idMedicamento + ", " + cantidad + ", '" + aclaracion + "' )"; con.executeQuery(query); }
private void aceptar_Click(object sender, EventArgs e) { if (idProfesional.Equals(0L)) { MessageBox.Show("No seleccionó ningún profesional. Por favor seleccione uno para poder continuar.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (idAfiliado.Equals(0L)) { MessageBox.Show("No seleccionó ningún afiliado. Por favor seleccione uno para poder continuar.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!turnos.SelectedRows.Count.Equals(1)) { MessageBox.Show("No seleccionó ningún turno.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } ConnectorClass con = ConnectorClass.Instance; DateTime fecha = (DateTime)turnos.SelectedRows[0].Cells["FECHA"].Value; TimeSpan hora = (TimeSpan)turnos.SelectedRows[0].Cells["HORA"].Value; String patternInsertarTurno = "INSERT INTO BUGDEVELOPING.TURNO (T_AFILIADO, T_MEDICO, T_AGENDA, T_FECHA, T_HORA, T_ESPECIALIDAD) VALUES ({0},{1},{2},CONVERT(DATE,'{3}',112),CONVERT(TIME,'{4}',112),{5})"; String queryInsertarTurno = String.Format(patternInsertarTurno, idAfiliado, idProfesional, idAgenda, fecha.ToString("yyyyMMdd"), hora, idEspecialidad); con.executeQuery(queryInsertarTurno); MessageBox.Show("El turno fué registrado correctamente.", "Terminado", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); Clinica_Frba.MenuPrincipal.menuActivo.Show(); }
public static void borrarRecetaRecienGenerada(String idBonoFar) { ConnectorClass con = ConnectorClass.Instance; String query = "delete from BUGDEVELOPING.RECETA_MEDICA where (RM_BONO = '" + idBonoFar + "')"; con.executeQuery(query); }
private void buscarMicro_Click(object sender, EventArgs e) { cc = ConnectorClass.Instance; string seleccion = "SELECT MICRO_PATENTE AS 'PATENTE', MARCA_NOMBRE AS 'MARCA' , MICRO_CANTIDAD_KGS AS 'CANT KGS', MICRO_TIPO_SERVICIO AS 'TIPO SERVICIO'"; string origen = " FROM BUGDEVELOPING.MICRO JOIN BUGDEVELOPING.MARCA ON (MICRO_CODIGO_MARCA = MARCA_CODIGO)"; string condicion = " where 1=1"; if (textBoxCantKGS.Text != "") { condicion += " and MICRO_CANTIDAD_KGS >= '" + textBoxCantKGS.Text + "'"; } if (comboBoxMarcaMicro.Text != "") { condicion += "and MARCA_NOMBRE = '" + comboBoxMarcaMicro.Text + "'"; } if (comboBoxTipoServicio.Text != "") { condicion += "and MICRO_TIPO_SERVICIO = '" + comboBoxTipoServicio.Text + "'"; } dataGridView_Micros.DataSource = cc.executeQuery(seleccion + origen + condicion); dataGridView_Micros.Enabled = true; }
private void buscar_Click(object sender, EventArgs e) { if (especialidad.SelectedValue.Equals(0L) && id.Text.Length.Equals(0)) { MessageBox.Show("Debe seleccionar una especialidad o ingresar el ID del profesional.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } long number; if (!especialidad.SelectedValue.Equals(0L)) { ConnectorClass con = ConnectorClass.Instance; String patternProfesionales = "SELECT ME_PERSONA AS 'ID_PROFESIONAL', PE_NOMBRE NOMBRE, PE_APELLIDO APELLIDO, (SELECT TOP 1 AG_CODIGO FROM BUGDEVELOPING.AGENDA_PERSONAL WHERE AG_MEDICO = EM_MEDICO ORDER BY AG_DESDE_DIA DESC) AS AGENDA FROM BUGDEVELOPING.PERSONA JOIN BUGDEVELOPING.MEDICO ON (PE_ID = ME_PERSONA) JOIN BUGDEVELOPING.ESPECIALIDAD_MEDICO ON (EM_MEDICO = ME_PERSONA AND EM_ESPECIALIDAD = {0}) WHERE ME_ACTIVO = 1 AND EXISTS (SELECT TOP 1 AG_CODIGO FROM BUGDEVELOPING.AGENDA_PERSONAL WHERE AG_MEDICO = EM_MEDICO ORDER BY AG_DESDE_DIA DESC)"; String queryProfesionales = String.Format(patternProfesionales, especialidad.SelectedValue); System.Diagnostics.Debug.WriteLine(queryProfesionales); profesionales.DataSource = con.executeQuery(queryProfesionales); } else if (!id.Text.Length.Equals(0) && long.TryParse(id.Text, out number)) { ConnectorClass con = ConnectorClass.Instance; String patternProfesionales = "SELECT ME_PERSONA AS 'ID_PROFESIONAL, PE_NOMBRE NOMBRE, PE_APELLIDO APELLIDO, (SELECT TOP 1 AG_CODIGO FROM BUGDEVELOPING.AGENDA_PERSONAL WHERE AG_MEDICO = {0} ORDER BY AG_DESDE_DIA DESC) AS AGENDA FROM BUGDEVELOPING.PERSONA JOIN FROM BUGDEVELOPING.MEDICO ON (PE_ID = ME_PERSONA) WHERE ME_ACTIVO = 1 AND ME_PERSONA = {0} AND EXISTS (SELECT TOP 1 AG_CODIGO FROM BUGDEVELOPING.AGENDA_PERSONAL WHERE ME_PERSONA = {0} ORDER BY AG_DESDE_DIA DESC)"; String queryProfesionales = String.Format(patternProfesionales, number); System.Diagnostics.Debug.WriteLine(queryProfesionales); profesionales.DataSource = con.executeQuery(queryProfesionales); } }
public Boolean guardarNuevoMicro(string microPatente, string numeroMicro, string fechaAlta, string codigoMarga, string modelo, string tipoServicio, string KGEncomienda) { bool exito = false; DataTable Dt; String query = "EXEC [BUGDEVELOPING].[MICRO_ALTA] '" + microPatente + "'," + numeroMicro + ",'" + fechaAlta + "'," + codigoMarga + ",'" + modelo + "'," + tipoServicio + "," + KGEncomienda; ConnectorClass conexion = ConnectorClass.Instance; Dt = conexion.executeQuery(query); if (Dt.Rows[0].ItemArray[0].ToString() == "PatenteExistente") { MessageBox.Show("La patente ya existe, porfavor, seleccione una nueva", "Alta de micro", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else if (Dt.Rows[0].ItemArray[0].ToString() == "NumeroExistente") { MessageBox.Show("El numero de micro ya existe, porfavor, seleccione otro", "Alta de micro", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else if (Dt.Rows[0].ItemArray[0].ToString() == "GuardadoExistoso") { MessageBox.Show("El micro fue dado de alta exitosamente", "Alta de micro", MessageBoxButtons.OK, MessageBoxIcon.Information); exito = true; } Close(); return(exito); }
public static void RegistrarLlegada(string micro, DateTime fechaLlegada) { /*registra la llegada*/ ConnectorClass cc = ConnectorClass.Instance; cc.executeQuery("UPDATE TOP (1) BUGDEVELOPING.VIAJE SET VIAJE_FECHA_LLEGADA = '" + fechaLlegada + "' WHERE VIAJE_FECHA_LLEGADA IS NULL AND VIAJE_MICRO_PATENTE = '" + micro + "'"); }
public static string generarCodigoRecorrido() { string nuevoCodigo = ""; bool codigoUnico = false; while (!codigoUnico) { var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; var random = new Random(); var result = new string( Enumerable.Repeat(chars, 8) .Select(s => s[random.Next(s.Length)]) .ToArray()); DataTable Dt; String query = "SELECT * FROM BUGDEVELOPING.RECORRIDO WHERE RECORRIDO_CODIGO = '" + result + "'"; ConnectorClass conexion = ConnectorClass.Instance; Dt = conexion.executeQuery(query); if (Dt.Rows.Count == 0) { codigoUnico = true; nuevoCodigo = String.Copy(result); } } return(nuevoCodigo); }
private void buscarRecorrido_Click(object sender, EventArgs e) { cc = ConnectorClass.Instance; string seleccion = "SELECT RECORRIDO_CODIGO AS 'NRO', CO.CIUDAD_NOMBRE AS 'CIUDAD ORIGEN', CD.CIUDAD_NOMBRE AS 'CIUDAD DESTINO', TIPO_SERVICIO_NOMBRE AS 'TIPO SERVICIO'"; string origen = "FROM BUGDEVELOPING.RECORRIDO JOIN BUGDEVELOPING.TIPO_SERVICIO ON (RECORRIDO_TIPO_SERVICIO = TIPO_SERVICIO_CODIGO) JOIN BUGDEVELOPING.CIUDAD CD ON (RECORRIDO_ID_CIUDAD_DESTINO = CD.CIUDAD_ID) JOIN BUGDEVELOPING.CIUDAD CO ON (RECORRIDO_ID_CIUDAD_ORIGEN = CO.CIUDAD_ID)"; string condicion = " where 1=1"; if (textBoxCiudadOrigen.Text != "") { condicion += " and CO.CIUDAD_NOMBRE like " + "'%" + textBoxCiudadOrigen.Text + "%'"; } if (textBoxCiudadDestino.Text != "") { condicion += "and CD.CIUDAD_NOMBRE like " + "'%" + textBoxCiudadDestino.Text + "%'"; } if (comboBoxTipoServicio.Text != "") { condicion += "and TIPO_SERVICIO_NOMBRE = '" + comboBoxTipoServicio.Text + "'"; } dataGridView_Recorridos.DataSource = cc.executeQuery(seleccion + origen + condicion); dataGridView_Recorridos.Enabled = true; }
public static void borrarRolXUsuario(String codRol) { String query = "DELETE FROM BUGDEVELOPING.USUARIO_ROL WHERE ( ROL_ID = " + codRol + ")"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }
private void button1_Click(object sender, EventArgs e) { ConnectorClass con = ConnectorClass.Instance; // PRIMERO LO METE EN LA AGENDA con.executeQuery("insert into BUGDEVELOPING.AGENDA_PERSONAL (AG_MEDICO, AG_DESDE_DIA, AG_HASTA_DIA) values ('" + idProfesionalLogueado + "','" + fDesde + "','" + fHasta + "') "); //AGENDA DIA DataTable idAgenda = con.executeQuery("select top 1 AG_CODIGO from BUGDEVELOPING.AGENDA_PERSONAL WHERE AG_MEDICO ='" + idProfesionalLogueado + "' order by 1 DESC"); String id = idAgenda.Rows[0].ItemArray[0].ToString(); foreach (diaAgenda dia in dias) { if (dia.ocupado == 1) { con.executeQuery("insert into BUGDEVELOPING.AGENDA_DIA (AGD_AG_CODIGO, AGD_DIA_ID, AGD_HORA_INICIO, AGD_HORA_FIN) values ('" + id + "','" + dia.nroDia + "','" + dia.inicio + "','" + dia.fin + "') "); } } MessageBox.Show("Agenda Creada Exitosamente"); finalizar.Enabled = false; }
public static void borrarFuncionalidades(String codRol) { String query = "DELETE FROM BUGDEVELOPING.FUNROL WHERE ( ROL_ID = " + codRol + " )"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }
public static void updateCliente(String dni, String fecha, String nombre, String apellido, String sexo, String discapacidad, String direccion, String telefono, String mail) { String query = "update BUGDEVELOPING.CLIENTE set CLIENTE_FECHA_NACIMIENTO = CAST('" + fecha + "' as datetime ), CLIENTE_NOMBRE = '" + nombre + "', CLIENTE_APELLIDO = '" + apellido + "', CLIENTE_SEXO = '" + sexo + "', CLIENTE_DISCAPACIDAD = '" + discapacidad + "', CLIENTE_DIRECCION = '" + direccion + "', CLIENTE_TELEFONO = '" + telefono + "', CLIENTE_MAIL = '" + mail + "' where CLIENTE_DNI = '" + dni + "'"; ConnectorClass conexion = ConnectorClass.Instance; conexion.executeQuery(query); }