private void guardarTransaccion() { List <string> transaccion = new List <string>(); string sql1 = "Insert into Plan_Trp (id_dieta) values (" + cboDietas.SelectedValue.ToString() + ")"; string sql2 = " declare @idtrp int set @idtrp = IDENT_CURRENT ('Plan_Trp') " + "insert into Atenciones_Medicas (id_hc, motivo_consulta, diagnostico, id_planTrp) values (" + paciente.historiaClinica + ", '" + rtbMotivo.Text + "', '" + rtbDiagnostico.Text + "',@idtrp)"; transaccion.Add(sql1); transaccion.Add(sql2); for (int i = 0; i < dgvMedicamentos.Rows.Count; i++) { string sqln = "declare @idtrp int set @idtrp = IDENT_CURRENT ('Plan_Trp')" + "Insert into Detalle_Medicamento (id_medicamento, frecuencia, duracion, id_plan) values " + "(" + int.Parse(dgvMedicamentos.Rows[i].Cells[0].Value.ToString()) + ", '" + dgvMedicamentos.Rows[i].Cells[3].Value.ToString() + "', '" + dgvMedicamentos.Rows[i].Cells[4].Value.ToString() + "',@idtrp)"; transaccion.Add(sqln); } datos.conectarTransaccion(); datos.ejecutarTransaccion(transaccion); datos.desconectar(); }
private void nuevoPaciente() { paciente = new clsPaciente(); paciente.nombre = txtNombre.Text; paciente.apellido = txtApellido.Text; paciente.dni = long.Parse(txtDNI.Text); paciente.telefono = long.Parse(txtTelefono.Text); paciente.nacimiento = dtpNacimiento.Value.ToString("yyyyMMdd"); paciente.obra_Social = int.Parse(cboObraSocial.SelectedValue.ToString()); paciente.nro_Afiliado = long.Parse(txtNumeroDeSocio.Text); paciente.domicilio = txtDomicilio.Text; oDatos.conectarTransaccion(); pacienteHelper.agregarPaciente(paciente, oDatos); oDatos.desconectar(); //MessageBox.Show("Paciente Agredado", "Añadir Paciente", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }