Esempio n. 1
0
 private void SerialPortDataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     Invoke((Action)(() =>
     {
         try
         {
             string CardIdStr = selectedPort.ReadLine();
             selectedPort.DiscardInBuffer();
             if (CardIdStr.Length == 11)
             {
                 long CardId = long.Parse(CardIdStr);
                 Employee employee = context.Employees.Where(emp => emp.CardId == CardId).FirstOrDefault();
                 if (employee == null)
                 {
                     CreateEployee emp = new CreateEployee(CardId, context);
                     emp.ShowDialog();
                 }
                 else
                 {
                     string status = AddJournalRecord(employee);
                     //string job = context.Jobs.Find(employee.JobId).JobDescription;
                     EmployeeInfo info = new EmployeeInfo(employee, status);
                     info.ShowDialog();
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }));
 }
Esempio n. 2
0
        private void добавитьСотрудникаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateEployee emp = new CreateEployee(context);

            emp.ShowDialog();
        }