Example #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                comboBoxCallsRange.DataSource     = _range;
                comboBoxReactionsRange.DataSource = _range;


                serialPort1.PortName = Properties.Settings.Default.PortName;
                serialPort1.Open();

                //chart1.DataSource = DataEngine.GetReactionTimeByBenfillers();
                //chart1.DataBind();
                //chart1.DataSource = DataEngine.GetReactionTimeByBenfillers(comboBox1.SelectedValue.ToString());
                //chart1.DataBind();

                chartCalls.Series["Series1"].XValueMember  = "LastName";
                chartCalls.Series["Series1"].YValueMembers = "Calls";

                chartReactions.Series["Series1"].XValueMember  = "LastName";
                chartReactions.Series["Series1"].YValueMembers = "AvgReactionTime";

                chart1.Series["Series1"].XValueMember  = "LastName";
                chart1.Series["Series1"].YValueMembers = "Calls";

                comboBox1.DataSource    = DataEngine.GetAllBenfillers();
                comboBox1.DisplayMember = "Фамилия";
                comboBox1.ValueMember   = "Номер участка";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
 private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
 {
     try
     {
         //  String msg = "Bytes to read: " + serialPort1.BytesToRead;
         //  MessageBox.Show( msg + "\n" );
         if (serialPort1.BytesToRead % 3 != 0)
         {
             return;
         }
         //String msg = "Bytes to read: " + serialPort1.BytesToRead;
         StringBuilder sb    = new StringBuilder(6);
         byte[]        buf   = new byte[3];
         int           count = serialPort1.Read(buf, 0, 3);
         foreach (byte x in buf)
         {
             sb.AppendFormat("{0:x2}", x);
         }
         //MessageBox.Show( msg + "\n" + sb.ToString());
         //-----------------------------------
         int buttonId = DataEngine.GetButtonIdByMacAddress(sb.ToString());
         if (DataEngine.IsCallButton(buttonId))
         {
             DataEngine.AddCallEvent(buttonId);
         }
         else
         {
             DataEngine.AddAcceptEvent(buttonId);
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message);
     }
 }
        private void buttonDelBenfiller_Click(object sender, EventArgs e)
        {
            var delBenfillerFrm = new DelBenfillerForm();

            if (delBenfillerFrm.ShowDialog() == DialogResult.OK)
            {
                DataEngine.DelBenfiller(delBenfillerFrm.BenfillerId);
                dataGridViewBenfillers.DataSource = DataEngine.GetAllBenfillers();
            }
        }
        private void buttonDelBtn_Click(object sender, EventArgs e)
        {
            var delBtnFrm = new DelButtonForm();

            if (delBtnFrm.ShowDialog() == DialogResult.OK)
            {
                DataEngine.DelButton(delBtnFrm.ButtonId);
                dataGridViewButtons.DataSource = DataEngine.GetAllButtons();
            }
        }
        private void buttonAddBenfiller_Click(object sender, EventArgs e)
        {
            var addBenfillerFrm = new AddBenfillerForm();

            if (addBenfillerFrm.ShowDialog() == DialogResult.OK)
            {
                DataEngine.AddBenfiller(addBenfillerFrm.BenfillerId, addBenfillerFrm.FirstName, addBenfillerFrm.LastName);
                dataGridViewBenfillers.DataSource = DataEngine.GetAllBenfillers();
            }
        }
Example #6
0
        private void buttonAddBenfiller_Click(object sender, EventArgs e)
        {
            var addBenfillerFrm = new AddSegment();

            if (addBenfillerFrm.ShowDialog() == DialogResult.OK)
            {
                DataEngine.AddSegment(addBenfillerFrm.Id, addBenfillerFrm.value);
                dataGridViewBenfillers.DataSource = DataEngine.GetAllSegments();
            }
            //DataEngine.AddSegmentBase();
        }
        public AddButtonForm()
        {
            InitializeComponent();

            comboBoxButtonTypes.DataSource  = this._buttonTypes;
            comboBoxBenfiller.DataSource    = DataEngine.GetAllBenfillers();
            comboBoxBenfiller.DisplayMember = "Фамилия";
            comboBoxBenfiller.ValueMember   = "Номер участка";
            comboBox1.DataSource            = DataEngine.GetAllSegments();
            comboBox1.DisplayMember         = "Название сегмента";
            comboBox1.ValueMember           = "Номер сегмента";
        }
Example #8
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (MessageBox.Show("Вы действительно хотите выйти?", "Выход из приложения", MessageBoxButtons.YesNo,
                         MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         DataEngine.CloseDB();
         Properties.Settings.Default.Save();
     }
     else
     {
         e.Cancel = true;
     }
 }
        private void buttonAddBtn_Click(object sender, EventArgs e)
        {
            var addBtnFrm = new AddButtonForm();

            if (addBtnFrm.ShowDialog() == DialogResult.OK)
            {
                //Сохраняем кнопку в БД
                if (String.IsNullOrEmpty(addBtnFrm.MacAddress))
                {
                    MessageBox.Show("Не заполнено поле \'Mac address\'!");
                }
                else
                {
                    DataEngine.AddButton(addBtnFrm.MacAddress, addBtnFrm.ButtonNumber, '1', '1', addBtnFrm.ButtonType, "AC", addBtnFrm.BenfillerId, addBtnFrm.SegmentId);

                    dataGridViewButtons.DataSource = DataEngine.GetAllButtons();
                }
            }
        }
 private void BenfillersForm_Load(object sender, EventArgs e)
 {
     dataGridViewBenfillers.DataSource = DataEngine.GetAllBenfillers();
 }
Example #11
0
 private void dataGridViewBenfillers_Load(object sender, EventArgs e)
 {
     dataGridViewBenfillers.DataSource = DataEngine.GetAllSegments();
 }
Example #12
0
 private void DelBenfillerForm_Load(object sender, EventArgs e)
 {
     comboBoxBenfiller.DataSource    = DataEngine.GetAllBenfillers();
     comboBoxBenfiller.DisplayMember = "Фамилия";
     comboBoxBenfiller.ValueMember   = "Номер участка";
 }
Example #13
0
 private void tabPageCalls_Enter(object sender, EventArgs e)
 {
     chartCalls.DataSource = DataEngine.GetAcceptedEventCountsByBenfillers(comboBoxCallsRange.SelectedValue.ToString());
     chartCalls.DataBind();
 }
 private void ButtonsForm_Load(object sender, EventArgs e)
 {
     dataGridViewButtons.DataSource = DataEngine.GetAllButtons();
 }
Example #15
0
 private void dateTimePicker2_ValueChanged(object sender, EventArgs e)
 {
     chart1.DataSource = DataEngine.GetReactionTimeByBenfillers(comboBox1.SelectedValue.ToString(), this.dateTimePicker1.Text, this.dateTimePicker2.Text, this.dateTimePicker1.Value, this.dateTimePicker2.Value);
     chart1.DataBind();
 }
Example #16
0
 private void tabPageTimes_Enter(object sender, EventArgs e)
 {
     chartReactions.DataSource = DataEngine.GetAverageReactionTimeByBenfillers(comboBoxReactionsRange.SelectedValue.ToString());
     chartReactions.DataBind();
 }
 private void DelButtonForm_Load(object sender, EventArgs e)
 {
     comboBoxButtonID.DataSource    = DataEngine.GetAllButtons();
     comboBoxButtonID.DisplayMember = "Номер кнопки";
     comboBoxButtonID.ValueMember   = "Номер кнопки";
 }
Example #18
0
 private void DelBenfillerForm_Load(object sender, EventArgs e)
 {
     comboBoxBenfiller.DataSource    = DataEngine.GetAllSegments();
     comboBoxBenfiller.DisplayMember = "Название сегмента";
     comboBoxBenfiller.ValueMember   = "Номер сегмента";
 }