Esempio n. 1
0
        private void RefreshUserListBox()
        {
            try
            {
                using (var context = new LorikeetAppEntities())
                {
                    listBoxUsers.Items.Clear();

                    var usernames = (from log in context.Logins
                                     join staff in context.Staffs on log.LoginID equals staff.LoginID
                                     select new { staff, log }).ToList();

                    string staffName = MiscStuff.GetStaffName(staffID);

                    foreach (var name in usernames)
                    {
                        if (access == 10)
                        {
                            listBoxUsers.Items.Add(name.staff.StaffName);
                        }
                        else if ((access == 8 && staffName.Equals(name.staff.StaffName)) || name.log.Access <= 6)
                        {
                            listBoxUsers.Items.Add(name.staff.StaffName);
                        }
                        else if (access == 6 && staffName.Equals(name.staff.StaffName))
                        {
                            listBoxUsers.Items.Add(name.staff.StaffName);
                        }
                    }
                }
            }
            catch { }
        }
        public FormMDIDocumentViewer(int staffID)
        {
            InitializeComponent();

            formsList = new List <FormsToDisplay>();
            InitData();

            try
            {
                staffName = MiscStuff.GetStaffName(staffID);

                SetupPopupMenus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(MiscStuff.GetAllMessages(ex));
            }
        }
Esempio n. 3
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            while (true)
            {
                if (worker != null && worker.CancellationPending == true)
                {
                    e.Cancel = true;
                    break;
                }
                else
                {
                    System.Threading.Thread.Sleep(1000);
                    int getLogID = Logging.GetLastLogID();
                    if (getLogID != lastLogID)
                    {
                        lock (_locker)
                        {
                            List <Log> tempLogList = Logging.GetAllBroadcastLogsFromID(lastLogID);
                            lastLogID = getLogID;

                            foreach (var tll in tempLogList)
                            {
                                broadCastQueue.Enqueue(tll.DateTime + ": Staff Name - " + MiscStuff.GetStaffName(tll.StaffID) + ": " + tll.Message);
                                if (tll.RefreshCode >= 3)
                                {
                                    buttonRefresh.Invoke((MethodInvoker) delegate { buttonRefresh.Enabled = true; });
                                }
                            }
                        }
                    }
                }
            }
        }