コード例 #1
0
        private void _sendSmsButton_Click
        (
            object sender,
            EventArgs e
        )
        {
            try
            {
                ReaderInfo reader = _PrepareReader();
                if (ReferenceEquals(reader, null))
                {
                    return;
                }

                string ticket = reader.Ticket.ThrowIfNull();
                if (!ControlCenter.CardExists(ticket))
                {
                    MessageBox.Show("Карты не существует");
                    return;
                }

                string phoneNumber = reader.HomePhone;
                if (string.IsNullOrEmpty(phoneNumber))
                {
                    MessageBox.Show("Не задан телефон!");
                    return;
                }

                ControlCenter.SendSms(reader);
            }
            catch (Exception exception)
            {
                ExceptionBox.Show(this, exception);
            }
        }
コード例 #2
0
        private void _deleteButton_Click
        (
            object sender,
            EventArgs e
        )
        {
            try
            {
                ReaderInfo reader = _PrepareReader();
                if (ReferenceEquals(reader, null))
                {
                    return;
                }

                string ticket = reader.Ticket.ThrowIfNull();
                if (!ControlCenter.CardExists(ticket))
                {
                    MessageBox.Show("Карты не существует");
                    return;
                }

                ControlCenter.DeleteCard(reader);
            }
            catch (Exception exception)
            {
                ExceptionBox.Show(this, exception);
            }
        }
コード例 #3
0
 private void MainForm_FormClosing
 (
     object sender,
     FormClosingEventArgs e
 )
 {
     ControlCenter.WriteLine("Shutdown");
 }
コード例 #4
0
        private void MainForm_Load
        (
            object sender,
            EventArgs e
        )
        {
            _browser.Navigate("about:blank");
            while (_browser.IsBusy)
            {
                Application.DoEvents();
            }
            Application.DoEvents();

            this.ShowVersionInfoInTitle();
            _logBox.Output.PrintSystemInformation();

            try
            {
                ControlCenter.Initialize(_logBox.Output);
            }
            catch (Exception exception)
            {
                Log.TraceException("MainForm::Load", exception);
                ExceptionBox.Show(this, exception);
                Application.Exit();
            }

            try
            {
                ControlCenter.Ping();
            }
            catch (Exception exception)
            {
                Log.TraceException("MainForm::Load", exception);
                ExceptionBox.Show(this, exception);
                Application.Exit();
            }

            ControlCenter.WriteLine("Ready");
            ControlCenter.WriteLine(string.Empty);
        }
コード例 #5
0
        private ReaderInfo _PrepareReader()
        {
            _Clear();

            string ticket = _ticketBox.Text.Trim();

            if (string.IsNullOrEmpty(ticket))
            {
                MessageBox.Show("Не задан читательский!");
                return(null);
            }

            ReaderInfo reader = ControlCenter.GetReader(ticket);

            if (ReferenceEquals(reader, null))
            {
                MessageBox.Show("Не найден читатель с указанным билетом!");
                return(null);
            }

            string description = ControlCenter.FormatReader(reader);
            bool   chk         = ControlCenter.CheckReader(reader);
            bool   exist       = ControlCenter.CardExists(ticket);

            _browser.DocumentText = "<html>"
                                    + (exist ?
                                       "<p><b><font color='red'>Карта уже существует!</font></b></p>"
                    : string.Empty
                                       )
                                    + description
                                    + "</html>";

            if (!chk)
            {
                return(null);
            }

            return(reader);
        }