public List <AttendanceImportData> GetUnClockOffTimeList(string name)
        {
            List <AttendanceImportData> unClockTimeList = new List <AttendanceImportData>();
            int days = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth(DateTime.Now.Year, GlobalDefine.Instance.Config.CurrentMonth);

            if (mMemberNameList.ContainsKey(name))
            {
                var signClockInData  = mClockInDataList[mMemberNameList[name]];
                var signClockOffData = mClockOffDataList[mMemberNameList[name]];
                for (int i = 1; i <= days; i++)
                {
                    if (signClockInData.ContainsKey(i))
                    {
                        AttendanceImportData clockInData  = signClockInData[i];
                        AttendanceImportData clockOffData = signClockOffData[i];
                        if (clockInData != null && clockOffData == clockInData && clockInData.IsMorningSign())
                        {
                            unClockTimeList.Add(clockInData);
                        }
                    }
                }
            }

            return(unClockTimeList);
        }
        private AttendanceImportData GetClockOffData(int id, int day)
        {
            AttendanceImportData data = null;

            if (mClockOffDataList.TryGetValue(id, out var dic))
            {
                dic.TryGetValue(day, out data);
            }
            return(data);
        }
        public WorkAddress GetBusinessWorkAddress(AttendanceImportData clockInTime,
                                                  AttendanceImportData clockOffTime)
        {
            var workAdress =
                GlobalDefine.Instance.Config.GetWorkAddress(WorkerType.Business, WorkAddressType.InCompany);

            if (workAdress.IsInAddressRange(clockInTime.Address) && workAdress.IsInAddressRange(clockOffTime.Address))
            {
                return(workAdress);
            }

            if (clockInTime.Address.Substring(0, 9) == clockOffTime.Address.Substring(0, 9))
            {
                workAdress =
                    GlobalDefine.Instance.Config.GetWorkAddress(WorkerType.Business, WorkAddressType.InShop);
            }
            else
            {
                workAdress =
                    GlobalDefine.Instance.Config.GetWorkAddress(WorkerType.Business, WorkAddressType.ShopPatrol);
            }

            return(workAdress);
        }
        protected override void Load(ExcelPackage package)
        {
            ExcelWorksheet worksheet = package.Workbook.Worksheets[1];

            for (int i = 2; i < worksheet.Dimension.End.Row; i++)
            {
                AttendanceImportData rowData = new AttendanceImportData();
                int col = 1;
                rowData.Type      = worksheet.GetValue <string>(i, col++);
                rowData.SignTime  = worksheet.GetValue <DateTime>(i, col++);
                rowData.Longitude = worksheet.GetValue <float>(i, col++);
                rowData.Latitude  = worksheet.GetValue <float>(i, col++);
                rowData.Address   = worksheet.GetValue <string>(i, col++);
                rowData.Id        = worksheet.GetValue <int>(i, col++);
                rowData.Name      = worksheet.GetValue <string>(i, col++);
                rowData.ShopName  = worksheet.GetValue <string>(i, col++);
                rowData.ShopId    = worksheet.GetValue <string>(i, col++);
                rowData.Job       = worksheet.GetValue <string>(i, col);

                if (string.IsNullOrEmpty(rowData.Job))
                {
                    continue;
                }

                if (rowData.SignTime.Month != GlobalDefine.Instance.Config.CurrentMonth)
                {
                    continue;
                }

                var specialMember = GlobalDefine.Instance.Config.FindSpeicalMember(rowData.Id);
                if (!mBusinessMemberNameList.ContainsKey(rowData.Id) && (rowData.GetWorkerType() == WorkerType.Business || specialMember != null && specialMember.GetWorkerType() == WorkerType.Business))
                {
                    mBusinessMemberNameList.Add(rowData.Id, rowData.Name);
                }

                if (!mAdministrativeMemberNameList.ContainsKey(rowData.Id) && (rowData.GetWorkerType() == WorkerType.Administration || specialMember != null && specialMember.GetWorkerType() == WorkerType.Administration))
                {
                    mAdministrativeMemberNameList.Add(rowData.Id, rowData.Name);
                }

                if (!mMemberNameList.ContainsKey(rowData.Name))
                {
                    mMemberNameList.Add(rowData.Name, rowData.Id);
                }

                LogController.Log(rowData.ToString());

                if (mClockInDataList.TryGetValue(rowData.Id, out var lastData))
                {
                    if (lastData.TryGetValue(rowData.SignTime.Day, out var lastAttendanceImportData))
                    {
                        if (lastAttendanceImportData.SignTime >= rowData.SignTime)
                        {
                            lastData[rowData.SignTime.Day] = rowData;
                        }
                    }
                    else
                    {
                        lastData.Add(rowData.SignTime.Day, rowData);
                    }
                }
                else
                {
                    var dic = new Dictionary <int, AttendanceImportData>();
                    dic.Add(rowData.SignTime.Day, rowData);
                    mClockInDataList.Add(rowData.Id, dic);
                }

                if (mClockOffDataList.TryGetValue(rowData.Id, out var lastClockOffData))
                {
                    if (lastClockOffData.TryGetValue(rowData.SignTime.Day, out var lastAttendanceImportData))
                    {
                        if (lastAttendanceImportData.SignTime <= rowData.SignTime)
                        {
                            lastClockOffData[rowData.SignTime.Day] = rowData;
                        }
                    }
                    else
                    {
                        lastClockOffData.Add(rowData.SignTime.Day, rowData);
                    }
                }
                else
                {
                    var dic = new Dictionary <int, AttendanceImportData>();
                    dic.Add(rowData.SignTime.Day, rowData);
                    mClockOffDataList.Add(rowData.Id, dic);
                }
            }

            mBusinessMemberNameList = mBusinessMemberNameList.OrderBy(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
        }