Example #1
0
        public AdminInterface()
        {
            db = new DBWork();
            InitializeComponent();
            List <SessionPanel> panel     = new List <SessionPanel>();
            List <SessionPanel> panelacrh = new List <SessionPanel>();
            var names = db.getNames();


            foreach (var name in names)
            {
                foreach (var ses in db.getSessionByName(name))
                {
                    if (ses.IsArchived)
                    {
                        panelacrh.Add(new SessionPanel()
                        {
                            Manager = name, Sessions = ses.Session_Name, Session_ID = ses.ID_Session, Archieved = ses.IsArchived
                        });
                    }
                    else
                    {
                        panel.Add(new SessionPanel()
                        {
                            Manager = name, Sessions = ses.Session_Name, Session_ID = ses.ID_Session, Archieved = ses.IsArchived
                        });
                    }
                }
            }

            active.ItemsSource   = panel;
            archived.ItemsSource = panelacrh;
        }
Example #2
0
        private void Button_Click_Delete(object sender, RoutedEventArgs e)
        {
            Button btn = (Button)sender;

            db.deleteSession(((SessionPanel)btn.DataContext).Session_ID);

            List <SessionPanel> panel     = new List <SessionPanel>();
            List <SessionPanel> panelacrh = new List <SessionPanel>();

            var names = db.getNames();

            foreach (var name in names)
            {
                foreach (var ses in db.getSessionByName(name))
                {
                    if (ses.IsArchived)
                    {
                        panelacrh.Add(new SessionPanel()
                        {
                            Manager = name, Sessions = ses.Session_Name, Session_ID = ses.ID_Session
                        });
                    }
                    else
                    {
                        panel.Add(new SessionPanel()
                        {
                            Manager = name, Sessions = ses.Session_Name, Session_ID = ses.ID_Session
                        });
                    }
                }
            }

            active.ItemsSource   = panel;
            archived.ItemsSource = panelacrh;
        }
Example #3
0
        private void CheckPass_Click(object sender, RoutedEventArgs e)
        {
            string   password = Pass.Password;
            Security secur    = new Security();
            var      isPassOk = secur.tryLogin(username, password);

            if (!isPassOk)
            {
                MessageBox.Show("Неверно введен пароль. Проверьте язык и CAPS LOCK.");
            }
            else
            {
                if (secur.IsUserAdmin(username))
                {
                    new AdminInterface().Show();
                }
                else
                {
                    new SelectSession(username).Show();
                }

                this.Close();
            }

            var sessions = db.getSessionByName(username);

            foreach (var ses in sessions)
            {
                if (ses.ArchTime <= DateTime.Today)
                {
                    db.ArchiveSession(ses.ID_Session, true);
                }
            }
        }
        private void CreateSession_DataChanged(object sender, EventArgs e)
        {
            List <Session> panel = new List <Session>();

            var names = db.getNames();

            foreach (var ses in db.getSessionByName(userName))
            {
                if (!ses.IsArchived)
                {
                    panel.Add(new Session()
                    {
                        Session_Name = ses.Session_Name, ID_Session = ses.ID_Session, IsArchived = ses.IsArchived
                    });
                }
            }

            Session.ItemsSource = panel;
        }
        private void LoadSessionsList()
        {
            db = new DBWork();
            List <Session> panel = new List <Session>();

            foreach (var ses in db.getSessionByName(userName))
            {
                if (!ses.IsArchived)
                {
                    panel.Add(new Session()
                    {
                        Session_Name = ses.Session_Name,
                        ID_Session   = ses.ID_Session,
                        IsArchived   = ses.IsArchived
                    });
                }
            }

            Session.ItemsSource = panel;
        }
        private void DeleteSession_Click(object sender, RoutedEventArgs e)
        {
            Button btn = (Button)sender;

            db = new DBWork();
            db.deleteSession(((Session)btn.DataContext).ID_Session);

            List <Session> panel = new List <Session>();

            foreach (var ses in db.getSessionByName(userName))
            {
                if (!ses.IsArchived)
                {
                    panel.Add(new Session()
                    {
                        Session_Name = ses.Session_Name, ID_Session = ses.ID_Session, IsArchived = ses.IsArchived
                    });
                }
            }

            Session.ItemsSource = panel;
        }
Example #7
0
        private void CreateSession_DataChanged(object sender, EventArgs e)
        {
            List <SessionPanel> panel     = new List <SessionPanel>();
            List <SessionPanel> panelacrh = new List <SessionPanel>();

            db = new DBWork();

            active.ItemsSource   = null;
            archived.ItemsSource = null;

            var names = db.getNames();


            foreach (var name in names)
            {
                var sessions = db.getSessionByName(name);
                foreach (var ses in sessions)
                {
                    if (ses.IsArchived)
                    {
                        panelacrh.Add(new SessionPanel()
                        {
                            Manager = name, Sessions = ses.Session_Name, Session_ID = ses.ID_Session
                        });
                    }
                    else
                    {
                        panel.Add(new SessionPanel()
                        {
                            Manager = name, Sessions = ses.Session_Name, Session_ID = ses.ID_Session
                        });
                    }
                }
            }

            active.ItemsSource   = panel;
            archived.ItemsSource = panelacrh;
        }