Esempio n. 1
0
        private void CreateNullDatabase()
        {
            HRM_TIMEKEEPER_MACHINE hRMTIMEKEEPERMACHINE = new HRM_TIMEKEEPER_MACHINE();

            this.gcList.DataSource = hRMTIMEKEEPERMACHINE.CreateNullDataTable();
        }
Esempio n. 2
0
        private void UpdateTimekeeper()
        {
            //DataRow row = null;
            Thread thread;

            string[] firstName;
            Options.SetWaitDialogCaption("Đang xóa dữ liệu...");
            HRM_TIMEKEEPER_MACHINE hRMTIMEKEEPERMACHINE = new HRM_TIMEKEEPER_MACHINE();

            hRMTIMEKEEPERMACHINE.DeleteAll();
            int num = 0;

            this.EnrollDataTable.Rows.Clear();
            foreach (DataRow row in (this.gcList.DataSource as DataTable).Rows)
            {
                if (num % 100 == 0)
                {
                    Options.SetWaitDialogCaption(string.Concat("Đang thêm dữ liệu...", row["EnrollNumber"].ToString()));
                }
                num++;
                hRMTIMEKEEPERMACHINE.ID           = Guid.NewGuid();
                hRMTIMEKEEPERMACHINE.EnrollNumber = row["EnrollNumber"].ToString();
                hRMTIMEKEEPERMACHINE.Date         = Convert.ToDateTime(row["Date"].ToString());
                DateTime dateTime  = Convert.ToDateTime(row["Date"].ToString());
                DateTime dateTime1 = Convert.ToDateTime(row["Hour"].ToString());
                hRMTIMEKEEPERMACHINE.Hour       = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime1.Hour, dateTime1.Minute, dateTime1.Second);
                hRMTIMEKEEPERMACHINE.StateInOut = Convert.ToInt32(row["StateInOut"].ToString());
                hRMTIMEKEEPERMACHINE.MachineID  = row["MachineID"].ToString();
                hRMTIMEKEEPERMACHINE.Insert();
                if (!this.IsExistEnrollDataTable(row["EnrollNumber"].ToString()))
                {
                    DataRowCollection rows = this.EnrollDataTable.Rows;
                    object[]          str  = new object[] { row["EnrollNumber"].ToString() };
                    rows.Add(str);
                }
            }
            Options.CloseDialog();
            DateTime     dateTime2   = Convert.ToDateTime(this.bbeCC.EditValue.ToString());
            DateTime     dateTime3   = Convert.ToDateTime(this.bbeCCTo.EditValue.ToString());
            HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE();

            foreach (DataRow dataRow in this.EnrollDataTable.Rows)
            {
                hRMEMPLOYEE.GetByEnroll(dataRow["EnrollNumber"].ToString());
                HRM_EMPLOYEE_SCHEDULE hRMEMPLOYEESCHEDULE = new HRM_EMPLOYEE_SCHEDULE();
                hRMEMPLOYEESCHEDULE.Get(hRMEMPLOYEE.EmployeeCode);
                if (hRMEMPLOYEESCHEDULE.IsAutomatic)
                {
                    firstName = new string[] { "Đang nhận ca...", hRMEMPLOYEE.FirstName, " ", hRMEMPLOYEE.LastName, "(", hRMEMPLOYEE.EmployeeCode, ")" };
                    Options.SetWaitDialogCaption(string.Concat(firstName));
                    thread = new Thread(() => hRMTIMEKEEPERMACHINE.SetShift(new DateTime(dateTime2.Year, dateTime2.Month, dateTime2.Day), new DateTime(dateTime3.Year, dateTime3.Month, dateTime3.Day), hRMEMPLOYEE.EmployeeCode));
                    thread.Start();
                    thread.Join();
                }
            }
            Options.CloseDialog();
            foreach (DataRow row1 in hRMEMPLOYEE.GetCompactList(MyLogin.Level, MyLogin.Code, 1, dateTime2, dateTime3).Rows)
            {
                firstName = new string[] { "Đang cập nhật...", row1["FirstName"].ToString(), " ", row1["LastName"].ToString(), "(", row1["EmployeeCode"].ToString(), ")" };
                Options.SetWaitDialogCaption(string.Concat(firstName));
                thread = new Thread(() => hRMTIMEKEEPERMACHINE.UpdateTimeKeeper(new DateTime(dateTime2.Year, dateTime2.Month, dateTime2.Day), new DateTime(dateTime3.Year, dateTime3.Month, dateTime3.Day), row1["EmployeeCode"].ToString()));
                thread.Start();
                thread.Join();
            }
            Options.CloseDialog();
        }