private void button1_Click(object sender, EventArgs e) { Orientador O = new Orientador(); // = this.textBox_nombre.Text; //string mes = txt_mes.Text; //string dirigido = txt_dirigido.Text; //comprobacion del numero de vacantes para que no se caiga try { int num = Int32.Parse(this.label5.Text); } catch (Exception) { MessageBox.Show("Wrong number bitch!", "System", MessageBoxButtons.OK, MessageBoxIcon.Stop); } //PA.EstaVigente = 1; //PA.FechaCreacion = DateTime.Today; if (Nombre.Text.Equals("") || label2.Text.Equals("") || label3.Text.Equals("") || label4.Text.Equals("") || label5.Text.Equals("")) { MessageBox.Show("Datos inconsistentes", "System", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { this.Close(); MessageBox.Show("Registrado", "System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //this.ProcesosAdmision.Add(PA);//agrego el proceso a la lista } }
public ActionResult Add(OrientadorVM orientadorRecebido) { var query = ObterListaUsuarios().Where(c => c.Login.Equals(User.Identity.Name)).ToList(); if (query.Count == 0) { return(HttpNotFound()); } Orientador novoOrientador = orientadorRecebido.ToOrientador(); bool codigoExistente = ObterListaOrientadores() .FirstOrDefault(o => o.Codigo.Equals(novoOrientador.Codigo, StringComparison.InvariantCultureIgnoreCase) && !o.Id.Equals(novoOrientador.Id)) != null; if (codigoExistente) { ModelState.AddModelError("Codigo", "Já existe um orientador com esse código"); } if (ModelState.IsValid) { novoOrientador.Coordenador = ObterListaUsuarios() .Where(u => u.Login.Equals(User.Identity.Name)) .FirstOrDefault(); _orientadorRepository.Persist(novoOrientador); return(RedirectToAction("Index")); } return(View(novoOrientador.ToOrientadorVM())); }
//public int registrarEscolar(Orientador O) //{ // con = new MySqlConnection(DBManager.cadena); // con.Open(); // MySqlCommand comando = new MySqlCommand(); // comando.Connection = con; // try // { // comando.CommandText = "REGISTRAR_ESCOLAR"; // comando.CommandType = System.Data.CommandType.StoredProcedure; // comando.Parameters.Add("_IdPersona", MySqlDbType.Int32).Value = E.IdEscolar1; // comando.Parameters.Add("_fechaCreacion", MySqlDbType.Date).Value = E.FechaCreacion; // int nroGrado = 3; // if (E.Grado == TipoGrado.Cuarto) nroGrado = 4; // if (E.Grado == TipoGrado.Quinto) nroGrado = 5; // comando.Parameters.Add("_Grado", MySqlDbType.Int32).Value = nroGrado; // comando.Parameters.Add("_telefonoApoderado", MySqlDbType.Int32).Value = E.TelefonoApoderado; // comando.Parameters.Add("_IdColegio", MySqlDbType.Int32).Value = E.Colegio.IdColegio1; // comando.ExecuteNonQuery(); // con.Close(); // return 1; // } // catch (Exception) // { // con.Close(); // return 0; // } //} public BindingList <Orientador> listarOrientadores() { BindingList <Orientador> orientadores = new BindingList <Orientador>(); con = new MySqlConnection(DBManager.cadena); con.Open(); try { MySqlCommand comando = new MySqlCommand(); comando.Connection = con; comando.CommandText = "CALL LISTAR_ORIENTADORES"; MySqlDataReader lector = comando.ExecuteReader(); while (lector.Read()) { int idPersona = lector.GetInt32("IdPersona"); string dni = lector.GetString("DNI"); string nombres = lector.GetString("nombres"); string apellidoPaterno = lector.GetString("apellidoPaterno"); string apellidoMaterno = lector.GetString("apellidoMaterno"); string sexoStr = lector.GetString("sexo"); TipoSexo sexo; if (sexoStr == "M") { sexo = TipoSexo.Hombre; } if (sexoStr == "F") { sexo = TipoSexo.Mujer; } else { sexo = TipoSexo.Personalizado; } //Crea un orientadore Orientador o = new Orientador(dni, nombres, apellidoPaterno, apellidoMaterno, 0, sexo, "", DateTime.MinValue, 2); o.IdPersona1 = o.IdUsuario1 = o.IdOrientador1 = idPersona; int idColegio = lector.GetInt32("IdColegio"); string nombColegio = lector.GetString("nombre"); //Crea el escolar Colegio c = new Colegio("", nombColegio, "", "", "", "", TipoColegio.Estatal, 0); c.IdColegio1 = idColegio; //Asignar el colegio al orientador o.Colegio = c; orientadores.Add(o); } con.Close(); } catch (Exception) { con.Close(); } return(orientadores); }
protected override void OnNavigatedTo(NavigationEventArgs e) { this.orientador = e.Parameter as Orientador; carregaInforcaoesDoOrientador(); Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; }
public static Trabalho ToTrabalho(this TrabalhoVM trabalhoVM, Aluno aluno, Orientador orientador) { return(new Trabalho() { Aluno = aluno, DataCadastro = trabalhoVM.DataCadastro, Id = trabalhoVM.Id, Nome = trabalhoVM.Nome, Orientador = orientador }); }
//ORIENTADORES public static OrientadorVM ToOrientadorVM(this Orientador orientador) { return(new OrientadorVM() { Id = orientador.Id, Codigo = orientador.Codigo, DataCadastro = orientador.DataCadastro, Email = orientador.Email, Nome = orientador.Nome, Sobrenome = orientador.Sobrenome, Telefone = orientador.Telefone }); }
public ActionResult Edit(TrabalhoVM trabRecebido, String descricaoAluno, String descricaoOrientador) { String matriculaAluno = descricaoAluno.Split(' ', '-', ' ').First(); String codigoOrientador = descricaoOrientador.Split(' ', '-', ' ').First(); Aluno alunoEscolhido = ObterListaAlunos() .Where(a => a.Matricula.Equals(matriculaAluno)) .FirstOrDefault(); Orientador orientadorEscolhido = ObterListaOrientadores() .Where(a => a.Codigo.Equals(codigoOrientador)) .FirstOrDefault(); if (alunoEscolhido == null || orientadorEscolhido == null) { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } ModelState["Correcao"].Errors.Clear(); ModelState["Apresentacao"].Errors.Clear(); ModelState["Turma"].Errors.Clear(); if (ModelState.IsValid) { bool podeEditar = ObterListaTrabalhos() .Where(a => a.Id == trabRecebido.Id) .FirstOrDefault() != null; if (!podeEditar) { return(RedirectToAction("Unauthorized", "Erro")); } Trabalho novoTrabalho = trabRecebido.ToTrabalho(alunoEscolhido, orientadorEscolhido); Trabalho trabalhoSalvo = _trabalhoRepository.Find(novoTrabalho.Id); _trabalhoRepository.Update(trabalhoSalvo, novoTrabalho); return(RedirectToAction("Index")); } ViewBag.alunos = ObterListaAlunos() .ToAlunoVM(); ViewBag.orientadores = ObterListaOrientadores() .ToOrientadorVM(); return(View(trabRecebido)); }
public ActionResult Add(TrabalhoVM trabalhoRecebido, String descricaoAluno, String descricaoOrientador) { String matriculaAluno = descricaoAluno.Split(' ', '-', ' ').First(); String codigoOrientador = descricaoOrientador.Split(' ', '-', ' ').First(); Aluno alunoEscolhido = ObterListaAlunos() .Where(a => a.Matricula.Equals(matriculaAluno)) .FirstOrDefault(); Orientador orientadorEscolhido = ObterListaOrientadores() .Where(a => a.Codigo.Equals(codigoOrientador)) .FirstOrDefault(); if (alunoEscolhido == null || orientadorEscolhido == null) { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } Trabalho novoTrabalho = trabalhoRecebido.ToTrabalho(alunoEscolhido, orientadorEscolhido); ModelState["Correcao"].Errors.Clear(); ModelState["Apresentacao"].Errors.Clear(); ModelState["Turma"].Errors.Clear(); if (ModelState.IsValid) { _trabalhoRepository.Persist(novoTrabalho); return(RedirectToAction("Index")); } List <AlunoVM> alunos = ObterListaAlunos().Where (a => a.Turma.Curso.Coordenador.Login.Equals(User.Identity.Name)) .ToAlunoVM() .ToList(); ViewBag.Orientadores = ObterListaOrientadores() .ToOrientadorVM(); ViewBag.Alunos = alunos; trabalhoRecebido.Aluno = alunoEscolhido.ToAlunoVM(); trabalhoRecebido.Orientador = orientadorEscolhido.ToOrientadorVM(); return(View(trabalhoRecebido)); }
public ActionResult Edit(OrientadorVM orientadorRecebido) { orientadorRecebido.Codigo = orientadorRecebido.Codigo.ToUpper(); var query = ObterListaUsuarios().Where(c => c.Login.Equals(User.Identity.Name)).ToList(); if (query.Count == 0) { return(HttpNotFound()); } Orientador novoOrientador = orientadorRecebido.ToOrientador(); Orientador orientadorSalvo = ObterListaOrientadores() .Where(o => o.Id == novoOrientador.Id) .FirstOrDefault(); if (orientadorSalvo == null) { return(RedirectToAction("Unauthorized", "Erro")); } bool codigoExistente = ObterListaOrientadores() .FirstOrDefault(o => o.Codigo.Equals(orientadorRecebido.Codigo, StringComparison.InvariantCultureIgnoreCase) && !o.Id.Equals(orientadorRecebido.Id)) != null; bool podeEditar = ObterListaOrientadores().Where(o => o.Id == orientadorSalvo.Id).FirstOrDefault() != null; if (!podeEditar) { return(RedirectToAction("Unauthorized", "Erro")); } if (codigoExistente) { ModelState.AddModelError("Codigo", "Já existe um orientador com esse código"); } if (ModelState.IsValid) { _orientadorRepository.Update(orientadorSalvo, novoOrientador); return(RedirectToAction("Index")); } return(View(novoOrientador.ToOrientadorVM())); }
public ActionResult DelOrientador(long id) { Orientador orientadorSalvo = ObterListaOrientadores().Where(o => o.Id == id).FirstOrDefault(); if (orientadorSalvo == null) { return(RedirectToAction("Unauthorized", "Erro")); } if (orientadorSalvo.Trabalhos.Count > 0) { return(new HttpStatusCodeResult(400)); //Verificação a ser feita em caso de exclusão lógica (atualmente não implementada) //foreach (var trab in orientadorSalvo.Trabalhos) //{ // if (trab.Ativo == 1) // { // return new HttpStatusCodeResult(400); // } //} } _orientadorRepository.Delete(orientadorSalvo); return(null); }
public static IEnumerable <Trabalho> ToTrabalho(this IEnumerable <TrabalhoVM> data, Aluno aluno, Orientador orientador) { return(data.Select(trabalhoVM => new Trabalho() { Aluno = aluno, DataCadastro = trabalhoVM.DataCadastro, Id = trabalhoVM.Id, Nome = trabalhoVM.Nome, Orientador = orientador })); }
public bool listarSolicitudInscripcionActividad(BindingList <SolicitudInscripcionActividad> listaSIA) { bool success = false; SolicitudInscripcionActividad SIA; TipoActividad TA; Actividad A; Orientador O; Colegio C; //coneccion DataBase DBManager DBM = new DBManager(); bool coneccion = DBM.initialize_conection(); if (coneccion) { // no rwquiee parametros DBM.Comando.CommandType = System.Data.CommandType.StoredProcedure; DBM.Comando.CommandText = "listarSoicitudesInscripcionActividades_all"; MySqlDataReader lector = DBM.Comando.ExecuteReader(); //inserto en el bindinglist, se supone que ya se envio inicializado, pero porciacaso //listaPA = new BindingList<ProcesoAdmision>(); while (lector.Read()) { O = new Orientador( lector.GetString("dni"), lector.GetString("nombreOrientador"), lector.GetString("apPaterno"), lector.GetString("apMaterno"), lector.GetInt32("celular"), lector.GetString("sexo").Equals("M") ? TipoSexo.Hombre : TipoSexo.Mujer, lector.GetString("email"), new DateTime(), 1); O.IdOrientador1 = lector.GetInt32("IdOrientador"); TA = new TipoActividad(lector.GetString("nombreTA"), lector.GetString("descTA")); TA.IdTipoActividad1 = lector.GetInt32("IdTipoActividad"); A = new Actividad(lector.GetDateTime("fechaActividad"), 1, lector.GetInt32("cantEstudiantes")); A.IdActividad1 = lector.GetInt32("IdActividad"); A.TipoActividad = TA; C = new Colegio( lector.GetInt32("IdColegio"), lector.GetString("ruc"), lector.GetString("nombreColegio"), lector.GetString("pais"), lector.GetString("departamento"), lector.GetString("provincia"), lector.GetString("direccion"), lector.GetString("tipoColegio").Equals("Particular") ? TipoColegio.Particular : TipoColegio.Estatal, lector.GetInt32("telefono") ); // TipoAct -> Act // Act, Orient, Col -> Slicitud //ahora todo lo levo dentro del registro Solicitud SIA = new SolicitudInscripcionActividad( lector.GetInt32("cantAlumnos"), lector.GetInt32("grado"), lector.GetDateTime("fecha"), O, C, A, lector.GetString("EstadoValidacion") ); SIA.IdSolicitudInscripcion1 = lector.GetInt32("IdSolicitudInscripcion"); listaSIA.Add(SIA); } success = true; DBM.finalize_conection(); } else { success = false; } return(success); }
public void Activate() { Orientador orientator = dB.orientatorList[uS.user.id]; LoadData(orientator); }
public void LoadData(Orientador orientador) { name.text = orientador.name; description.text = "e-mail: " + orientador.mail + "\n" + "Telefono: " + orientador.cellphone + "\n" + "Perfil Linkedin: CarlosLinkedin"; }