Exemplo n.º 1
0
        private ErrorInfo SaveSumAttendanceData(List <SummaryAttendanceData> list, IWorkbook workbook_old, out IWorkbook workbook)
        {
            workbook = workbook_old;
            var errorinfo = new ErrorInfo();
            var otime     = new OverTime();

            try
            {
                var sheet    = workbook.CreateSheet("Master");
                int rowcount = list.Count;
                this.GetHeaderAttendanceData_Master(sheet);
                for (int i = 0; i < rowcount; i++)
                {
                    var   record            = new DailyAttendanceData();
                    IRow  row               = sheet.CreateRow(i + 1);
                    ICell cell_GetudoYYYYMM = row.CreateCell(0);
                    cell_GetudoYYYYMM.SetCellValue(list[i].GetudoYYYYMM);
                    ICell  cell_OverTime = row.CreateCell(1);
                    string overtime      = otime.ConvertOverTimeToString(list[i].OverTime);
                    cell_OverTime.SetCellValue(overtime);
                    ICell cell_IS45Over = row.CreateCell(2);
                    cell_IS45Over.SetCellValue(list[i].Is45Over);
                    ICell cell_IS80Over = row.CreateCell(3);
                    cell_IS80Over.SetCellValue(list[i].Is80Over);
                }
            }
            catch (Exception ex)
            {
                errorinfo.HasError    = true;
                errorinfo.ErrorReason = ex.Message;
            }

            return(errorinfo);
        }
Exemplo n.º 2
0
        private ErrorInfo GetAttendanceData(IWorkbook workbook, int item, out List <DailyAttendanceData> attendanceDataList)
        {
            var errorinfo = new ErrorInfo();

            attendanceDataList = new List <DailyAttendanceData>();
            try
            {
                var sheet = workbook.GetSheet(item.ToString());
                if (sheet == null)
                {
                    return(errorinfo);
                }
                int lastRow = sheet.LastRowNum;
                for (int i = 1; i <= lastRow; i++)
                {
                    var   record    = new DailyAttendanceData();
                    IRow  row       = sheet.GetRow(i);
                    ICell cell      = row == null ? null : row.GetCell(0);
                    int   intyyyymm = cell == null ? 0 : (int)cell.NumericCellValue;
                    if (intyyyymm != 0)
                    {
                        record.GetudoYYYYMM = intyyyymm;
                        ICell    cell_date   = row == null ? null : row.GetCell(1);
                        string   string_date = cell_date == null ? string.Empty : cell_date.DateCellValue.ToShortDateString();
                        DateTime date;
                        DateTime.TryParse(string_date, out date);
                        record.Day = date;
                        ICell  cell_daykbn = row == null ? null : row.GetCell(2);
                        double daykbn      = cell_daykbn == null ? 0 : cell_daykbn.NumericCellValue;
                        record.DayKBN = (EnumManager.DayKBN)((int)daykbn);

                        ICell  cell_PlanMMSS_Start = row == null ? null : row.GetCell(3);
                        string plammmss_st         = cell_PlanMMSS_Start == null ? null : cell_PlanMMSS_Start.StringCellValue;
                        record.PlanMMSS_Start = string.IsNullOrEmpty(plammmss_st) ? (int?)null : int.Parse(plammmss_st);
                        ICell  cell_PlanMMSS_End = row == null ? null : row.GetCell(4);
                        string plammmss_end      = cell_PlanMMSS_End == null ? null : cell_PlanMMSS_End.StringCellValue;
                        record.PlanMMSS_END = string.IsNullOrEmpty(plammmss_end) ? (int?)null : int.Parse(plammmss_end);
                        ICell  cell_ResultMMSS_Start = row == null ? null : row.GetCell(5);
                        string resultmmss_st         = cell_ResultMMSS_Start == null ? null : cell_ResultMMSS_Start.StringCellValue;
                        record.ResultMMSS_Start = string.IsNullOrEmpty(resultmmss_st) ? (int?)null : int.Parse(resultmmss_st);
                        ICell  cell_ResultMMSS_End = row == null ? null : row.GetCell(6);
                        string resultmmss_end      = cell_ResultMMSS_End == null ? null : cell_ResultMMSS_End.StringCellValue;
                        record.ResultMMSS_END = string.IsNullOrEmpty(resultmmss_end) ? (int?)null : int.Parse(resultmmss_end);

                        ICell cell_Bikou = row == null ? null : row.GetCell(7);
                        record.Bikou = cell_Bikou == null ? string.Empty : cell_Bikou.StringCellValue;

                        attendanceDataList.Add(record);
                    }
                }
            }
            catch (Exception ex)
            {
                errorinfo.HasError    = true;
                errorinfo.ErrorReason = ex.Message;
            }

            return(errorinfo);
        }
Exemplo n.º 3
0
        private void AvoidanceAttendanceData(List <DispDailyAttendanceData> displist)
        {
            var list = new List <DailyAttendanceData>();

            foreach (var item in displist)
            {
                var record = new DailyAttendanceData();
                record.ConvertToData(item);
                list.Add(record);
            }
            this.AttendanceDataBox.Add(list);
        }
Exemplo n.º 4
0
 public List <DispDailyAttendanceData> RefrectionBackNumberCell(List <DispDailyAttendanceData> list)
 {
     foreach (var item in list)
     {
         var sub = new DailyAttendanceData();
         sub.ConvertToData(item);
         item.PlanMMSS_Start   = sub.PlanMMSS_Start;
         item.PlanMMSS_END     = sub.PlanMMSS_END;
         item.ResultMMSS_Start = sub.ResultMMSS_Start;
         item.ResultMMSS_END   = sub.ResultMMSS_END;
     }
     return(list);
 }
Exemplo n.º 5
0
        public ErrorInfo GetInitMonthlyData(MasterGetudo getudorecord, out List <DailyAttendanceData> monthlyattendancelist)
        {
            monthlyattendancelist = new List <DailyAttendanceData>();
            var errorinfo = new ErrorInfo();

            if (getudorecord.GetudoYYYYMM == 0)
            {
                errorinfo.HasError    = true;
                errorinfo.ErrorReason = "月度の値が不正です。";
                return(errorinfo);
            }

            //祝日マスタの読み込み
            var holidaylist = new List <MasterHoliday>();
            var holidays    = new Holidays();

            holidays.ExcelPath = ExcelPath_Holidays;
            errorinfo          = holidays.GetHolidaysByGetudoRecord(getudorecord, out holidaylist);
            if (errorinfo.HasError)
            {
                return(errorinfo);
            }

            for (DateTime date = getudorecord.StartDate; date <= getudorecord.EndDate; date = date.AddDays(1))
            {
                var attendancerecord = new DailyAttendanceData();
                attendancerecord.GetudoYYYYMM = getudorecord.GetudoYYYYMM;
                attendancerecord.Day          = date;

                var holiday = holidaylist.Find(x => x.Day == date);
                if (holiday != null)
                {
                    attendancerecord.DayKBN = EnumManager.DayKBN.HolyDay;
                    attendancerecord.Bikou  = holiday.HolidayName;
                }
                else
                {
                    attendancerecord.DayKBN = this.GetDayKBN(date);
                }
                monthlyattendancelist.Add(attendancerecord);
            }
            return(errorinfo);
        }
Exemplo n.º 6
0
        private ErrorInfo SaveExcelSheet(int getudoyyyymm, List <DailyAttendanceData> item, IWorkbook workbook_old, out IWorkbook workbook)
        {
            workbook = workbook_old;
            var errorinfo = new ErrorInfo();

            try
            {
                var sheet    = workbook.CreateSheet(getudoyyyymm.ToString());
                int rowcount = item.Count;
                this.GetHeaderAttendanceData(sheet);
                for (int i = 0; i < rowcount; i++)
                {
                    var   record            = new DailyAttendanceData();
                    IRow  row               = sheet.CreateRow(i + 1);
                    ICell cell_GetudoYYYYMM = row.CreateCell(0);
                    cell_GetudoYYYYMM.SetCellValue(item[i].GetudoYYYYMM);
                    ICell cell_Day = row.CreateCell(1);
                    cell_Day.SetCellValue(item[i].Day);
                    ICell cell_DayKBN = row.CreateCell(2);
                    cell_DayKBN.SetCellValue((int)item[i].DayKBN);
                    ICell cell_PlanMMSS_Start = row.CreateCell(3);
                    cell_PlanMMSS_Start.SetCellValue(item[i].PlanMMSS_Start.ToString());
                    ICell cell_PlanMMSS_END = row.CreateCell(4);
                    cell_PlanMMSS_END.SetCellValue(item[i].PlanMMSS_END.ToString());
                    ICell cell_ResultMMSS_Start = row.CreateCell(5);
                    cell_ResultMMSS_Start.SetCellValue(item[i].ResultMMSS_Start.ToString());
                    ICell cell_ResultMMSS_END = row.CreateCell(6);
                    cell_ResultMMSS_END.SetCellValue(item[i].ResultMMSS_END.ToString());
                    ICell cell_Bikou = row.CreateCell(7);
                    cell_Bikou.SetCellValue(item[i].Bikou);
                }
            }
            catch (Exception ex)
            {
                errorinfo.HasError    = true;
                errorinfo.ErrorReason = ex.Message;
            }

            return(errorinfo);
        }