private void buttonClearLogs_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show(@"You are about to clear machine logs, continue?", "Clear Logs",
                                             MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (d == DialogResult.Yes)
            {
                Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                try
                {
                    int iError = 0;
                    if (AccessDataClass.ClearDeviceLogs(1, ref iError, 2, sIP, iPort))
                    {
                        MessageBox.Show(@"Device Logs Cleared", @"Clear Logs", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show(iError.ToString(), @"Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    groupBox2.Enabled = false;
                }
                catch (Exception)
                {
                    MessageBox.Show(@"Please make sure the device is connected.", @"Device", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    //throw;
                }
                Cursor.Current = Cursors.Default;
            }
        }
示例#2
0
        private void buttonDownLoadLogs_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            Application.DoEvents();
            //List<Enrollee>lEnrollees = new List<Enrollee>();
            var en1 = new Enrollee();

            en1.SEnrollNumber = 1.ToString();
            en1.IEnrollNumber = 1;
            //lEnrollees.Add(en1);

            //var en2 = new Enrollee();
            //en2.SEnrollNumber = 2.ToString();
            //en2.IEnrollNumber = 2;
            //lEnrollees.Add(en2);

            labelInfo.Text = @"Device Logs...";
            string sError = string.Empty;

            lLogs = AccessDataClass.GetAttlog(1, ref sError, 2, "192.168.1.201", 4370);
            if (sError.Length > 0)
            {
                MessageBox.Show(sError, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                dataGridView1.DataSource = null;
                bs.DataSource            = ProcessLogClass.LoadEnrolleeAttendance(en1, lLogs.FindAll(l => l.SEnrollNumber == "1"));
                //bs.DataSource = lLogs;
                dataGridView1.DataSource = bs;
            }
            Cursor.Current = Cursors.Default;
        }
示例#3
0
        private void LoadLogFromDevice()
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                toolStripStatusLabel1.Text = @"Machine logs loading...";
                Application.DoEvents();
                string sError = string.Empty;

                lLogs = (UtilityClass.GetScreenType() == "CO") ? AccessDataClass.GetAttlog(1, ref sError, 2, sIP, iPort) : AccessDataClass.GetAttlog(1, ref sError, 2, false, sIP, iPort);

                if (sError.Length > 0)
                {
                    MessageBox.Show(sError, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    machineBindingSource.DataSource = lLogs;
                    toolStripStatusLabel1.Text      = @"Machine logs loaded successfull (" + lLogs.Count.ToString() + ")";
                    //if (lLogs.Count > 0)
                    //{
                    toolStripButtonExport.Enabled  = true;
                    toolStripButtonToDBase.Enabled = true;
                    //}
                }
            }
            catch (Exception)
            {
                MessageBox.Show(@"Please make sure to connect the device before downloading any data", @"Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //throw;
            }
            Cursor.Current = Cursors.Default;
        }
示例#4
0
        private void buttonGetRecords_Click(object sender, EventArgs e)
        {
            Cursor.Current           = Cursors.WaitCursor;
            dataGridView1.DataSource = null;
            int iError  = 0;
            int iRecord = AccessDataClass.GetRecordOnDevice(1, 6, ref iError, 2, "192.168.1.201", 4370);

            Application.DoEvents();
            labelInfo.Text = @"Device Logs (" + iRecord.ToString() + ")";
            Cursor.Current = Cursors.Default;
        }
示例#5
0
        private void buttonClearLogs_Click(object sender, EventArgs e)
        {
            Cursor.Current           = System.Windows.Forms.Cursors.WaitCursor;
            dataGridView1.DataSource = null;
            int iError = 0;

            if (AccessDataClass.ClearDeviceLogs(1, ref iError, 2, "192.168.1.201", 4370))
            {
                labelInfo.Text = @"Device Logs Clear";
                MessageBox.Show(@"Device Logs Cleared", @"Clear Logs", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(iError.ToString(), @"Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            Cursor.Current = Cursors.Default;
        }
示例#6
0
        private void buttonImportToTextFile_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            var sBox = new SaveFileDialog();

            sBox.Filter   = @"CSV Files (*.csv)|*.csv|Text File (*.txt)|*.txt";
            sBox.FileName = "Carmen Data " + DateTime.Today.ToString("MM-dd-yyy");
            if (sBox.ShowDialog() == DialogResult.OK)
            {
                string sFilePath = sBox.FileName.Trim();
                try
                {
                    if (sFilePath.Length > 0)
                    {
                        TextWriter tw     = new StreamWriter(@"" + sFilePath);
                        string     sError = string.Empty;
                        lLogs = AccessDataClass.GetAttlog(1, ref sError, 2, "192.168.1.201", 4370);
                        foreach (var logs in lLogs)
                        {
                            tw.WriteLine(logs.Index.ToString() + ", " + logs.EMachineNumber.ToString() + ", " +
                                         logs.EnrollNumber.ToString() + ", " +
                                         logs.TMachineNumnber + ", " + logs.SEnrollNumber + ", " + logs.IYear.ToString() +
                                         ", " +
                                         logs.IMonth.ToString() + ", " + logs.IDay + ", " + logs.IHour.ToString() + ", " +
                                         logs.IMinute + ", " + logs.ISecond + ", " +
                                         logs.InOutCode.ToString() + ", " + logs.IWorkCode.ToString() + ", " +
                                         logs.VerifyCode.ToString() + ", " + logs.GetDate().ToString() + ", " + logs.GetTime(1) + ", " + logs.GetTime(2));
                        }
                        tw.Close();
                        Cursor.Current = Cursors.Default;
                        if (sError.Equals(""))
                        {
                            MessageBox.Show(@"Data Access Successfull");
                        }
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine(e.ToString());
                    throw;
                }
            }
        }
 private void button3_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     try
     {
         int iError  = 0;
         int iRecord = AccessDataClass.GetRecordOnDevice(1, 6, ref iError, 2, sIP, iPort);
         Application.DoEvents();
         MessageBox.Show(@"Device Logs (" + iRecord.ToString() + @")", @"Check Out Logs", MessageBoxButtons.OK, MessageBoxIcon.Information);
         groupBox2.Enabled = false;
     }
     catch (Exception)
     {
         MessageBox.Show(@"Please make sure the device is connected.", @"Device", MessageBoxButtons.OK,
                         MessageBoxIcon.Information);
         //throw;
     }
     Cursor.Current = Cursors.Default;
 }