static public List <Button> CreateAdministradorView() { var buttonList = new List <Button>(); var menuButtonStyle = (Style)Application.Current.Resources["MenuButton"]; var numRow = 0; var HomeButton = new Button() { Name = "HomeButton", Content = "Home", Style = menuButtonStyle }; buttonList.Add(HomeButton); Grid.SetRow(HomeButton, numRow); numRow++; var ChangePassButton = new Button() { Name = "ChangePassButton", Content = "Cambiar Contraseña", Style = menuButtonStyle }; buttonList.Add(ChangePassButton); Grid.SetRow(ChangePassButton, numRow); numRow++; var BuscadorPersonaButton = new Button() { Name = "BuscadorV2", Content = "Buscador de Personas", Style = menuButtonStyle }; buttonList.Add(BuscadorPersonaButton); Grid.SetRow(BuscadorPersonaButton, numRow); numRow++; var SQLEditorButton = new Button() { Name = "SQLEditor", Content = "Editor de T-SQL", Style = menuButtonStyle }; buttonList.Add(SQLEditorButton); Grid.SetRow(SQLEditorButton, numRow); numRow++; var UserPanelButton = new Button() { Name = "UserPanel", Content = "Panel de Usuarios", Style = menuButtonStyle }; buttonList.Add(UserPanelButton); Grid.SetRow(UserPanelButton, numRow); numRow++; var EntitiesSearch = new Button() { Name = "EntitiesSearch", Content = "Buscador de Entidades", Style = menuButtonStyle }; buttonList.Add(EntitiesSearch); Grid.SetRow(EntitiesSearch, numRow); numRow++; var CheckReclamaciones = new Button() { Name = "CheckReclamaciones", Content = "Revisar Reclamaciones", Style = menuButtonStyle }; buttonList.Add(CheckReclamaciones); Grid.SetRow(CheckReclamaciones, numRow); numRow++; var LogOutButton = new Button() { Name = "LogOutButton", Content = "Salir", Style = menuButtonStyle }; buttonList.Add(LogOutButton); Grid.SetRow(LogOutButton, numRow); numRow++; void AlumnoView_Click(object sender, RoutedEventArgs e) { if (sender is Button btnSender) { if (btnSender == HomeButton) { var backUpMainPanel = XamlBridge.BackUpMainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == ChangePassButton) { var mainPanel = new ChangePassword().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == SQLEditorButton) { var mainPanel = new SQLEditor().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == UserPanelButton) { var mainPanel = new UserPanel().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == BuscadorPersonaButton) { var mainPanel = new BuscadorV2().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == EntitiesSearch) { var mainPanel = new BuscadorAllEntities().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == CheckReclamaciones) { var mainPanel = new RevisarReclamaciones().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == LogOutButton) { StaticButtonViews.LogOutFromMainWindow(); } } }; foreach (var button in buttonList) { button.Click += new RoutedEventHandler(AlumnoView_Click); } return(buttonList); }
static public List <Button> CreateAdministrativoView() { var buttonList = new List <Button>(); var menuButtonStyle = (Style)Application.Current.Resources["MenuButton"]; var numRow = 0; var HomeButton = new Button() { Name = "HomeButton", Content = "Home", Style = menuButtonStyle }; buttonList.Add(HomeButton); Grid.SetRow(HomeButton, numRow); numRow++; var ChangePassButton = new Button() { Name = "ChangePassButton", Content = "Cambiar Contraseña", Style = menuButtonStyle }; buttonList.Add(ChangePassButton); Grid.SetRow(ChangePassButton, numRow); numRow++; var BuscadorPersona = new Button() { Name = "BuscadorPersona", Content = "Buscar Personas", Style = menuButtonStyle }; buttonList.Add(BuscadorPersona); Grid.SetRow(BuscadorPersona, numRow); numRow++; var FichaPersona = new Button() { Name = "FichaPersona", Content = "Fichas Personales", Style = menuButtonStyle }; buttonList.Add(FichaPersona); Grid.SetRow(FichaPersona, numRow); numRow++; var FormCurso = new Button() { Name = "FormCurso", Content = "Formularios Curso", Style = menuButtonStyle }; buttonList.Add(FormCurso); Grid.SetRow(FormCurso, numRow); numRow++; var FormAsignatura = new Button() { Name = "FormAsignatura", Content = "Formularios Asignatura", Style = menuButtonStyle }; buttonList.Add(FormAsignatura); Grid.SetRow(FormAsignatura, numRow); numRow++; var FormAula = new Button() { Name = "FormAula", Content = "Formularios Aula", Style = menuButtonStyle }; buttonList.Add(FormAula); Grid.SetRow(FormAula, numRow); numRow++; var FormDepartamento = new Button() { Name = "FormDepartamento", Content = "Formularios Departamento", Style = menuButtonStyle }; buttonList.Add(FormDepartamento); Grid.SetRow(FormDepartamento, numRow); numRow++; var FormHorario = new Button() { Name = "FormHorario", Content = "Formularios Horario", Style = menuButtonStyle }; buttonList.Add(FormHorario); Grid.SetRow(FormHorario, numRow); numRow++; var LogOutButton = new Button() { Name = "LogOutButton", Content = "Salir", Style = menuButtonStyle }; buttonList.Add(LogOutButton); Grid.SetRow(LogOutButton, numRow); numRow++; void AdministrativoView_Click(object sender, RoutedEventArgs e) { if (sender is Button btnSender) { if (btnSender == HomeButton) { var backUpMainPanel = XamlBridge.BackUpMainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == ChangePassButton) { var mainPanel = new ChangePassword().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == BuscadorPersona) { var backUpMainPanel = new BuscadorV2().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == FormCurso) { var backUpMainPanel = new FormularioCurso().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == FormAsignatura) { var backUpMainPanel = new FormularioAsignatura().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == FormAula) { var backUpMainPanel = new FormularioAula().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == FormDepartamento) { var backUpMainPanel = new FormularioDepartamento().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == FormHorario) { var backUpMainPanel = new FormularioHorario().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == FichaPersona) { var fichaPersona = new FichaPersona(); var backUpMainPanel = fichaPersona.MainPanel; XamlBridge.FichaPersona = fichaPersona; fichaPersona.Close(); XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == LogOutButton) { StaticButtonViews.LogOutFromMainWindow(); } } }; foreach (var button in buttonList) { button.Click += new RoutedEventHandler(AdministrativoView_Click); } return(buttonList); }
static public List <Button> CreateAlumnoView() { var buttonList = new List <Button>(); var menuButtonStyle = (Style)Application.Current.Resources["MenuButton"]; var numRow = 0; var HomeButton = new Button() { Name = "HomeButton", Content = "Home", Style = menuButtonStyle }; buttonList.Add(HomeButton); Grid.SetRow(HomeButton, numRow); numRow++; var ChangePassButton = new Button() { Name = "ChangePassButton", Content = "Cambiar Contraseña", Style = menuButtonStyle }; buttonList.Add(ChangePassButton); Grid.SetRow(ChangePassButton, numRow); numRow++; var FirstButton = new Button() { Name = "FirstButton", Content = "Buscador Profesorado", Style = menuButtonStyle }; buttonList.Add(FirstButton); Grid.SetRow(FirstButton, numRow); numRow++; var SecondButton = new Button() { Name = "SecondButton", Content = "Horario", Style = menuButtonStyle }; buttonList.Add(SecondButton); Grid.SetRow(SecondButton, numRow); numRow++; var ForthButton = new Button() { Name = "ForthButton", Content = "Reclamaciones", Style = menuButtonStyle }; buttonList.Add(ForthButton); Grid.SetRow(ForthButton, numRow); numRow++; var NotasButton = new Button() { Name = "NotasButton", Content = "Calificaciones", Style = menuButtonStyle }; buttonList.Add(NotasButton); Grid.SetRow(NotasButton, numRow); numRow++; var FifthButton = new Button() { Name = "FifthButton", Content = "Solicitudes", Style = menuButtonStyle }; buttonList.Add(FifthButton); Grid.SetRow(FifthButton, numRow); numRow++; var LogOutButton = new Button() { Name = "LogOutButton", Content = "Salir", Style = menuButtonStyle }; buttonList.Add(LogOutButton); Grid.SetRow(LogOutButton, numRow); numRow++; void AlumnoView_Click(object sender, RoutedEventArgs e) { if (sender is Button btnSender) { var mainWindowPanel = XamlBridge.MainPanelInstance; if (btnSender == FirstButton) { XamlFunctionality.ChangeWindowContent(mainWindowPanel, new BuscadorV2()); } else if (btnSender == ChangePassButton) { var mainPanel = new ChangePassword().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == NotasButton) { var mainPanel = new Notas().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == SecondButton) { XamlFunctionality.ChangeWindowContent(mainWindowPanel, new Horario()); } else if (btnSender == ForthButton) { XamlFunctionality.ChangeWindowContent(mainWindowPanel, new Reclamaciones()); } else if (btnSender == FifthButton) { Notification.CreateNotification("Todavía no disponible. Lo sentimos"); } else if (btnSender == HomeButton) { var backUpMainPanel = XamlBridge.BackUpMainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == LogOutButton) { //XamlBridge.CloseEverything(); StaticButtonViews.LogOutFromMainWindow(); } } } foreach (var button in buttonList) { button.Click += new RoutedEventHandler(AlumnoView_Click); } return(buttonList); }
static public List <Button> CreateProfesorView() { var buttonList = new List <Button>(); var menuButtonStyle = (Style)Application.Current.Resources["MenuButton"]; var numRow = 0; var HomeButton = new Button() { Name = "HomeButton", Content = "Home", Style = menuButtonStyle }; buttonList.Add(HomeButton); Grid.SetRow(HomeButton, numRow); numRow++; var ChangePassButton = new Button() { Name = "ChangePassButton", Content = "Cambiar Contraseña", Style = menuButtonStyle }; buttonList.Add(ChangePassButton); Grid.SetRow(ChangePassButton, numRow); numRow++; var FirstButton = new Button() { Name = "FirstButton", Content = "Buscador Alumnado", Style = menuButtonStyle }; buttonList.Add(FirstButton); Grid.SetRow(FirstButton, numRow); numRow++; var NotasButton = new Button() { Name = "NotasButton", Content = "Calificar", Style = menuButtonStyle }; buttonList.Add(NotasButton); Grid.SetRow(NotasButton, numRow); numRow++; var SecondButton = new Button() { Name = "SecondButton", Content = "Horario", Style = menuButtonStyle }; buttonList.Add(SecondButton); Grid.SetRow(SecondButton, numRow); numRow++; var GuardiaButton = new Button() { Name = "GuardiaButton", Content = "De Guardia", Style = menuButtonStyle }; buttonList.Add(GuardiaButton); Grid.SetRow(GuardiaButton, numRow); numRow++; var academicYear = AdministrativoFunctionality.GetAcademicYear(StaticReferences.CurrentDateTime); if (XamlBridge.CurrentUser.Persona1.Trabajador.Profesor.Tutores.Any(t => t.Anyo.Equals(academicYear))) { var ActasButton = new Button() { Name = "ActasButton", Content = "Actas de Evaluación", Style = menuButtonStyle }; buttonList.Add(ActasButton); Grid.SetRow(ActasButton, numRow); numRow++; ActasButton.Click += (object sender, RoutedEventArgs e) => { var mainPanel = new ActasDeEvaluacion().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; }; } var LogOutButton = new Button() { Name = "LogOutButton", Content = "Salir", Style = menuButtonStyle }; buttonList.Add(LogOutButton); Grid.SetRow(LogOutButton, numRow); numRow++; void ProfesorView_Click(object sender, RoutedEventArgs e) { if (sender is Button btnSender) { XamlBridge.RobotoProfesorGuardia?.Abort(); var mainWindowPanel = XamlBridge.MainPanelInstance; if (btnSender == FirstButton) { XamlFunctionality.ChangeWindowContent(mainWindowPanel, new BuscadorV2()); } else if (btnSender == ChangePassButton) { var mainPanel = new ChangePassword().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == NotasButton) { var mainPanel = new FormularioNota().MainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel); XamlBridge.MainPanelInstance = mainPanel; } else if (btnSender == SecondButton) { XamlFunctionality.ChangeWindowContent(mainWindowPanel, new Horario()); } else if (btnSender == GuardiaButton) { var backUpMainPanel = new ProfesorGuardia(); XamlBridge.ProfesorGuardia = backUpMainPanel; var thread = RobotoProfesorGuardia.CreateThread(); XamlBridge.RobotoProfesorGuardia = thread; thread.Start(); XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel.MainPanel); XamlBridge.MainPanelInstance = backUpMainPanel.MainPanel; } else if (btnSender == HomeButton) { var backUpMainPanel = XamlBridge.BackUpMainPanel; XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel); XamlBridge.MainPanelInstance = backUpMainPanel; } else if (btnSender == LogOutButton) { //XamlBridge.CloseEverything(); //Application.Current.Shutdown(); StaticButtonViews.LogOutFromMainWindow(); } } }; foreach (var button in buttonList) { button.Click += new RoutedEventHandler(ProfesorView_Click); } return(buttonList); }