private void ExportTeacher_Load(object sender, EventArgs e) { XmlElement element = SmartSchool.Feature.Teacher.TeacherBulkProcess.GetExportDescription(); BaseFieldFormater formater = new BaseFieldFormater(); FieldCollection collection = formater.Format(element); List <string> list = new List <string>(new string[] { "教師系統編號", "教師姓名", "暱稱" }); //需遮蔽的欄位 List <string> avoids = new List <string>(new string[] { "帳號類型" }); foreach (Field field in collection) { //遮蔽欄位 if (avoids.Contains(field.DisplayText)) { continue; } ListViewItem item = listView.Items.Add(field.DisplayText); if (list.Contains(field.DisplayText)) { item.ForeColor = Color.Red; } item.Tag = field; item.Checked = true; } }
private void ExportWizard_Load(object sender, EventArgs e) { XmlElement element = StudentBulkProcess.GetExportDescription(); BaseFieldFormater formater = new BaseFieldFormater(); FieldCollection collection = formater.Format(element); //// 加入可以匯出學生狀態 //Field fld1 = new Field(); //fld1.DisplayText = "狀態"; //fld1.FieldName = "StudentStatus"; //collection.Add(fld1); List <string> list = new List <string>(new string[] { "學生系統編號", "姓名", "學號", "身分證號", "狀態" }); //需遮蔽的欄位 List <string> avoids = new List <string>(new string[] { "帳號類型" }); foreach (Field field in collection) { //遮蔽欄位 if (avoids.Contains(field.DisplayText)) { continue; } ListViewItem item = listView.Items.Add(field.DisplayText); if (list.Contains(field.DisplayText)) { item.ForeColor = Color.Red; } item.Tag = field; item.Checked = true; } }
public ExportTable Export() { // 取得匯出規則描述 XmlElement descElement = TeacherBulkProcess.GetExportDescription(); IFieldFormater fieldFormater = new BaseFieldFormater(); IResponseFormater responseFormater = new ResponseFormater(); FieldCollection fieldCollection = fieldFormater.Format(descElement); ExportFieldCollection exportFields = responseFormater.Format(descElement); fieldCollection = FieldUtil.Match(fieldCollection, _selectFields); exportFields = FieldUtil.Match(exportFields, _selectFields); IRequestGenerator reqGenerator = new ExportStudentRequestGenerator(); reqGenerator.SetSelectedFields(_selectFields); ICondition condition = new BaseCondition("ID", "-1"); reqGenerator.AddCondition(condition); foreach (string id in _conditions) { ICondition condition2 = new BaseCondition("ID", id); reqGenerator.AddCondition(condition2); } DSRequest request = reqGenerator.Generate(); DSResponse response = TeacherBulkProcess.GetExportList(request); ExportTable table = new ExportTable(); foreach (ExportField field in exportFields) { table.AddColumn(field); } foreach (XmlElement record in response.GetContent().GetElements("Teacher")) { ExportRow row = table.AddRow(); foreach (ExportField column in table.Columns) { int columnIndex = column.ColumnIndex; ExportCell cell = row.Cells[columnIndex]; XmlNode cellNode = record.SelectSingleNode(column.XPath); if (cellNode != null) { cell.Value = cellNode.InnerText; } } } return(table); }
private void ExportForm_Load(object sender, EventArgs e) { XmlElement element = SmartSchool.Feature.Course.CourseBulkProcess.GetExportDescription(); BaseFieldFormater formater = new BaseFieldFormater(); FieldCollection collection = formater.Format(element); List <string> list = new List <string>(new string[] { "課程系統編號", "課程名稱", "學年度", "學期" }); foreach (Field field in collection) { ListViewItem item = listView.Items.Add(field.DisplayText); if (list.Contains(field.DisplayText)) { item.ForeColor = Color.Red; } item.Tag = field; item.Checked = true; } }
private void ExportClass_Load(object sender, EventArgs e) { XmlElement element = SmartSchool.Feature.Class.ClassBulkProcess.GetExportDescription(); #region XML內容 /* <FieldDescription> * <Field DisplayText="班級系統編號" Name="ID" ReadOnly="True" /> * <Field DisplayText="班級名稱" Name="ClassName" ShiftCheckable="True" /> * <Field DisplayText="班導師" Name="TeacherName" ShiftCheckable="True" /> * <Field DisplayText="年級" Name="GradeYear" ShiftCheckable="True" /> * <Field DisplayText="科別" Name="DepartmentName" ShiftCheckable="True" /> * <Field DisplayText="課程規劃" Name="GraduationPlan" ShiftCheckable="True" /> * <Field DisplayText="計算規則" Name="CalculationRule" ShiftCheckable="True" /> * <Field DisplayText="排列序號" Name="DisplayOrder" ShiftCheckable="True" /> * <Field DisplayText="班級名稱規則" Name="NamingRule" ShiftCheckable="True" /> * </FieldDescription> */ #endregion BaseFieldFormater formater = new BaseFieldFormater(); //將資料格式化,並組成集合 FieldCollection collection = formater.Format(element); List <string> list = new List <string>(new string[] { "班級系統編號", "班級名稱" }); //將集合內容,逐一填入使用者勾選清單中(Tag放置一份field),預設為(true) foreach (Field field in collection) { ListViewItem item = listView.Items.Add(field.DisplayText); if (list.Contains(field.DisplayText)) { item.ForeColor = Color.Red; } item.Tag = field; item.Checked = true; } }
private void ExportClass_Load(object sender, EventArgs e) { //XmlElement element = SmartSchool.Feature.Class.ClassBulkProcess.GetExportDescription(); XmlDocument doc = new XmlDocument(); doc.LoadXml(Properties.Resources.JH_C_ExportDescription); XmlElement element = doc.DocumentElement; #region XML內容 /* <FieldDescription> * <Field DisplayText="班級系統編號" Name="ID" ReadOnly="True" /> * <Field DisplayText="班級名稱" Name="ClassName" ShiftCheckable="True" /> * <Field DisplayText="班導師" Name="TeacherName" ShiftCheckable="True" /> * <Field DisplayText="年級" Name="GradeYear" ShiftCheckable="True" /> * <Field DisplayText="科別" Name="DepartmentName" ShiftCheckable="True" /> * <Field DisplayText="課程規劃" Name="GraduationPlan" ShiftCheckable="True" /> * <Field DisplayText="計算規則" Name="CalculationRule" ShiftCheckable="True" /> * <Field DisplayText="排列序號" Name="DisplayOrder" ShiftCheckable="True" /> * <Field DisplayText="班級名稱規則" Name="NamingRule" ShiftCheckable="True" /> * </FieldDescription> */ #endregion BaseFieldFormater formater = new BaseFieldFormater(); //將資料格式化,並組成集合 FieldCollection collection = formater.Format(element); // 2018/12/21 穎驊 因應高雄項目 [10-03][??] 局端夠查詢學校班級有調整”導師”的功能 // 讓匯出的說明,班導師也納入 必填欄位 // 但蠻無言的, 原來的必填欄位居然只是這樣填寫List... // 有載入高雄自動編班模組的 , 其匯入規則 載Local 的設定(班導師必填) // 其餘的學校 依然為舊做法,自Service 載匯入規則資料 List <string> list; IClassBaseInfoItemAPI ClassBaseInfoItem = FISCA.InteractionService.DiscoverAPI <IClassBaseInfoItemAPI>(); if (ClassBaseInfoItem != null) { list = new List <string>(new string[] { "班級系統編號", "班級名稱", "班導師" }); } else { list = new List <string>(new string[] { "班級系統編號", "班級名稱" }); } //將集合內容,逐一填入使用者勾選清單中(Tag放置一份field),預設為(true) foreach (Field field in collection) { ListViewItem item = listView.Items.Add(field.DisplayText); if (list.Contains(field.DisplayText)) { item.ForeColor = Color.Red; } item.Tag = field; item.Checked = true; } }
public ExportTable Export() { // 取得縣市對照表 XmlElement schoolLocationList = Config.GetSchoolLocationList().GetContent().BaseElement; // 取得匯出規則描述 XmlElement descElement = StudentBulkProcess.GetExportDescription(); IFieldFormater fieldFormater = new BaseFieldFormater(); IResponseFormater responseFormater = new ResponseFormater(); FieldCollection fieldCollection = fieldFormater.Format(descElement); ExportFieldCollection exportFields = responseFormater.Format(descElement); fieldCollection = FieldUtil.Match(fieldCollection, _selectFields); exportFields = FieldUtil.Match(exportFields, _selectFields); //// 有選狀態時加入 //if (_selectFields.FindByDisplayText("狀態") != null) //{ // fieldCollection.Add(_selectFields.FindByDisplayText("狀態")); // ExportField ex = new ExportField(); // ex.DisplayText = "狀態"; // ex.RequestName = "StudentStatus"; // ex.ColumnIndex = exportFields.Length; // ex.DataType = ""; // ex.XPath = ""; // exportFields.Add(ex); //} IRequestGenerator reqGenerator = new ExportStudentRequestGenerator(); _selectFieldsID = new FieldCollection(); foreach (Field fd in _selectFields) { _selectFieldsID.Add(fd); } if (_selectFieldsID.Find("StudentID") == null) { Field fd1 = new Field(); fd1.FieldName = "StudentID"; fd1.DisplayText = "學生系統編號"; _selectFieldsID.Add(fd1); } reqGenerator.SetSelectedFields(_selectFieldsID); // 預設找-1, 不然會傳回所有學生 ICondition condition = new BaseCondition("ID", "-1"); reqGenerator.AddCondition(condition); foreach (string id in _conditions) { ICondition condition2 = new BaseCondition("ID", id); reqGenerator.AddCondition(condition2); } reqGenerator.AddOrder(new Order("GradeYear")); reqGenerator.AddOrder(new Order("Department")); reqGenerator.AddOrder(new Order("RefClassID")); reqGenerator.AddOrder(new Order("SeatNo")); DSRequest request = reqGenerator.Generate(); DSResponse response = QueryStudent.GetExportList(request); ExportTable table = new ExportTable(); foreach (ExportField field in exportFields) { table.AddColumn(field); } //// 取得學生狀態 //Dictionary<string, string> StudStatusDic = new Dictionary<string, string>(); //foreach (JHSchool.Data.JHStudentRecord stud in JHSchool.Data.JHStudent.SelectByIDs(K12.Presentation.NLDPanels.Student.SelectedSource )) // StudStatusDic.Add(stud.ID, stud.Status.ToString()); foreach (XmlElement record in response.GetContent().GetElements("Student")) { ExportRow row = table.AddRow(); foreach (ExportField column in table.Columns) { int columnIndex = column.ColumnIndex; ExportCell cell = row.Cells[columnIndex]; XmlNode cellNode = record.SelectSingleNode(column.XPath); //if(column.DisplayText !="狀態") // cellNode = record.SelectSingleNode(column.XPath); // CustodianOtherInfo/CustodianOtherInfo[1]/EducationDegree[1] #region 這段程式是處理匯入/匯出程式不一致問題 if (column.XPath.StartsWith("CustodianOtherInfo/Custodian")) { if (cellNode == null) { string x = column.XPath.Replace("CustodianOtherInfo/Custodian", "CustodianOtherInfo/CustodianOtherInfo"); cellNode = record.SelectSingleNode(x); if (cellNode == null) { x = column.XPath.Replace("CustodianOtherInfo/CustodianOtherInfo", "CustodianOtherInfo/Custodian"); cellNode = record.SelectSingleNode(x); } } } if (column.XPath.StartsWith("FatherOtherInfo/Father")) { if (cellNode == null) { string x = column.XPath.Replace("FatherOtherInfo/Father", "FatherOtherInfo/FatherOtherInfo"); cellNode = record.SelectSingleNode(x); if (cellNode == null) { x = column.XPath.Replace("FatherOtherInfo/FatherOtherInfo", "FatherOtherInfo/Father"); cellNode = record.SelectSingleNode(x); } } } if (column.XPath.StartsWith("MotherOtherInfo/Mother")) { if (cellNode == null) { string x = column.XPath.Replace("MotherOtherInfo/Mother", "MotherOtherInfo/MotherOtherInfo"); cellNode = record.SelectSingleNode(x); if (cellNode == null) { x = column.XPath.Replace("MotherOtherInfo/MotherOtherInfo", "MotherOtherInfo/Mother"); cellNode = record.SelectSingleNode(x); } } } #endregion if (cellNode != null) { if (column.FieldName == "GraduateSchoolLocationCode") { cell.Value = GetCounty(schoolLocationList, cellNode.InnerText); } else if (column.FieldName == "DeptName") //處理科別繼承問題。 { //這個欄位的資料一定會被回傳,因為設定了 Mandatory 屬性。 XmlNode selfDept = record.SelectSingleNode("SelfDeptName"); if (string.IsNullOrEmpty(selfDept.InnerText)) { cell.Value = cellNode.InnerText; } else { cell.Value = selfDept.InnerText; } } else if (column.FieldName == "Status") { cell.Value = GetStudStatusStr(cellNode.InnerText); } else { cell.Value = cellNode.InnerText; } } //if (column.DisplayText == "狀態")//record.SelectSingleNode("StudentID")!=null ) //{ // // 學生狀態 // if (StudStatusDic.ContainsKey(record.SelectSingleNode("StudentID").InnerText)) // cell.Value = StudStatusDic[record.SelectSingleNode("StudentID").InnerText]; //} } } return(table); }