private void TrViewSeasonal_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                var    selectNode    = e.Node;
                string selectKeyNode = selectNode.Name;
                var    listInOut     = inoutDatasAfterConvert.Where(d => d.Dept == selectKeyNode).ToList();
                var    listEmp       = listInOut.Select(d => d.EmpCode).Distinct().ToList();
                List <InOutDataMonth> listInoutMonth = new List <InOutDataMonth>();
                keyValuePairs = new Dictionary <string, MonthInOut>();
                for (int i = 0; i < listEmp.Count; i++)
                {
                    var listInoutByemp = listInOut.Where(d => d.EmpCode == listEmp[i]).ToList();
                    GetMonthInoutSeasonalEmp getInoutDataFrom = new GetMonthInoutSeasonalEmp();

                    Model.MonthInOut monthInOut = getInoutDataFrom.GetMonthInOutFromInoutdata(listInoutByemp);

                    var name = listInOut.Where(d => d.EmpCode == listEmp[i]).Select(d => d.Name).Distinct().ToList();
                    monthInOut.EmpCode = listEmp[i];
                    monthInOut.Name    = name[0];
                    monthInOut.dept    = selectKeyNode;
                    keyValuePairs.Add(listEmp[i], monthInOut);
                    InOutDataMonth inOutData = ConvertInOutDataMonthFromMonthInout(listEmp[i], name[0], monthInOut);


                    listInoutMonth.Add(inOutData);
                }

                dtgv_WorkingTime.DataSource = listInoutMonth;
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "TrViewSeasonal_AfterSelect(object sender, TreeViewEventArgs e)", ex.Message);
            }
        }
        private InOutDataMonth ConvertInOutDataMonthFromMonthInout(string empCode, string name, Model.MonthInOut monthInOut)
        {
            InOutDataMonth inOutData = new InOutDataMonth();

            try
            {
                inOutData.EmpFinger = empCode;
                inOutData.Dept      = name;

                for (int k = 0; k < 31; k++)
                {
                    if (monthInOut.InData[k] != null)
                    {
                        if (k == 0)
                        {
                            inOutData.Day1  = monthInOut.InData[k] + Environment.NewLine;
                            inOutData.Day1 += monthInOut.OutData[k] + Environment.NewLine;
                            inOutData.Day1 += monthInOut.WorkingTime[k] + Environment.NewLine;
                        }
                        else if (k == 1)
                        {
                            inOutData.Day2 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 2)
                        {
                            inOutData.Day3 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 3)
                        {
                            inOutData.Day4 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 4)
                        {
                            inOutData.Day5 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 5)
                        {
                            inOutData.Day6 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 6)
                        {
                            inOutData.Day7 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 7)
                        {
                            inOutData.Day8 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 8)
                        {
                            inOutData.Day9 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 9)
                        {
                            inOutData.Day10 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 10)
                        {
                            inOutData.Day11 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 11)
                        {
                            inOutData.Day12 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 12)
                        {
                            inOutData.Day13 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 13)
                        {
                            inOutData.Day14 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 14)
                        {
                            inOutData.Day15 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 15)
                        {
                            inOutData.Day16 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 16)
                        {
                            inOutData.Day17 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 17)
                        {
                            inOutData.Day18 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 18)
                        {
                            inOutData.Day19 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 19)
                        {
                            inOutData.Day20 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 20)
                        {
                            inOutData.Day21 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 21)
                        {
                            inOutData.Day22 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 22)
                        {
                            inOutData.Day23 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 23)
                        {
                            inOutData.Day24 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 24)
                        {
                            inOutData.Day25 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 25)
                        {
                            inOutData.Day26 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 26)
                        {
                            inOutData.Day27 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 27)
                        {
                            inOutData.Day28 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 28)
                        {
                            inOutData.Day29 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 29)
                        {
                            inOutData.Day30 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                        else if (k == 30)
                        {
                            inOutData.Day31 = monthInOut.InData[k] + Environment.NewLine + monthInOut.OutData[k] + Environment.NewLine + monthInOut.WorkingTime[k] + Environment.NewLine + monthInOut.Shift[k];
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "ConvertInOutDataMonthFromMonthInout(string empCode,string name, Model.MonthInOut monthInOut)", ex.Message);
            }
            return(inOutData);
        }