Exemplo n.º 1
0
 private void btnConnectDevice_Click(object sender, EventArgs e)
 {
     using (MSD150SDK.MSD150 device = new MSD150SDK.MSD150(Model.CommonFunctions.ParseInt(txtMachineNo.Text), txtIPAddress.Text,
                                                           Model.CommonFunctions.ParseInt(txtPortNo.Text), Model.CommonFunctions.ParseInt(txtPassword.Text), true))
     {
         if (device == null)
         {
             MessageBox.Show("Unable to open device", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             MessageBox.Show("Device connected successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Exemplo n.º 2
0
        private void btnGetEmployeeAttendance_Click(object sender, EventArgs e)
        {
            gcEmployeeAttendance.DataSource = null;
            using (MSD150SDK.MSD150 device = new MSD150SDK.MSD150(Model.CommonFunctions.ParseInt(txtMachineNo.Text), txtIPAddress.Text,
                                                                  Model.CommonFunctions.ParseInt(txtPortNo.Text), Model.CommonFunctions.ParseInt(txtPassword.Text), true))
            {
                if (device == null)
                {
                    MessageBox.Show("Unable to open device", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                var Result = device.GetEmployeeAttendanceAllLog();
                if (Result.Result == MSD150SDK.eExecutionResult.Succeed)
                {
                    var log = (List <MSD150SDK.GLogInfo>)Result.ResultValue;
                    gcEmployeeAttendance.DataSource = log;

                    //DAL.Employee.EmployeeDAL EmployeeDALObj = new DAL.Employee.EmployeeDAL();
                    //EmployeeDALObj = new DAL.Employee.EmployeeDAL();

                    //var emp = EmployeeDALObj.GetLookupList();

                    //var logfinal = from r in log
                    //               join re in emp on r.enroll equals re.BMDCode into jemp
                    //               from rre in jemp.DefaultIfEmpty()
                    //               select new Model.Payroll.EmployeeTimeLogViewModel()
                    //               {
                    //                   BMDCode = (rre != null ? rre.BMDCode : 0),
                    //                   EmployeeID = (rre != null ? rre.EmployeeID : 0),
                    //                   EmployeeName = (rre != null ? rre.EmployeeName : "Employee Name Not found"),
                    //                   LogTime = Convert.ToDateTime(r.logtime, System.Globalization.CultureInfo.InvariantCulture),
                    //               };


                    //gcEmployeeAttendance.DataSource = logfinal.ToList();
                    //gvEmployeeAttendance.Columns["LogTime"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
                    //gvEmployeeAttendance.Columns["LogTime"].DisplayFormat.FormatString = "t";
                }
                else if (Result.Result == MSD150SDK.eExecutionResult.Error)
                {
                    MessageBox.Show(Result.Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }