Пример #1
0
        private void _listener_UIDReceived(object sender, string uid, bool enterExit)
        {
            //MessageBox.Show(enterExit.ToString());
            System.Data.DataRow[] searchResult;                                // Массив строк, который получим от поиска по таблице
            searchResult = _staffTable.Select(String.Format(UID_FILTER, uid)); // Выбор строк, удовлетворяющих условиям, заданным в строке-фильтре

            if (searchResult.Length != 0)
            {
                StaffOutputInfo staffInfo = new StaffOutputInfo((Access_control_in_OneWire.StaffRow)searchResult[0]);

                ShowFace(staffInfo, 0, enterExit);
                WriteEventToLog(uid, enterExit);

                if (searchResult.Length > 1)
                {
                    MessageBox.Show(null, "Дубликаты UID!", "АААА!!!");                     // Time to shit bricks
                }
                else
                {
                    _dialog.SendCommand(ACCommand.OpenAndRead);
                }
            }
            else
            {
                ShowFace(null, 0, enterExit);
                _dialog.SendCommand(ACCommand.BeepAndRead);
                _dialog.Pause();
                Alarm form2 = new Alarm(uid);
                form2.ShowDialog();
                _dialog.Resume();
                //MessageBox.Show(null, "Предъявлен неизвестный UID!\n" + uid, "ВНИМАНИЕ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #2
0
 public void ShowFace(StaffOutputInfo staffInfo, int ttl, bool enterExit)
 {
     if (pic_face.InvokeRequired)
     {
         ShowFaceCallBack cb = ShowFace;
         this.Invoke(cb, staffInfo, ttl, enterExit);
         return;
     }
     ShowFace_Invoked(staffInfo, ttl, enterExit);
 }
Пример #3
0
        private void ShowFace_Invoked(StaffOutputInfo staffInfo, int ttl, bool enterExit)
        {
            if (staffInfo == null)
            {
                FlushFields();
                return;
            }

            try
            {
                pic_face.Image = new Bitmap(staffInfo.PicturePath);
            }
            catch (Exception e)
            {
                MessageBox.Show(null, e.Message, "Ошибка");
            }

            bool notInTime = true;

            #region CheckingTime

            _shAdapter.Fill(_shTable, staffInfo.Shedule);
            DateTime start;
            DateTime fin;
            DateTime.TryParse(_shTable.Rows[0][0].ToString(), out start);
            DateTime.TryParse(_shTable.Rows[0][1].ToString(), out fin);

            if (CompareHoursAndMinutes(DateTime.Now, fin) == 1 && CompareHoursAndMinutes(DateTime.Now, start) == -1)
            {
                notInTime = false;
            }

            #endregion

            l_fio.Text        = staffInfo.Fio;
            l_division.Text   = staffInfo.Division;
            l_number.Text     = staffInfo.Number;
            l_profession.Text = staffInfo.Profession;
            l_shedule.Text    = staffInfo.Shedule;
            l_uidType.Text    = staffInfo.UidType;
            l_actionTime.Text = DateTime.Now.ToString();
            if (enterExit)
            {
                //l_action.Text = "Выход";
                pB_vihod.Visible = true;
                pB_vihod.BringToFront();
            }
            else
            {
                pB_enter.Visible = true;
                pB_enter.BringToFront();
                //l_action.Text = "Проход";
            }
            pB_notInTime.Visible = notInTime;
            l_blocked.Visible    = staffInfo.Blocked;

            this.WindowState = FormWindowState.Minimized;
            this.WindowState = FormWindowState.Normal;
            this.Show();
            this.WindowState = FormWindowState.Normal;
            this.Focus();
            this.CenterToScreen();
            if (ttl > 0)
            {
                Timer tmr = new Timer {
                    Interval = ttl
                };
                tmr.Start();
                tmr.Tick += tmr_Tick;
            }
        }