Example #1
0
        private void RequestProject(object sender, RoutedEventArgs routedEventArgs)
        {
            ProfessionalPracticesContext professionalPracticesContext = new ProfessionalPracticesContext();
            UnitOfWork unitOfWork = new UnitOfWork(professionalPracticesContext);

            try
            {
                bool            practicionerHaveAProject            = unitOfWork.Practicioners.PracticionerHasActiveProject(_practicionerEnrollment);
                IList <Project> projecsAvailableForThosPracticioner = unitOfWork.Projects.GetProjectsAvailableToRequest(_practicionerEnrollment);
                int             requestMade = unitOfWork.RequestProjects.GetPracticionerRequest(_practicionerEnrollment);
                if (practicionerHaveAProject || projecsAvailableForThosPracticioner.Count == 0 || requestMade == 3)
                {
                    MessageBox.Show("Ya has solocitado un proyecto o no hay proyectos disponibles", "Consulta Fallida", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    RequestProjects requestProject = new RequestProjects(_practicionerEnrollment);
                    requestProject.Show();
                    Close();
                }
            }
            catch (EntityException)
            {
                MessageBox.Show("No hay conexión a la base de datos. Intente más tarde", "Consulta Fallida", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                unitOfWork.Dispose();
            }
        }
Example #2
0
        private void BehindButtonClicked(object sender, RoutedEventArgs routedEventArgs)
        {
            RequestProjects requestProject = new RequestProjects(_enrollment);

            requestProject.Show();
            Close();
        }