/// <summary> /// agregamos a los administrativos /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAgregar_Click(object sender, EventArgs e) { if (int.TryParse(txtBoxDNI.Text, out int dniNoDocente) && DateTime.TryParse(txtBoxHoraIn.Text, out DateTime horaIn) && DateTime.TryParse(txtBoxHoraOut.Text, out DateTime horaOut)) { administrativo = new Administrativo(txtBoxApellido.Text, txtBoxNombre.Text, dniNoDocente, checkBoxFem.Checked, horaIn, horaOut, (ECargo)Enum.Parse(typeof(ECargo), comboBoxCargo.Text)); SoundPlayer sound = new SoundPlayer(@"c:\Windows\Media\notify.wav"); sound.Play(); DialogResult resultado = new DialogResult(); Form mensaje = new FrmMessageBox(); resultado = mensaje.ShowDialog(); } else { DialogResult resul = new DialogResult(); Form msj = new FrmMessageBoxError(); resul = msj.ShowDialog(); } }
/// <summary> /// Se agregan los datos /// Informacion de datetime https://docs.microsoft.com/es-es/dotnet/api/system.datetime?view=netcore-3.1 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAgregar_Click(object sender, EventArgs e) { if (int.TryParse(txtBoxDNI.Text, out int dniDocente) && DateTime.TryParse(txtBoxHoraIn.Text, out DateTime horaIn) && DateTime.TryParse(txtBoxHoraOut.Text, out DateTime horaOut) && float.TryParse(txtBoxValorHora.Text, out float valorHora)) { docente = new Docente(txtBoxNombre.Text, txtBoxApellido.Text, dniDocente, checkBoxFem.Checked, horaIn, horaOut, valorHora); listaDocente.Add(docente); SoundPlayer sound = new SoundPlayer(@"c:\Windows\Media\notify.wav"); sound.Play(); DialogResult resultado = new DialogResult(); Form mensaje = new FrmMessageBox(); resultado = mensaje.ShowDialog(); } else { DialogResult resul = new DialogResult(); Form msj = new FrmMessageBoxError(); resul = msj.ShowDialog(); } }
/// <summary> /// Se agregan los datos /// info de datetime https://docs.microsoft.com/es-es/dotnet/api/system.datetime?view=netcore-3.1 /// info //this.nuevoAlumno = new Alumno(this.txtBoxNombre.Text, this.txtBoxApellido.Text, Convert.ToInt32(txtBoxDNILegajo.Text), this.radioBtnFem.Checked, Convert.ToInt64(txtBoxPrecio.Text)); /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAgregar_Click(object sender, EventArgs e) { if (int.TryParse(txtBoxDNI.Text, out int dniAlumno) && float.TryParse(txtBoxPrecio.Text, out float precioCuota) && int.TryParse(txtBoxLegajo.Text, out int Legajo) && int.TryParse(txtBoxDNIR.Text, out int dniResponsable)) { nuevoAlumno = new Alumno(txtBoxNombre.Text, txtBoxApellido.Text, dniAlumno, checkBoxFem.Checked, (EColores)Enum.Parse(typeof(EColores), comboBoxSala.Text), Legajo, precioCuota, responsable); responsable = new Responsable(txtBoxNombreR.Text, txtBoxApellidoR.Text, dniResponsable, (EParentesco)Enum.Parse(typeof(EParentesco), comboBoxParen.Text), txtBoxTel.Text); SoundPlayer sound = new SoundPlayer(@"c:\Windows\Media\notify.wav"); sound.Play(); DialogResult resultado = new DialogResult(); Form mensaje = new FrmMessageBox(); resultado = mensaje.ShowDialog(); } else { DialogResult resul = new DialogResult(); Form msj = new FrmMessageBoxError(); resul = msj.ShowDialog(); } }