コード例 #1
0
ファイル: TimeOfWork.cs プロジェクト: luuvu97/dotnet
 public void setData(String str)
 {
     String[] arr = str.Split(",");
     this.begin  = TimeOfWork.parseDateString(arr[0]);
     this.end    = TimeOfWork.parseDateString(arr[0]);
     this.begin += TimeOfWork.parseTimeString(arr[1]);
     this.end   += TimeOfWork.parseTimeString(arr[2]);
 }
コード例 #2
0
        public static void read()
        {
            StreamReader file = new StreamReader(fileURL);

            String[] arr = File.ReadAllLines(fileURL);
            int      i   = 0;

            while (i < arr.Length)
            {
                Employee e = new Employee();
                e.ID          = e.parseID(arr[i++]);
                e.lastName    = arr[i++].ToUpper();
                e.firstName   = arr[i++].ToUpper();
                e.department  = arr[i++].ToUpper();
                e.position    = e.parsePosition(arr[i++].ToUpper());
                e.birthday    = TimeOfWork.parseDateString(arr[i++].ToUpper());
                e.nativeLand  = arr[i++].ToUpper();
                e.address     = arr[i++].ToUpper();
                e.email       = arr[i++].ToUpper();
                e.tel         = arr[i++].ToUpper();
                e.startWorkOn = TimeOfWork.parseDateString(arr[i++].ToUpper());

                //Insert work time list
                TimeOfWork tow = new TimeOfWork();
                while (arr[i].StartsWith("NV") == false)
                {
                    tow = new TimeOfWork();
                    tow.setData(arr[i++].ToUpper());
                    e.workTime.Add(tow);
                    if (i == arr.Length)
                    {
                        break;
                    }
                }
                Employee.listEmployee.Add(e);
            }
            Console.WriteLine("End");
        }