/// <summary> /// 將報表 XML 轉成報表用 List /// </summary> /// <param name="source"></param> /// <returns></returns> public List <GovernmentalDocument.Reports.List.rpt_UpdateRecord> ConvertRptUpdateRecord(XmlElement source) { List <GovernmentalDocument.Reports.List.rpt_UpdateRecord> retVal = new List <GovernmentalDocument.Reports.List.rpt_UpdateRecord>(); foreach (XmlElement Record in source.SelectNodes("清單/異動紀錄")) { GovernmentalDocument.Reports.List.rpt_UpdateRecord val = new GovernmentalDocument.Reports.List.rpt_UpdateRecord(); //班別 val.ClassType = Record.GetAttribute("班別"); //科別代碼 val.DeptCode = (Record.ParentNode as XmlElement).GetAttribute("科別代號"); //學號 val.StudentNumber = Record.GetAttribute("學號"); // StudentID val.StudentID = Record.GetAttribute("學生編號"); //姓名 val.Name = Record.GetAttribute("姓名"); //身分證字號 val.IDNumber = Record.GetAttribute("身分證號"); //註1 val.Comment1 = Record.GetAttribute("註1"); //性別代碼 val.GenderCode = Record.GetAttribute("性別代號"); //出生日期 val.Birthday = GetBirthdateWithoutSlash(Record.GetAttribute("出生年月日")); //特殊身份代碼 val.SpecialStatusCode = Record.GetAttribute("特殊身份代碼"); //原為抓取備註欄位 //年級 val.GradeYear = (Record.ParentNode as XmlElement).GetAttribute("年級"); //異動原因代碼 val.UpdateCode = Record.GetAttribute("異動代號"); //異動日期 val.UpdateDate = GetBirthdateWithoutSlash(Record.GetAttribute("異動日期")); // 原科別代碼 if (Record.GetAttribute("原就讀科別").Trim() == "") { val.PreviousDeptCode = Record.GetAttribute("轉入前學生資料_科別"); } else { val.PreviousDeptCode = Record.GetAttribute("原就讀科別"); } // 原學校代碼 if (Record.GetAttribute("原就讀學校").Trim() == "") { val.PreviousSchoolCode = Record.GetAttribute("轉入前學生資料_學校"); } else { val.PreviousSchoolCode = Record.GetAttribute("原就讀學校"); } // 原學號 if (Record.GetAttribute("原就讀學號").Trim() == "") { val.PreviousStudentNumber = Record.GetAttribute("轉入前學生資料_學號"); } else { val.PreviousStudentNumber = Record.GetAttribute("原就讀學號"); } // 原年級 if (Record.GetAttribute("原就讀年級").Trim() == "") { val.PreviousGradeYear = Record.GetAttribute("轉入前學生資料_年級"); } else { val.PreviousGradeYear = Record.GetAttribute("原就讀年級"); } // 原學期 if (Record.GetAttribute("原就讀學期").Trim() == "") { val.PreviousSemester = Record.GetAttribute("轉入前學生資料_學期"); } else { val.PreviousSemester = Record.GetAttribute("原就讀學期"); } //原備查日期 if (Record.GetAttribute("原就讀備查日期").Trim() == "") { val.PreviousSchoolLastADDate = GetBirthdateWithoutSlash(Record.GetAttribute("轉入前學生資料_備查日期")); } else { val.PreviousSchoolLastADDate = GetBirthdateWithoutSlash(Record.GetAttribute("原就讀備查日期")); } //原備查文字 if (Record.GetAttribute("原就讀備查文號").Trim() == "") { val.PreviousSchoolLastADDoc = GetNumAndSrt1(Record.GetAttribute("轉入前學生資料_備查文號")); } else { val.PreviousSchoolLastADDoc = GetNumAndSrt1(Record.GetAttribute("原就讀備查文號")); } //原備查文號 if (Record.GetAttribute("原就讀備查文號").Trim() == "") { val.PreviousSchoolLastADNum = GetNumAndSrt2(Record.GetAttribute("轉入前學生資料_備查文號")); } else { val.PreviousSchoolLastADNum = GetNumAndSrt2(Record.GetAttribute("原就讀備查文號")); } //更正後資料 val.NewData = Record.GetAttribute("新資料"); // 新學號 val.NewStudNumber = Record.GetAttribute("新學號"); //備註說明 val.Comment = Record.GetAttribute("備註"); // 異動編號 if (Record.GetAttribute("編號") != "") { val.URID = Record.GetAttribute("編號"); } else { val.URID = Record.GetAttribute("異動編號"); } // 備查日期 val.LastADDate = GetBirthdateWithoutSlash(Record.GetAttribute("備查日期")); // 備查文字 val.LastADDoc = GetNumAndSrt1(Record.GetAttribute("備查文號")); // 備查文號 val.LastADNum = GetNumAndSrt2(Record.GetAttribute("備查文號")); // 畢業證書字號 val.GraduateCertificateNumber = Record.GetAttribute("畢業證書字號"); // 更正後身分證註記 val.Comment2 = Record.GetAttribute("更正後身分證註記"); // 轉入身分別代碼 val.TransferStatus = Record.GetAttribute("轉入身分別代碼"); // 應畢業學年度 val.ExpectGraduateSchoolYear = Record.GetAttribute("應畢業學年度"); retVal.Add(val); // 借讀學校代碼 val.Code7SchoolCode = Record.GetAttribute("借讀學校代碼"); // 借讀科別代碼 val.Code7DeptCode = Record.GetAttribute("借讀科別代碼"); // 申請開始日期 val.Code71BeginDate = Record.GetAttribute("申請開始日期"); // 申請結束日期 val.Code71EndDate = Record.GetAttribute("申請結束日期"); // 實際開始日期 val.Code72BeginDate = Record.GetAttribute("實際開始日期"); // 實際結束日期 val.Code72EndDate = Record.GetAttribute("實際結束日期"); } // 解析科別代碼用 Dictionary <string, string> deptCodeDict = new Dictionary <string, string>(); foreach (SHDepartmentRecord rec in SHDepartment.SelectAll()) { if (!deptCodeDict.ContainsKey(rec.FullName)) { deptCodeDict.Add(rec.FullName, rec.Code); } } // 排序填入 int uidint; retVal = (from data in retVal orderby data.Name, data.UpdateDate, int.TryParse(data.URID, out uidint) select data).ToList(); int order = 0; string tmpStr = ""; foreach (GovernmentalDocument.Reports.List.rpt_UpdateRecord rec in retVal) { if (rec.Name != tmpStr) { order = 1; rec.Order = order.ToString(); } else { rec.Order = order.ToString(); } order++; tmpStr = rec.Name; // 教育部 99年學校代碼長度定義6碼,直接切 if (rec.PreviousSchoolCode.Length >= 6) { rec.PreviousSchoolCode = rec.PreviousSchoolCode.Substring(0, 6); } // 解析科別代碼 if (deptCodeDict.ContainsKey(rec.PreviousDeptCode)) { rec.PreviousDeptCode = deptCodeDict[rec.PreviousDeptCode]; } } return(retVal); }
/// <summary> /// 將報表 XML 轉成報表用 List /// </summary> /// <param name="source"></param> /// <returns></returns> public List<GovernmentalDocument.Reports.List.rpt_UpdateRecord> ConvertRptUpdateRecord(XmlElement source) { List<GovernmentalDocument.Reports.List.rpt_UpdateRecord> retVal = new List<GovernmentalDocument.Reports.List.rpt_UpdateRecord>(); foreach (XmlElement Record in source.SelectNodes("清單/異動紀錄")) { GovernmentalDocument.Reports.List.rpt_UpdateRecord val = new GovernmentalDocument.Reports.List.rpt_UpdateRecord(); //班別 val.ClassType=Record.GetAttribute("班別"); //科別代碼 val.DeptCode=(Record.ParentNode as XmlElement).GetAttribute("科別代號"); //學號 val.StudentNumber=Record.GetAttribute("學號"); // StudentID val.StudentID = Record.GetAttribute("學生編號"); //姓名 val.Name=Record.GetAttribute("姓名"); //身分證字號 val.IDNumber=Record.GetAttribute("身分證號"); //註1 val.Comment1= Record.GetAttribute("註1"); //性別代碼 val.GenderCode=Record.GetAttribute("性別代號"); //出生日期 val.Birthday = GetBirthdateWithoutSlash(Record.GetAttribute("出生年月日")); //特殊身份代碼 val.SpecialStatusCode= Record.GetAttribute("特殊身份代碼"); //原為抓取備註欄位 //年級 val.GradeYear=(Record.ParentNode as XmlElement).GetAttribute("年級"); //異動原因代碼 val.UpdateCode=Record.GetAttribute("異動代號"); //異動日期 val.UpdateDate = GetBirthdateWithoutSlash(Record.GetAttribute("異動日期")); // 原科別代碼 if(Record.GetAttribute("原就讀科別").Trim()=="") val.PreviousDeptCode = Record.GetAttribute("轉入前學生資料_科別"); else val.PreviousDeptCode = Record.GetAttribute("原就讀科別"); // 原學校代碼 if(Record.GetAttribute("原就讀學校").Trim()=="") val.PreviousSchoolCode = Record.GetAttribute("轉入前學生資料_學校"); else val.PreviousSchoolCode = Record.GetAttribute("原就讀學校"); // 原學號 if (Record.GetAttribute("原就讀學號").Trim() == "") val.PreviousStudentNumber = Record.GetAttribute("轉入前學生資料_學號"); else val.PreviousStudentNumber = Record.GetAttribute("原就讀學號"); // 原年級 if (Record.GetAttribute("原就讀年級").Trim() == "") val.PreviousGradeYear = Record.GetAttribute("轉入前學生資料_年級"); else val.PreviousGradeYear = Record.GetAttribute("原就讀年級"); // 原學期 if (Record.GetAttribute("原就讀學期").Trim() == "") val.PreviousSemester = Record.GetAttribute("轉入前學生資料_學期"); else val.PreviousSemester = Record.GetAttribute("原就讀學期"); //原備查日期 if(Record.GetAttribute("原就讀備查日期").Trim()=="") val.PreviousSchoolLastADDate = GetBirthdateWithoutSlash(Record.GetAttribute("轉入前學生資料_備查日期")); else val.PreviousSchoolLastADDate = GetBirthdateWithoutSlash(Record.GetAttribute("原就讀備查日期")); //原備查文字 if (Record.GetAttribute("原就讀備查文號").Trim() == "") val.PreviousSchoolLastADDoc = GetNumAndSrt1(Record.GetAttribute("轉入前學生資料_備查文號")); else val.PreviousSchoolLastADDoc= GetNumAndSrt1(Record.GetAttribute("原就讀備查文號")); //原備查文號 if (Record.GetAttribute("原就讀備查文號").Trim() == "") val.PreviousSchoolLastADNum = GetNumAndSrt2(Record.GetAttribute("轉入前學生資料_備查文號")); else val.PreviousSchoolLastADNum=GetNumAndSrt2(Record.GetAttribute("原就讀備查文號")); //更正後資料 val.NewData = Record.GetAttribute("新資料"); // 新學號 val.NewStudNumber = Record.GetAttribute("新學號"); //備註說明 val.Comment= Record.GetAttribute("備註"); // 異動編號 if(Record.GetAttribute("編號")!="") val.URID = Record.GetAttribute("編號"); else val.URID = Record.GetAttribute("異動編號"); // 備查日期 val.LastADDate = GetBirthdateWithoutSlash(Record.GetAttribute("備查日期")); // 備查文字 val.LastADDoc = GetNumAndSrt1(Record.GetAttribute("備查文號")); // 備查文號 val.LastADNum = GetNumAndSrt2(Record.GetAttribute("備查文號")); // 畢業證書字號 val.GraduateCertificateNumber = Record.GetAttribute("畢業證書字號"); // 更正後身分證註記 val.Comment2 = Record.GetAttribute("更正後身分證註記"); // 轉入身分別代碼 val.TransferStatus = Record.GetAttribute("轉入身分別代碼"); // 應畢業學年度 val.ExpectGraduateSchoolYear = Record.GetAttribute("應畢業學年度"); retVal.Add(val); } // 解析科別代碼用 Dictionary<string, string> deptCodeDict = new Dictionary<string, string>(); foreach (SHDepartmentRecord rec in SHDepartment.SelectAll()) if (!deptCodeDict.ContainsKey(rec.FullName)) deptCodeDict.Add(rec.FullName, rec.Code); // 排序填入 int uidint; retVal = (from data in retVal orderby data.Name,data.UpdateDate, int.TryParse(data.URID,out uidint) select data).ToList(); int order = 0; string tmpStr = ""; foreach (GovernmentalDocument.Reports.List.rpt_UpdateRecord rec in retVal) { if(rec.Name != tmpStr) { order =1; rec.Order=order.ToString(); } else rec.Order =order.ToString (); order ++; tmpStr =rec.Name; // 教育部 99年學校代碼長度定義6碼,直接切 if (rec.PreviousSchoolCode.Length >= 6) rec.PreviousSchoolCode = rec.PreviousSchoolCode.Substring(0, 6); // 解析科別代碼 if (deptCodeDict.ContainsKey(rec.PreviousDeptCode)) rec.PreviousDeptCode = deptCodeDict[rec.PreviousDeptCode]; } return retVal; }