Esempio n. 1
0
 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);
         }
     }));
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public CreateEployee(JournalContext context)
 {
     InitializeComponent();
     this.context            = context;
     comboBox1.DataSource    = context.Jobs.Local;
     comboBox1.DisplayMember = "JobDescription";
     comboBox1.ValueMember   = "JobId";
 }
Esempio n. 4
0
 public EmployeeState(JournalContext context)
 {
     InitializeComponent();
     this.context            = context;
     comboBox1.DisplayMember = "FullName";
     comboBox1.ValueMember   = "Id";
     comboBox1.DataSource    = context.Employees.Local;
     comboBox1.SelectedIndex = -1;
 }
Esempio n. 5
0
 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";
 }
Esempio n. 6
0
 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;
 }
Esempio n. 7
0
 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);
     }
 }
Esempio n. 8
0
 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);
 }
Esempio n. 9
0
 public DataForReport(JournalContext context, Employee employee)
 {
     GetData(context.JournalRecors.Where(j => j.Employee == employee).ToList(), context);
 }
Esempio n. 10
0
 public Report(JournalContext context)
 {
     InitializeComponent();
     this.context = context;
 }