private void RegisterButton_Click(object sender, RoutedEventArgs e) { try { using (SCPPContext context = new SCPPContext()) { var foundProfessor = context.Profesor.Find(TextBoxWorkerNumber.Text); if (foundProfessor == null) { if (VerificateFields()) { var professorRegistered = RegisterNewProfessor(); SendEmail(); ProfessorRegisteredMessage(professorRegistered); } } else { CustomMessageBox.ShowOK("Ya existe un profesor registrado con la matrícula ingresada con nombre: " + foundProfessor.Nombre, "Profesor ya registrado", "Aceptar"); } } } catch (EntityException) { Restarter.RestarSCPP(); } }
private Profesor RegisterNewProfessor() { Profesor professor = new Profesor { Nombre = TextBoxName.Text, Apellidopaterno = TextBoxLastName.Text, Apellidomaterno = TextBoxMothersLastName.Text, Numtrabajador = TextBoxWorkerNumber.Text, Correopersonal = TextBoxEMail.Text, Telefono = TextBoxPhone.Text, Contraseña = Encrypt.GetSHA256(TextBoxPassword.Password), Activo = 1 }; try { using (SCPPContext context = new SCPPContext()) { context.Profesor.Add(professor); context.SaveChanges(); } } catch (EntityException) { Restarter.RestarSCPP(); } return(professor); }
private void RegisterButton_Click(object sender, RoutedEventArgs e) { try { if (VerificateFields()) { using (SCPPContext context = new SCPPContext()) { var student = context.Estudiante.Find(TextBoxMatricula.Text); if (student == null) { var studentRegistered = RegisterNewStudent(); SendEmail(); StudentRegisteredMessage(studentRegistered); } else { CustomMessageBox.ShowOK("Ya existe un estudiante registrado con la matrícula ingresada con nombre: " + student.Nombre, "Estudiante ya registrado", "Aceptar"); } } } } catch (EntityException) { Restarter.RestarSCPP(); } }
private void RegisterButton_Click(object sender, RoutedEventArgs e) { try { using (SCPPContext context = new SCPPContext()) { var proyecto = context.Proyecto.FirstOrDefault(s => s.Nombre == TextBoxNombre.Text); if (proyecto == null) { var proyectRegistered = RegisterNewProyect(); MessageBoxResult confirmation = CustomMessageBox.ShowYesNo("El registro se ha realizado con éxito", "Registro exitoso", "Gestionar proyecto", "Finalizar"); if (confirmation == MessageBoxResult.Yes) { var mainWindow = (MainWindow)Application.Current.MainWindow; mainWindow?.ChangeView(new GestionarProyecto(proyecto)); } else { CancelButton_Click(new object(), new RoutedEventArgs()); } } else { CustomMessageBox.ShowOK("Ya existe un proyecto registrado con el nombre ingresado con clave: " + proyecto.Clave, "Proyecto ya registrado", "Aceptar"); } } } catch (EntityException) { Restarter.RestarSCPP(); } }
private Responsableproyecto RegisterNewResposable() { var organization = (Organización)ComboBoxOrganizacion.SelectedItem; Responsableproyecto responsable = new Responsableproyecto { Nombre = TextBoxName.Text, Apellidopaterno = TextBoxLastName.Text, Apellidomaterno = TextBoxMothersLastName.Text, Correopersonal = TextBoxEMail.Text, Telefono = TextBoxPhone.Text, Activo = 1, OrganizaciónID = organization.OrganizaciónID }; try { using (SCPPContext context = new SCPPContext()) { context.Responsableproyecto.Add(responsable); context.SaveChanges(); } } catch (EntityException) { Restarter.RestarSCPP(); } return(responsable); }
private void GetGroups() { try { using (SCPPContext context = new SCPPContext()) { var profesor = context.Profesor.FirstOrDefault(c => c.Numtrabajador.Equals(_user)); if (profesor != null) { isCoordinator = false; } else { isCoordinator = true; } groupsCollection = GetList(isCoordinator, profesor); } GroupList.ItemsSource = groupsCollection; DataContext = groupsCollection; } catch (Exception) { Restarter.RestarSCPP(); } }
private void ComboBoxOrganization_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { var organization = (Organización)ComboBoxOrganization.SelectedItem; responsablesCollection = new ObservableCollection <Responsableproyecto>(); using (SCPPContext context = new SCPPContext()) { var responsablesList = context.Responsableproyecto.Where(r => r.OrganizaciónID == organization.OrganizaciónID); if (responsablesList != null) { foreach (Responsableproyecto responsableProyecto in responsablesList) { if (responsableProyecto != null) { responsablesCollection.Add(responsableProyecto); } } } } ComboBoxResponsable.ItemsSource = responsablesCollection; } catch (EntityException) { Restarter.RestarSCPP(); } }
private void RegisterButton_Click(object sender, RoutedEventArgs e) { try { using (SCPPContext context = new SCPPContext()) { var foundResposable = context.Responsableproyecto.Where(s => s.Correopersonal.Equals(TextBoxEMail.Text)).FirstOrDefault(); if (foundResposable == null) { if (VerificateFields()) { var resposableRegistered = RegisterNewResposable(); ResposableRegisteredMessage(resposableRegistered); } } else { CustomMessageBox.ShowOK("Ya existe un resposable registrado con el correo ingresado: " + foundResposable.Nombre, "Resposable ya registrado", "Aceptar"); } } } catch (EntityException) { Restarter.RestarSCPP(); } }
private void ChangeStudentStatus() { ObservableCollection <Estudiante> studentList = new ObservableCollection <Estudiante>(); try { using (SCPPContext context = new SCPPContext()) { foreach (var student in selectedStudents) { var foundStudent = context.Estudiante.Where(s => s.Matricula.Equals(student.Matricula)). FirstOrDefault(); if (foundStudent != null) { foundStudent.Estado = "Inscrito"; context.SaveChanges(); } studentList.Add(student); } } foreach (var student in studentList) { studentsCollection.Remove(student); } ConfirmedRegistrationMessage(); } catch (EntityException) { Restarter.RestarSCPP(); } }
private void RegisterButton_Click(object sender, RoutedEventArgs e) { try { if (VerificateFields()) { using (SCPPContext context = new SCPPContext()) { var organization = context.Organización.FirstOrDefault(s => s.Nombre == NameTextBox.Text); if (organization == null) { Organización organizationRegistered = (Organización)RegisterNewOrganization(); OrganizationRegisteredMessage(organizationRegistered); } else { CustomMessageBox.ShowOK("Organización ya registrada", "Registro repetido", "Aceptar"); } } } } catch (EntityException) { Restarter.RestarSCPP(); } }
private Estudiante RegisterNewStudent() { var student = new Estudiante { Matricula = TextBoxEnrrollment.Text, Nombre = TextBoxName.Text, Apellidopaterno = TextBoxLastName.Text, Apellidomaterno = TextBoxMothersLastName.Text, Telefono = TextBoxPhone.Text, Correopersonal = TextBoxEMail.Text, Promedio = Convert.ToDouble(TextBoxAverage.Text), Estado = "Preinscrito", Genero = ComboBoxGender.Text, Activo = 1, Contraseña = Encrypt.GetSHA256(TextBoxPassword.Password) }; try { using (SCPPContext context = new SCPPContext()) { context.Estudiante.Add(student); context.SaveChanges(); } } catch (EntityException) { Restarter.RestarSCPP(); } return(student); }
private void ReportValidationCheckbox_Checked(object sender, RoutedEventArgs e) { if (pageIsLoad && userSesion.Kind != "Student") { reportSelected = ((FrameworkElement)sender).DataContext as Reporte; try { if (reportSelected != null) { using (SCPPContext context = new SCPPContext()) { var fileInDB = context.Archivo.Find(reportSelected.ArchivoID); if (fileInDB.Validado == 1) { fileInDB.Validado = 0; } else { fileInDB.Validado = 1; } context.SaveChanges(); } } } catch (EntityException) { Restarter.RestarSCPP(); } } }
private void AgreeButton_Click(object sender, RoutedEventArgs e) { try { if (CheckChoosenProjects()) { MessageBoxResult confirmation = CustomMessageBox.ShowYesNo("¿Seguro que desea escoger estos proyectos?", "Confirmacion", "Si", "No"); if (confirmation == MessageBoxResult.Yes) { CreateProjectsSelection(); ConfirmedChoosenProjectsMessage(); } else { return; } } else { CustomMessageBox.ShowOK("Debes elegir 3 proyectos", "Error", "Aceptar"); } } catch (EntityException) { Restarter.RestarSCPP(); } }
private void DeleteStudentButton_Click(object sender, RoutedEventArgs e) { bool unasingDone = false; try { MessageBoxResult confirmation = CustomMessageBox.ShowYesNo("¿Seguro que desea desasignar al alumno con nombre: " + studentSelected.Nombre + " del grupo?", "Confirmación", "Si", "No"); if (confirmation == MessageBoxResult.Yes) { UnasingStudent(); unasingDone = true; } else { return; } if (unasingDone) { MessageBoxResult result = CustomMessageBox.ShowOK("El estudiante se ha quitado del grupo.", "Alumno desasignado", "Finalizar"); ReturnToPreviousList(new object(), new RoutedEventArgs()); } } catch (EntityException) { Restarter.RestarSCPP(); } }
private void UploadFileButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog { Filter = "Report files | *.pdf; *.doc; *.docs; *.docx", FilterIndex = 1, InitialDirectory = new KnownFolder(KnownFolderType.Documents).Path, RestoreDirectory = true }; dialog.ShowDialog(); string filePath = dialog.FileName; Console.WriteLine(filePath); Stream myStream = null; try { myStream = dialog.OpenFile(); } catch (InvalidOperationException) { // Por si cancela el dialogo } if (myStream != null) { try { using (MemoryStream ms = new MemoryStream()) { myStream.CopyTo(ms); byte[] file = ms.ToArray(); using (SCPPContext context = new SCPPContext()) { Archivo oDocument = new Archivo { ExpedienteID = inscription.Expediente.First().ExpedienteID, Archivo1 = file, Fechaentrega = DateTime.Today, Titulo = dialog.SafeFileName, Validado = 0 }; context.Archivo.Add(oDocument); context.SaveChanges(); filesCollection.Add(oDocument); } CustomMessageBox.ShowOK("Archivo agregado con éxito.", "Éxito.", "Aceptar"); } } catch (EntityException) { Restarter.RestarSCPP(); } } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Restarter.CheckRestart(e.Args); Restarter.Start(Settings.Port - 1); new NeoPlayerWindow().Show(); }
private void Awake() { if (me != null) { Destroy(gameObject); } me = this; DontDestroyOnLoad(gameObject); }
public static IEnumerable <string> GenerateCommandLineExecution(IAbsoluteFilePath location, string executable, params string[] desiredParams) { var updateExe = GetUpdateExe(location); return(updateExe != null && updateExe.Exists ? new[] { updateExe.ToString() }.Concat(Restarter.BuildUpdateExeArguments(executable, desiredParams)) : new[] { location.ToString() }.Concat(desiredParams)); }
private void SendButton_Click(object sender, RoutedEventArgs e) { Stream myStream = null; try { myStream = dialog.OpenFile(); } catch (InvalidOperationException) { // Por si cancela el dialogo } if (myStream != null) { try { using (MemoryStream ms = new MemoryStream()) { myStream.CopyTo(ms); byte[] file = ms.ToArray(); using (SCPPContext context = new SCPPContext()) { Archivo oDocument = new Archivo { ExpedienteID = inscription.Expediente.First().ExpedienteID, Archivo1 = file, Fechaentrega = DateTime.Today, Titulo = dialog.SafeFileName, Validado = 0 }; Reporte oReport = new Reporte { Horasreportadas = int.Parse(TextBoxHours.Text), Tiporeporte = ComboBoxKind.Text }; context.Archivo.Add(oDocument); oReport.Archivo = oDocument; context.Reporte.Add(oReport); context.SaveChanges(); } CustomMessageBox.ShowOK("Reporte agregado con éxito.", "Éxito.", "Aceptar"); CancelButton_Click(new object(), new RoutedEventArgs()); } } catch (EntityException) { Restarter.RestarSCPP(); } } }
private void RegisterButton_Clicked(object sender, RoutedEventArgs e) { try { if (VerificateFields()) { OrganizationUserApi organizationtUserApi = new OrganizationUserApi(); OrganizationUser organizationUser = new OrganizationUser(name: NameTextBox.Text, contactEmail: AgentEmailTextBox.Text); User generalUser = new User(email: EmailTextBox.Text); Media perfilImage = new Media(); generalUser.City = CityTextBox.Text; generalUser.Country = CountryTextBox.Text; generalUser.Password = Encrypt.GetSHA256(PasswordTextBox.Password); if (myStream != null) { using (MemoryStream ms = new MemoryStream()) { myStream.CopyTo(ms); byte[] imageFile = ms.ToArray(); perfilImage.File = imageFile; generalUser.ProfilePhoto = perfilImage; } } organizationUser.About = DescripctionTextBox.Text; organizationUser.ContactPhone = PhoneTextBox.Text; organizationUser.ContactName = AgentTextBox.Text; organizationUser.ZipCode = Convert.ToInt32(PostalCodeTextBox.Text); organizationUser.WebSite = WebSiteTextBox.Text; organizationUser.WorkSector = (Sector)SectorComboBox.SelectedItem; organizationUser.User = generalUser; var response = organizationtUserApi.RegisterOrganizationUserWithHttpInfo(organizationUser); CustomMessageBox.ShowOK("El usuario ha sido registrado con éxito.", "Registro exitoso", "Aceptar"); var mainWindow = (MainWindow)Application.Current.MainWindow; mainWindow?.ChangeView(new ValidateUser(organizationUser.User.Email, organizationUser.Name)); return; } } catch (ApiException ex) { if (ex.ErrorCode == 401) { CustomMessageBox.ShowOK("Ya existe un usuario con el correo " + EmailTextBox.Text, "Usuario existente", "Aceptar"); } if (ex.ErrorCode == 500) { CustomMessageBox.ShowOK("Ocurrió un error en la conexión con la base de datos. Por favor intentelo más tarde", "Error de conexión", "Aceptar"); Restarter.RestarEmployex(); } } }
private void invokeUpdate() { Directory.CreateDirectory("temp"); ConfigXML.writeLocal <UpdateXML>(update, "temp\\update.xml"); foreach (string newPath in Directory.GetFiles("libs", "*.*")) { File.Copy(newPath, newPath.Replace("libs", "temp"), true); } Restarter.restart("update"); }
private void TextBoxSearch_KeyUp(object sender, KeyEventArgs e) { try { string searchText = TextBoxSearch.Text; SpecificSearch(searchText); } catch (EntityException) { Restarter.RestarSCPP(); } }
private void TextBoxSearch_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) { try { string searchText = TextBoxSearch.Text; Search(searchText); } catch (EntityException) { Restarter.RestarSCPP(); } }
private void RegistButton_Clicked(object sender, RoutedEventArgs e) { try { if (VerificateFields()) { IndependientUserApi independientUserApi = new IndependientUserApi(); IndependientUser independientUser = new IndependientUser(name: NameTextBox.Text); User generalUser = new User(email: EmailTextBox.Text); Media perfilImage = new Media(); generalUser.City = CityTextBox.Text; generalUser.Country = CountryTextBox.Text; generalUser.Password = Encrypt.GetSHA256(PasswordTextBox.Password); if (myStream != null) { using (MemoryStream ms = new MemoryStream()) { myStream.CopyTo(ms); byte[] imageFile = ms.ToArray(); perfilImage.File = imageFile; generalUser.ProfilePhoto = perfilImage; } } independientUser.Surnames = LastNameTextBox.Text; independientUser.Ocupation = OcupationTextBox.Text; independientUser.PersoanlDescription = GeneralDescripctionTextBox.Text; independientUser.User = generalUser; var response = independientUserApi.RegisterIndpendientUserWithHttpInfo(independientUser); CustomMessageBox.ShowOK("El usuario ha sido registrado con éxito.", "Registro exitoso", "Aceptar"); string fullName = independientUser.Name + " " + independientUser.Surnames; var mainWindow = (MainWindow)Application.Current.MainWindow; mainWindow?.ChangeView(new ValidateUser(independientUser.User.Email, fullName)); return; } } catch (ApiException ex) { if (ex.ErrorCode == 401) { CustomMessageBox.ShowOK("Ya existe un usuario con el correo " + EmailTextBox.Text, "Usuario existente", "Aceptar"); } if (ex.ErrorCode == 500) { CustomMessageBox.ShowOK("Ocurrió un error en la conexión con la base de datos. Por favor intentelo más tarde", "Error de conexión", "Aceptar"); Restarter.RestarEmployex(); } } }
private void NavigationService_Navigated(object sender, NavigationEventArgs e) { try { pageIsLoad = false; GetDocuments(); } catch (EntityException) { Restarter.RestarSCPP(); } }
public ValidarInscripcion() { try { InitializeComponent(); AddInformationToLabels(); GetStudents(); } catch (EntityException) { Restarter.RestarSCPP(); } }
public GenerarOficioAsignacion() { try { InitializeComponent(); GetSesion(); GetStudents(); } catch (EntityException) { Restarter.RestarSCPP(); } }
public RegistrarProyecto() { try { InitializeComponent(); ComboBoxCapacidad.ItemsSource = numOfStudents; FillComboBoxOrganizations(); } catch (EntityException) { Restarter.RestarSCPP(); } }
public EscogerProyecto() { try { InitializeComponent(); GetSesion(); GetProyects(); } catch (EntityException) { Restarter.RestarSCPP(); } }
public DesasignarProfesorGrupo() { try { InitializeComponent(); GetProfesors(); _period = Period.GetPeriod(); } catch (EntityException) { Restarter.RestarSCPP(); } }