public Main() { InitializeComponent(); dataThread = new Thread(new ThreadStart(() => { try { GetSqlServer(); context = new JournalContext(sqlConnection.ConnectionString); context.Employees.Load(); context.JournalRecors.Load(); context.Jobs.Load(); WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_DeviceChangeEvent"); ManagementEventWatcher watcher = new ManagementEventWatcher(query); watcher.EventArrived += Watcher_EventArrived; watcher.Start(); GetArduino(); Invoke((Action)(() => circularProgressBar1.Visible = false)); } catch (Exception ex) { MessageBox.Show(ex.Message); } })); }
public DataForReport(JournalContext context) { DateTime first = DateTime.Now.First(); DateTime last = DateTime.Now.Last(); GetData(context.JournalRecors.Where(j => j.Date >= first.Date && j.Date <= last.Date).ToList(), context); }
public CreateEployee(JournalContext context) { InitializeComponent(); this.context = context; comboBox1.DataSource = context.Jobs.Local; comboBox1.DisplayMember = "JobDescription"; comboBox1.ValueMember = "JobId"; }
public EmployeeState(JournalContext context) { InitializeComponent(); this.context = context; comboBox1.DisplayMember = "FullName"; comboBox1.ValueMember = "Id"; comboBox1.DataSource = context.Employees.Local; comboBox1.SelectedIndex = -1; }
public CreateEployee(long id, JournalContext context) { InitializeComponent(); Thread.CurrentThread.TrySetApartmentState(ApartmentState.STA); this.context = context; textBox4.Text = id.ToString(); textBox4.Enabled = false; comboBox1.DataSource = context.Jobs.Local; comboBox1.DisplayMember = "JobDescription"; comboBox1.ValueMember = "JobId"; }
public Employees(JournalContext context) { InitializeComponent(); this.context = context; comboBox1.DisplayMember = "JobDescription"; comboBox1.ValueMember = "JobId"; comboBox2.DisplayMember = "FullName"; comboBox2.ValueMember = "Id"; comboBox1.DataSource = context.Jobs.Local; comboBox2.DataSource = context.Employees.Local; comboBox2.AutoCompleteMode = AutoCompleteMode.SuggestAppend; comboBox2.AutoCompleteSource = AutoCompleteSource.ListItems; }
public void GetData(List <JournalRecord> records, JournalContext context) { foreach (JournalRecord rec in records) { ExtRecord extendRec = new ExtRecord(); extendRec.Date = rec.Date.ToShortDateString(); extendRec.Image = rec.Employee.Photo != null ? rec.Employee.Photo : Properties.Resources.specialist_user.ToByteArray(ImageFormat.Bmp); extendRec.FIO = rec.Employee.FullName; extendRec.In = rec.In.ToString(@"HH\:mm"); extendRec.Out = rec.Out.HasValue ? rec.Out.Value.ToString(@"HH\:mm") : null; if (!rec.Out.HasValue) { extendRec.Time = 0; } else { extendRec.Time = (int)rec.Out.Value.TimeOfDay.TotalMinutes - (int)rec.In.TimeOfDay.TotalMinutes + (rec.Out.Value.Date - rec.In.Date).Days * 1440; } Add(extendRec); } }
public DataForReport(JournalContext context, Employee employee, DateTime from, DateTime to) { GetData(context.JournalRecors.Where(j => j.Date >= from.Date.Date && j.Date <= to.Date.Date && j.Employee == employee).ToList(), context); }
public DataForReport(JournalContext context, Employee employee) { GetData(context.JournalRecors.Where(j => j.Employee == employee).ToList(), context); }
public Report(JournalContext context) { InitializeComponent(); this.context = context; }