Esempio n. 1
0
        private void navigationTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            int index = 0;

            if (e.Node.Name == "LoginNode")
            {
                if (!tabViewer.TabPages.ContainsKey("Login"))
                {

                    tabViewer.TabPages.Add("Login", "Login");
                    index = tabViewer.TabPages.IndexOfKey("Login");
                }
                tabViewer.SelectTab("Login");
                if (!tabViewer.TabPages[index].HasChildren)
                {
                    LoginTab login = new LoginTab();
                    login.LoginEvent += new LoginTab.LoginEventHandler(login_LoginEvent);
                    tabViewer.TabPages[index].Controls.Add(login);
                    tabViewer.TabPages[index].Controls[0].Focus();
                }
            }
            else if (e.Node.Name == "PatientInfoNode")
            {
                if (tabViewer.TabPages.ContainsKey("Welcome"))
                {
                    tabViewer.TabPages.RemoveByKey("Welcome");
                }

                if (!tabViewer.TabPages.ContainsKey("PatientInfo"))
                {

                    tabViewer.TabPages.Add("PatientInfo", "PatientInfo");
                    index = tabViewer.TabPages.IndexOfKey("PatientInfo");

                    PatientInfoTab patientTab = new PatientInfoTab(sessionManager, activeServer);

                    tabViewer.TabPages[index].Controls.Add(patientTab);
                }
                tabViewer.SelectTab("PatientInfo");
            }
            else if (e.Node.Name == "AppointmentNode")
            {
                if (tabViewer.TabPages.ContainsKey("Welcome"))
                {
                    tabViewer.TabPages.RemoveByKey("Welcome");
                }
                if (!tabViewer.TabPages.ContainsKey("Appointments"))
                {

                    tabViewer.TabPages.Add("Appointments", "Appointments");
                    index = tabViewer.TabPages.IndexOfKey("Appointments");

                    AppointmentTab appTab = new AppointmentTab(sessionManager, activeServer);
                    appTab.PrintEvent += new AppointmentTab.PrintEventHandler(appTab_PrintEvent);

                    tabViewer.TabPages[index].Controls.Add(appTab);
                }
                tabViewer.SelectTab("Appointments");
            }
            else if (e.Node.Name == "WelcomeNode")
            {
                if (!tabViewer.TabPages.ContainsKey("Welcome"))
                {

                    tabViewer.TabPages.Add("Welcome", "Welcome");
                    index = tabViewer.TabPages.IndexOfKey("Welcome");

                    WelcomeTab appTab = new WelcomeTab();

                    tabViewer.TabPages[index].Controls.Add(appTab);
                }
                tabViewer.SelectTab("Welcome");
            }
            else if (e.Node.Name == "LogoutNode")
            {

                DialogResult result = MessageBox.Show("Are you sure you want to logout?", "Confirm Logout", MessageBoxButtons.OKCancel);
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    sessionManager = new SessionManager();
                    sessionManager.UserName = "";
                    sessionManager.UserID = 0;
                    sessionManager.Key = "";
                    tabViewer.TabPages.Clear();

                    tabViewer.TabPages.Add("Welcome", "Welcome");
                    index = tabViewer.TabPages.IndexOfKey("Welcome");

                    WelcomeTab welcomeTab = new WelcomeTab();
                    tabViewer.TabPages[index].Controls.Add(welcomeTab);

                    updateNavTree();
                }
            }
        }
Esempio n. 2
0
        private void navigationTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            int index = 0;

            if (e.Node.Name == "LoginNode")
            {
                if (!tabViewer.TabPages.ContainsKey("Login"))
                {
                    tabViewer.TabPages.Add("Login", "Login");
                    index = tabViewer.TabPages.IndexOfKey("Login");
                }
                tabViewer.SelectTab("Login");
                if (!tabViewer.TabPages[index].HasChildren)
                {
                    LoginTab login = new LoginTab();
                    login.LoginEvent += new LoginTab.LoginEventHandler(login_LoginEvent);
                    tabViewer.TabPages[index].Controls.Add(login);
                }
            }
            else if (e.Node.Name == "PatientInfoNode")
            {
                if (tabViewer.TabPages.ContainsKey("Welcome"))
                {
                    tabViewer.TabPages.RemoveByKey("Welcome");
                }

                if (!tabViewer.TabPages.ContainsKey("PatientInfo"))
                {
                    tabViewer.TabPages.Add("PatientInfo", "PatientInfo");
                    index = tabViewer.TabPages.IndexOfKey("PatientInfo");

                    PatientInfoTab patientTab = new PatientInfoTab(sessionManager, activeServer);

                    tabViewer.TabPages[index].Controls.Add(patientTab);
                }
                tabViewer.SelectTab("PatientInfo");
            }
            else if (e.Node.Name == "AppointmentNode")
            {
                if (tabViewer.TabPages.ContainsKey("Welcome"))
                {
                    tabViewer.TabPages.RemoveByKey("Welcome");
                }
                if (!tabViewer.TabPages.ContainsKey("Appointments"))
                {
                    tabViewer.TabPages.Add("Appointments", "Appointments");
                    index = tabViewer.TabPages.IndexOfKey("Appointments");

                    AppointmentTab appTab = new AppointmentTab(sessionManager, activeServer);
                    appTab.PrintEvent += new AppointmentTab.PrintEventHandler(appTab_PrintEvent);

                    tabViewer.TabPages[index].Controls.Add(appTab);
                }
                tabViewer.SelectTab("Appointments");
            }
            else if (e.Node.Name == "WelcomeNode")
            {
                if (!tabViewer.TabPages.ContainsKey("Welcome"))
                {
                    tabViewer.TabPages.Add("Welcome", "Welcome");
                    index = tabViewer.TabPages.IndexOfKey("Welcome");

                    WelcomeTab appTab = new WelcomeTab();

                    tabViewer.TabPages[index].Controls.Add(appTab);
                }
                tabViewer.SelectTab("Welcome");
            }
            else if (e.Node.Name == "LogoutNode")
            {
                DialogResult result = MessageBox.Show("Are you sure you want to logout?", "Confirm Logout", MessageBoxButtons.OKCancel);
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    sessionManager          = new SessionManager();
                    sessionManager.UserName = "";
                    sessionManager.Key      = "";
                    tabViewer.TabPages.Clear();

                    tabViewer.TabPages.Add("Welcome", "Welcome");
                    index = tabViewer.TabPages.IndexOfKey("Welcome");

                    WelcomeTab welcomeTab = new WelcomeTab();
                    tabViewer.TabPages[index].Controls.Add(welcomeTab);

                    updateNavTree();
                }
            }
        }