private void button1_Click(object sender, EventArgs e) { string sexo = comboBox2.Text.ToString(); if (sexo == "Masculino") sexo = "M"; if (sexo == "Femenino") sexo = "F"; cc = ConnectorClass.Instance; string seleccion = "SELECT me_persona ID, pe_nombre NOMBRE, pe_apellido APELLIDO, pe_sexo SEXO, pe_fecha_nac AS 'FECHA DE NACIMIENTO', me_matricula MATRICULA, pe_tipo_doc AS 'TIPO DOC', pe_num_doc AS 'NUMERO DOC', 'CLICK PARA EDITAR' AS 'SELECCIONAR'"; string origen = " FROM BUGDEVELOPING.MEDICO JOIN BUGDEVELOPING.PERSONA ON (PE_ID = ME_PERSONA)"; string condicion = " WHERE ME_ACTIVO = 1"; if (textBox1.Text != "") { condicion += " and PE_NOMBRE like " + "'%" + textBox1.Text + "%'"; } if (textBox2.Text != "") { condicion += "and PE_APELLIDO like " + "'%" + textBox2.Text + "%'"; } if (textBox3.Text != "") { condicion += " and PE_NUM_DOC like " + "'%" + textBox3.Text + "%'"; } if (dateTimePicker1.Value != ConnectorClass.getFechaSistema()) { condicion += " and PE_FECHA_NAC = '" + dateTimePicker1.Text + "'"; } if (comboBox2.Text != "") { condicion += " and PE_SEXO = '" + sexo + "'"; } if (textBox7.Text != "") { condicion += " and ME_MATRICULA like " + "'%" + textBox7.Text + "%'"; } dataGridView1.DataSource = cc.executeQuery(seleccion + origen + condicion); dataGridView1.Enabled = true; }
private void button2_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("Debe seleccionar el profesional a dar de baja."); } else { cc = ConnectorClass.Instance; String query = "SELECT PE_NOMBRE, PE_APELLIDO FROM BUGDEVELOPING.MEDICO JOIN BUGDEVELOPING.PERSONA ON (PE_ID = ME_PERSONA) WHERE PE_ID = '" + textBox1.Text + "'"; dt = cc.executeQuery(query); DialogResult resultConfirm = MessageBox.Show("Esta a punto de eliminar al profesional: " + dt.Rows[0].ItemArray[0].ToString() + " " + dt.Rows[0].ItemArray[0].ToString() + ". Se cancelarán automaticamente todos sus turnos. ¿Desea continuar?", "Eliminar Profesional", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultConfirm == DialogResult.Yes) { query = "UPDATE BUGDEVELOPING.MEDICO SET ME_ACTIVO = 0 WHERE ME_PERSONA = '" + textBox1.Text + "'"; cc.executeQuery(query); query = "UPDATE BUGDEVELOPING.TURNO SET T_ACTIVO = 0 WHERE T_MEDICO = '" + textBox1.Text + "'"; MessageBox.Show("El profesional ha sido dado de baja."); BajaProfesional_Load(sender, e); } } }
private void ListadoProfesional_Load(object sender, EventArgs e) { //carga del dataGridView lista de profesionales cc = ConnectorClass.Instance; dt = cc.executeQuery("SELECT me_persona ID, pe_nombre NOMBRE, pe_apellido APELLIDO, pe_sexo SEXO, pe_fecha_nac AS 'FECHA DE NACIMIENTO', me_matricula MATRICULA, pe_tipo_doc AS 'TIPO DOC', pe_num_doc AS 'NUMERO DOC' FROM BUGDEVELOPING.MEDICO JOIN BUGDEVELOPING.PERSONA ON (PE_ID = ME_PERSONA) WHERE ME_ACTIVO = 1"); dataGridView1.DataSource = dt; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //setea el formato del datetimepicker y la hora del sistema dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = "dd/MM/yyyy"; dateTimePicker1.Value = ConnectorClass.getFechaSistema(); //carga del comboBox sexo y tipo de documento comboBox2.Items.Add("Masculino"); comboBox2.Items.Add("Femenino"); comboBox1.Items.Add("DNI"); comboBox1.Items.Add("LE"); comboBox1.Items.Add("CI"); }
private void button1_Click(object sender, EventArgs e) { string nombre = textBox1.Text.ToString(); string apellido = textBox2.Text.ToString(); string direccion = textBox4.Text.ToString(); string telefono = textBox5.Text.ToString(); string mail = textBox6.Text.ToString(); string sexo = comboBox2.Text.ToString(); if (comboBox2.Text.ToString() == "Masculino") sexo = "M"; if (comboBox2.Text.ToString() == "Femenino") sexo = "F"; string fechaNacimiento = dateTimePicker1.Value.ToString(); string tipoDoc = comboBox1.Text.ToString(); string nroDoc = textBox3.Text.ToString(); string matricula = textBox7.Text.ToString(); if (textBox1.Text.Length.Equals(0)) { MessageBox.Show("Debe ingresar el nombre del profesional.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (textBox2.Text.Length.Equals(0)) { MessageBox.Show("Debe ingresar el apellido del profesional.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (textBox3.Text.Length.Equals(0)) { MessageBox.Show("Debe ingresar el documento del profesional.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (comboBox1.Text.Length.Equals(0)) { MessageBox.Show("Debe seleccionar el tipo de documento.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (comboBox1.Text.Length.Equals(0)) { MessageBox.Show("Debe seleccionar el sexo.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (textBox7.Text.Length.Equals(0)) { MessageBox.Show("Debe ingresar la matricula del profesional.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (checkedListBox1.CheckedItems.Count == 0) //VALIDA LA CANTIDAD DE ESPECIALIDADES ESCOGIDAS { MessageBox.Show("Debe seleccionar al menos una especialidad"); } else { //INSERTA EN LA BASE LOS DATOS DE LA PERSONA FuncionesProfesional.registrarPersona(nombre, apellido, direccion, telefono, mail, sexo, fechaNacimiento, tipoDoc, nroDoc); //INSERTA EN LA BASE LOS DATOS DEL PROFESIONAL cc = ConnectorClass.Instance; dt = cc.executeQuery("select PE_ID FROM BUGDEVELOPING.PERSONA WHERE (PE_NUM_DOC = '" + nroDoc + "' AND PE_NOMBRE = '" + nombre + "' AND PE_APELLIDO = '" + apellido + "')"); String idProfesional = dt.Rows[0].ItemArray[0].ToString(); String query = "INSERT INTO BUGDEVELOPING.MEDICO (ME_PERSONA, ME_MATRICULA, ME_ACTIVO)"; String datosAIngresar = " VALUES ('" + idProfesional + "', '" + matricula + "', 1)"; cc.executeQuery(query + datosAIngresar); //RECORRE LA LISTA DE ESPECIALIDADES SELECCIONADAS PARA EL MEDICO foreach (DataRowView FilaSeleccionados in checkedListBox1.CheckedItems) { //INGRESA EN LA BASE PARA LA TABLA ESPECIALIDAD_MEDICO String strEspCod = FilaSeleccionados["ES_ID"].ToString(); query = "INSERT INTO BUGDEVELOPING.ESPECIALIDAD_MEDICO (EM_MEDICO, EM_ESPECIALIDAD) VALUES ('" + idProfesional + "', '" + strEspCod + "')"; cc.executeQuery(query); } MessageBox.Show("Profesional Creado Exitosamente"); button2_Click(sender, e); } }
private void FormAbmRolLoad(object sender, EventArgs e) { //MUESTRA LAS FUNCIONALIDADES QUE SE PUEDEN ESCOGER PARA DICHO ROL NUEVO cc = ConnectorClass.Instance; dt = cc.executeQuery("SELECT FUNCIONALIDAD_ID, FUNCIONALIDAD_NOMBRE FROM BUGDEVELOPING.FUNCIONALIDAD order by FUNCIONALIDAD_NOMBRE"); checkedListBoxFuncionalidades.DataSource = dt; checkedListBoxFuncionalidades.DisplayMember = "FUNCIONALIDAD_NOMBRE"; checkedListBoxFuncionalidades.ValueMember = "FUNCIONALIDAD_ID"; }
private void MenuAfiliado_Load(object sender, EventArgs e) { cc = ConnectorClass.Instance; }