private void addsubpro_btn_Click(object sender, EventArgs e) { DBManager c = new DBManager(); c.valor = ""; string status = "Sin Realizar"; string query = "select idprocedure, subprocedure, tooth from subprocedure where idprocedure = '" + vsp_idprocedure_txt.Text + "' and subprocedure = '" + vsp_activity_txt.Text + "' and tooth = '" + vsp_tooth_txt.Text + "'"; c.validation(query); if (c.valor == "si") { MessageBox.Show("No puede agregar el mismo sub-procedimiento al mismo diente dos veces.", "Error al agregar"); c.valor = ""; } else { string query2 = "INSERT INTO subprocedure(idprocedure, codeinsurance, subprocedure, tariff, coverage, difference, status, insurance, tooth) VALUES('" + vsp_idprocedure_txt.Text + "', '" + vsp_codeinsu_txt.Text + "','" + vsp_activity_txt.Text + "','" + vsp_tariff_txt.Text + "', '" + vsp_coverage_txt.Text + "', '" + vsp_difference_txt.Text + "', '" + status + "', '" + vsp_insurance_txt.Text + "', '" + vsp_tooth_txt.Text + "')"; c.command(query2); } }
private void btnguardar_Click(object sender, EventArgs e) { string query0 = "Select * from datem where date = '" + dtpfecha.Text + "' and time = '" + dtphora.Text + "' and iddoctor = '" + txtiddo.Text + "'"; c.validation(query0); if (c.valor == "si") { MessageBox.Show("NO se puede agregar, debido a que ya hay una cita a esa hora"); c.valor = ""; } else if (c.valor == "no") { string query = "INSERT INTO datem(idpatient,namepa,iddoctor,namedoctor,assist,date,time) values('" + txtidpa.Text + "','" + txtpaciente.Text + "','" + txtiddo.Text + "','" + txtdoct.Text + "','Pendiente','" + dtpfecha.Text + "','" + dtphora.Text + "')"; c.command(query); txtidpa.Clear(); txtpaciente.Clear(); txtdoct.Clear(); txtiddo.Clear(); c.valor = ""; } }