Esempio n. 1
0
 public void FixedOkIDsDep()
 {
     OKFile2Datas.Clear();
     OKFile2Datas.AddRange(File2Datas.Where((data) => OkIDs.Contains(data.ID)));
     foreach (var data in OKFile2Datas)
     {
         data.Dep  = File1Datas.First((item) => item.ID == data.ID).Dep;
         data.Name = File1Datas.First((item) => item.ID == data.ID).Name;
     }
 }
Esempio n. 2
0
        public void CheckIDsIsAllFound()
        {
            //問卷Data
            var WrittenIDs = File2Datas.Select((data) => data.ID);

            //已填的ID 與 人事Data id 比對
            OkIDs.Clear();
            OkIDs.AddRange(File1Datas.Where((data) => WrittenIDs.Contains(data.ID)).Select((data) => data.ID));

            //已填的ID但未從人事資料中找到
            ErrorIDs.Clear();
            ErrorIDs.AddRange(WrittenIDs.Except(OkIDs));

            //尚未填寫的IDs
            NotWriteIDs.Clear();
            NotWriteIDs.AddRange(File1Datas.Where((data) => !OkIDs.Contains(data.ID)).Select(data => data.ID));
        }
Esempio n. 3
0
        public void WriteUnDoIDs_SortByDep(string FolderPath, string FileName)
        {
            string fileName          = Path.Combine(FolderPath, FileName);
            var    file1UnDoID_Datas = File1Datas.Where((data) => !OkIDs.Contains(data.ID));

            file1UnDoID_Datas.ToList().Sort((a, b) => a.Dep.CompareTo(b.Dep));
            using (var file = new StreamWriter(File.OpenWrite(fileName), Encoding.UTF8))
            {
                file.WriteLine(File1Fields);
                foreach (var item in file1UnDoID_Datas)
                {
                    if (int.TryParse(item.ID, out int _id))
                    {
                        file.WriteLine(item.OrignalRowData);
                    }
                }
            }
        }