public static void SetExtend(string nameSpace, string field, IDictionary <string, string> list) { if (list.Count == 0) { return; } foreach (string var in new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }) { if (field.StartsWith(var)) { throw new Exception("欄位名稱開頭不可為數字"); } } DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("Request"); helper.SetAttribute(".", "Namespace", nameSpace); foreach (string id in list.Keys) { helper.AddElement("Student"); helper.SetAttribute("Student", "ID", id); if (string.IsNullOrEmpty(list[id])) { helper.AddElement("Student", field); } else { helper.AddElement("Student", field, list[id]); } } dsreq.SetContent(helper); DSAServices.CallService("SmartSchool.Student.SetExtend", dsreq); }
public static List <int> ListSeatNo(string classID) { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("ListSeatNoRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); helper.AddElement("Condition", "RefClassID", classID); dsreq.SetContent(helper); DSResponse rsp = DSAServices.CallService("SmartSchool.Class.ListSeatNo", dsreq); List <int> list = new List <int>(); foreach (XmlNode node in rsp.GetContent().GetElements("SeatNo")) { int no; if (int.TryParse(node.InnerText, out no)) { list.Add(no); } } return(list); }
public static DSResponse GetSCAttendBrief(params string[] courseid) { DSXmlHelper helper = new DSXmlHelper("SelectRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ID"); helper.AddElement("Field", "RefStudentID"); helper.AddElement("Field", "RefCourseID"); helper.AddElement("Field", "ClassName"); helper.AddElement("Field", "StudentNumber"); helper.AddElement("Field", "SeatNumber"); helper.AddElement("Field", "Name"); helper.AddElement("Field", "Score"); helper.AddElement("Field", "Extension"); helper.AddElement("Condition"); foreach (string var in courseid) { helper.AddElement("Condition", "CourseID", var); } helper.AddElement("Order"); helper.AddElement("Order", "ClassName", "ASC"); helper.AddElement("Order", "SeatNumber", "ASC"); DSRequest dsreq = new DSRequest(helper); DSResponse rsp = FISCA.Authentication.DSAServices.CallService("SmartSchool.Course.GetSCAttend", dsreq); return(rsp); }
public static DSResponse GetSchoolYearSubjectScoreBySchoolYear(int schoolyear, params string[] studentIDList) { DSXmlHelper helper = new DSXmlHelper("GetSchoolYearSubjectScore"); DSRequest dsreq = new DSRequest(); helper.AddElement("Field"); helper.AddElement("Field", "ID"); helper.AddElement("Field", "RefStudentId"); helper.AddElement("Field", "SchoolYear"); helper.AddElement("Field", "Semester"); helper.AddElement("Field", "GradeYear"); helper.AddElement("Field", "ScoreInfo"); helper.AddElement("Condition"); helper.AddElement("Condition", "SchoolYear", schoolyear.ToString()); if (studentIDList.Length > 0) { helper.AddElement("Condition", "StudentIDList"); foreach (string id in studentIDList) { helper.AddElement("Condition/StudentIDList", "ID", id); } } helper.AddElement("Order"); helper.AddElement("Order", "RefStudentId"); helper.AddElement("Order", "SchoolYear"); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Score.GetSchoolYearSubjectScore", dsreq); return(dsrsp); }
public static List <CourseRecord> GetAllCourses() { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetDetailListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ID"); helper.AddElement("Field", "CourseName"); helper.AddElement("Field", "SchoolYear"); helper.AddElement("Field", "Semester"); helper.AddElement("Field", "Period"); helper.AddElement("Field", "Credit"); //helper.AddElement("Field", "IsRequired"); //helper.AddElement("Field", "RequiredBy"); helper.AddElement("Field", "RefExamTemplateID"); helper.AddElement("Field", "RefClassID"); helper.AddElement("Field", "Subject"); helper.AddElement("Field", "Domain"); helper.AddElement("Field", "CourseNumber"); helper.AddElement("Field", "ScoreCalcFlag"); helper.AddElement("Condition"); helper.AddElement("Order"); helper.AddElement("Order", "ID"); helper.AddElement("Order", "Sequence"); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Course.GetDetailList", dsreq); List <CourseRecord> result = new List <CourseRecord>(); foreach (XmlElement var in dsrsp.GetContent().GetElements("Course")) { result.Add(new CourseRecord(var)); } return(result); }
protected override Dictionary <string, TagRecord> GetData(IEnumerable <string> primaryKeys) { bool execute_required = false; DSXmlHelper helper = new DSXmlHelper("Request"); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); foreach (string each in primaryKeys) { helper.AddElement("Condition", "ID", each); execute_required = true; } DSRequest dsreq = new DSRequest(helper); Dictionary <string, TagRecord> result = new Dictionary <string, TagRecord>(); if (execute_required) { string srvname = ServiceName; foreach (var item in DSAServices.CallService(srvname, dsreq).GetContent().GetElements("Tag")) { TagRecord tag = new TagRecord(item); result.Add(tag.ID, tag); } } return(result); }
public static DSResponse GetExtension(string nameSpace, string[] fields, string[] studentIDs) { if (studentIDs.Length == 0) { return(null); } DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("Request"); helper.SetAttribute(".", "Namespace", nameSpace); helper.AddElement("Field"); foreach (string field in fields) { helper.AddElement("Field", field); } if (fields.Length == 0) { helper.AddElement("Field", "All.Field"); } helper.AddElement("Condition"); foreach (string id in studentIDs) { helper.AddElement("Condition", "ID", id); } dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Student.GetExtend", dsreq); return(dsrsp); }
public static List <SCAttendRecord> GetAllSCAttendRecords() { var students = Student.Instance.Items; var courses = Course.Instance.Items; DSXmlHelper helper = new DSXmlHelper("SelectRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ID"); helper.AddElement("Field", "RefStudentID"); helper.AddElement("Field", "RefCourseID"); helper.AddElement("Field", "IsRequired"); helper.AddElement("Field", "RequiredBy"); helper.AddElement("Field", "Score"); helper.AddElement("Field", "Extension"); helper.AddElement("Condition"); helper.AddElement("Order"); DSRequest dsreq = new DSRequest(helper); List <SCAttendRecord> result = new List <SCAttendRecord>(); foreach (var item in FISCA.Authentication.DSAServices.CallService("SmartSchool.Course.GetSCAttend", dsreq).GetContent().GetElements("Student")) { helper = new DSXmlHelper(item); var studentid = helper.GetText("RefStudentID"); var courseid = helper.GetText("RefCourseID"); var score = helper.GetText("Score"); var effort = helper.GetText("Extension/Extension/Effort"); var text = helper.GetText("Extension/Extension/Text"); var id = item.GetAttribute("ID"); bool? required = null; string requiredby = null; switch (helper.GetText("IsRequired")) { case "必": required = true; break; case "選": required = false; break; default: required = null; break; } switch (helper.GetText("RequiredBy")) { case "部訂": case "校訂": requiredby = helper.GetText("RequiredBy"); break; default: requiredby = null; break; } //if ( students.ContainsKey(studentid) && courses.ContainsKey(courseid) ) result.Add(new SCAttendRecord(studentid, courseid, id, score, effort, text)); } return(result); }
public static List <StudentRecord> GetStudents(IEnumerable <string> primaryKeys) { bool hasKey = false; DSRequest dsreq = new DSRequest(); DSXmlHelper helper = CreateBriefFieldHelper(); helper.AddElement("Condition"); foreach (string var in primaryKeys) { helper.AddElement("Condition", "ID", var); hasKey = true; } helper.AddElement("Order"); dsreq.SetContent(helper); if (hasKey) { DSResponse dsrsp = DSAServices.CallService("SmartSchool.Student.GetAbstractListWithTag", dsreq); List <StudentRecord> result = new List <StudentRecord>(); foreach (XmlElement var in dsrsp.GetContent().GetElements("Student")) { result.Add(new StudentRecord(var)); System.Diagnostics.Trace.WriteLine("建立StudentRecord{0}", DateTime.Now.ToLongTimeString()); } return(result); } else { return(new List <StudentRecord>()); } }
public DSRequest GetRequest(string rootName, string dataElementName, string fieldElementName, string conditionElementName, string conditionName, string id) { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper(rootName); if (!string.IsNullOrEmpty(dataElementName)) { helper.AddElement(dataElementName); helper.AddElement(dataElementName, fieldElementName); helper.AddElement(dataElementName, conditionElementName); fieldElementName = dataElementName + "/" + fieldElementName; conditionElementName = dataElementName + "/" + conditionElementName; } else { helper.AddElement(fieldElementName); helper.AddElement(conditionElementName); } foreach (string key in _nowValues.Keys) { if (_nowValues[key] != _oldValues[key]) { helper.AddElement(fieldElementName, key, _nowValues[key]); } } helper.AddElement(conditionElementName, conditionName, id); dsreq.SetContent(helper); //Console.WriteLine(helper.GetRawXml()); return(dsreq); }
public static List<CourseRecord> GetAllCourses() { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetDetailListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ID"); helper.AddElement("Field", "CourseName"); helper.AddElement("Field", "SchoolYear"); helper.AddElement("Field", "Semester"); helper.AddElement("Field", "Period"); helper.AddElement("Field", "Credit"); //helper.AddElement("Field", "IsRequired"); //helper.AddElement("Field", "RequiredBy"); helper.AddElement("Field", "RefExamTemplateID"); helper.AddElement("Field", "RefClassID"); helper.AddElement("Field", "Subject"); helper.AddElement("Field", "Domain"); helper.AddElement("Field", "ScoreCalcFlag"); helper.AddElement("Condition"); helper.AddElement("Order"); helper.AddElement("Order", "ID"); helper.AddElement("Order", "Sequence"); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Course.GetDetailList", dsreq); List<CourseRecord> result = new List<CourseRecord>(); foreach (XmlElement var in dsrsp.GetContent().GetElements("Course")) { result.Add(new CourseRecord(var)); } return result; }
public static DSXmlHelper GetSemesterEntryScoreBySemester(bool includePlace, string schoolYear, string semester, EntryGroup group, params string[] studentIDList) { DSXmlHelper helper = new DSXmlHelper("GetSemesterEntryScore"); DSRequest dsreq = new DSRequest(); helper.AddElement("Field"); helper.AddElement("Field", "ID"); helper.AddElement("Field", "RefStudentId"); helper.AddElement("Field", "ScoreInfo"); if (includePlace) { helper.AddElement("Field", "ClassRating"); helper.AddElement("Field", "DeptRating"); helper.AddElement("Field", "YearRating"); } helper.AddElement("Condition"); if (studentIDList.Length > 0) { helper.AddElement("Condition", "StudentIDList"); foreach (string id in studentIDList) { helper.AddElement("Condition/StudentIDList", "ID", id); } } helper.AddElement("Condition", "SchoolYear", schoolYear); helper.AddElement("Condition", "Semester", semester); helper.AddElement("Condition", "EntryGroup", group.ToString()); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Score.GetSemesterEntryScore", dsreq); return(dsrsp.GetContent()); }
/// <summary> /// 直接用DSAUtil來呼叫Service /// </summary> /// <param name="service">服務名稱</param> /// <param name="req">申請文件</param> /// <returns></returns> private DSResponse CallTestingService(string service, DSRequest req) { FISCA.DSAClient.Connection vConnection = new FISCA.DSAClient.Connection(); vConnection.Connect(mAccessPoint,"" , mFullUserName , mPassword); if (vConnection.IsConnected) { try { Envelope vRequest = new Envelope(); vRequest.Body = new XmlStringHolder(req.GetContent().GetRawXml()); Envelope vResponse = vConnection.SendRequest(service,vRequest); DSResponse rsp = new DSResponse(); rsp.SetContent(vResponse.Body.XmlString); return rsp; } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { vConnection = null; } } else throw new Exception("無法與DSA連線"); return null; }
/// <summary> /// 取得節次類型 /// </summary> /// <returns>節次類型清單</returns> public static List <string> GetPeriodTypeItems() { string targetService = "SmartSchool.Config.GetList"; List <string> list = new List <string>(); DSXmlHelper helper = new DSXmlHelper("GetListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "Content", ""); helper.AddElement("Condition"); helper.AddElement("Condition", "Name", "節次對照表"); DSRequest req = new DSRequest(helper.BaseElement); DSResponse rsp = FISCA.Authentication.DSAServices.CallService(targetService, req); foreach (XmlElement element in rsp.GetContent().GetElements("List/Periods/Period")) { string type = element.GetAttribute("Type"); if (!list.Contains(type)) { list.Add(type); } } return(list); }
protected override Dictionary <string, List <T> > GetAllData() { DSXmlHelper helper = new DSXmlHelper("Request"); helper.AddElement("Field"); helper.AddElement("Field", "All"); DSRequest dsreq = new DSRequest(helper); Dictionary <string, List <T> > result = new Dictionary <string, List <T> >(); string srvname = ServiceName; foreach (var item in DSAServices.CallService(srvname, dsreq).GetContent().GetElements("Tag")) { T objT = new T(); objT.Initialize(item); if (!result.ContainsKey(objT.RefEntityID)) { result.Add(objT.RefEntityID, new List <T>()); } result[objT.RefEntityID].Add(objT); } return(result); }
/// <summary> /// 取得詳細資料列表 /// </summary> /// <param name="id">學生編號</param> /// <returns></returns> public static DSResponse GetDetailList(IEnumerable <string> fields, params string[] list) { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetStudentListRequest"); helper.AddElement("Field"); bool hasfield = false; foreach (string field in fields) { helper.AddElement("Field", field); hasfield = true; } if (!hasfield) { throw new Exception("必須傳入Field"); } helper.AddElement("Condition"); foreach (string id in list) { helper.AddElement("Condition", "ID", id); } dsreq.SetContent(helper); return(DSAServices.CallService("SmartSchool.Student.GetDetailList", dsreq)); }
public static List<StudentRecord> GetStudents(IEnumerable<string> primaryKeys) { bool hasKey = false ; DSRequest dsreq = new DSRequest(); DSXmlHelper helper = CreateBriefFieldHelper(); helper.AddElement("Condition"); foreach ( string var in primaryKeys ) { helper.AddElement("Condition", "ID", var); hasKey = true; } helper.AddElement("Order"); dsreq.SetContent(helper); if ( hasKey ) { DSResponse dsrsp = DSAServices.CallService("SmartSchool.Student.GetAbstractListWithTag", dsreq); List<StudentRecord> result = new List<StudentRecord>(); foreach ( XmlElement var in dsrsp.GetContent().GetElements("Student") ) { result.Add(new StudentRecord(var)); System.Diagnostics.Trace.WriteLine("建立StudentRecord{0}", DateTime.Now.ToLongTimeString()); } return result; } else { return new List<StudentRecord>(); } }
public static List <TeacherRecord> GetTeachers(IEnumerable <string> primaryKeys) { bool hasKey = false; DSRequest dsreq = new DSRequest(); DSXmlHelper helper = CreateBriefFieldHelper(); helper.AddElement("Condition"); foreach (var key in primaryKeys) { hasKey = true; helper.AddElement("Condition", "ID", key); } helper.AddElement("Order"); List <TeacherRecord> result = new List <TeacherRecord>(); if (hasKey) { dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Teacher.GetDetailList", dsreq); foreach (XmlElement var in dsrsp.GetContent().GetElements("Teacher")) { result.Add(new TeacherRecord(var)); } } return(result); }
public static DSResponse GetRelationship() { DSRequest request = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetRelationshipListRequest"); helper.AddElement("Fields"); helper.AddElement("Fields", "All"); request.SetContent(helper); return(DSAServices.CallService("SmartSchool.Config.GetRelationshipList", request)); }
public static DSResponse GetEduDegreeList() { DSRequest request = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetEducationDegreeListRequest"); helper.AddElement("Fields"); helper.AddElement("Fields", "All"); request.SetContent(helper); return(FISCA.Authentication.DSAServices.CallService("SmartSchool.Config.GetEducationDegreeList", request)); }
public static void ImportServicePackage() { XmlDocument doc = new XmlDocument(); doc.LoadXml(Resource1.Package); DSRequest req = new DSRequest(doc.DocumentElement); FISCA.Authentication.DSAServices.CallService("UDSManagerService.ImportPackage", req); }
/// <summary> /// 取得現有年級 /// </summary> /// <returns></returns> public static DSResponse GetGradeYearList() { DSXmlHelper helper = new DSXmlHelper("GetGradeYearRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ClassCount"); helper.AddElement("Field", "GradeYear"); //helper.AddElement("Field", "Status"); DSRequest dsreq = new DSRequest(helper); return DSAServices.CallService("SmartSchool.Class.GetGradeYearList", dsreq); }
public static DSResponse GetExamList() { DSXmlHelper helper = new DSXmlHelper("Request"); helper.AddElement("Field"); helper.AddElement("Field", "All"); DSRequest dsreq = new DSRequest(helper); DSResponse rsp = FISCA.Authentication.DSAServices.CallService("SmartSchool.Exam.GetAbstractList", dsreq); return(rsp); }
public static DSResponse GetClassList() { DSXmlHelper helper = new DSXmlHelper("GetGradeYearRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ClassID"); helper.AddElement("Field", "ClassName"); helper.AddElement("Order"); helper.AddElement("Order", "DisplayOrder"); helper.AddElement("Order", "ClassName"); DSRequest dsreq = new DSRequest(helper); return DSAServices.CallService("SmartSchool.Class.GetAbstractList", dsreq); }
/// <summary> /// 取得現有年級 /// </summary> /// <returns></returns> public static DSResponse GetGradeYearList() { DSXmlHelper helper = new DSXmlHelper("GetGradeYearRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ClassCount"); helper.AddElement("Field", "GradeYear"); //helper.AddElement("Field", "Status"); DSRequest dsreq = new DSRequest(helper); return(DSAServices.CallService("SmartSchool.Class.GetGradeYearList", dsreq)); }
public static DSResponse GetUpdateRecord(string updateid) { DSXmlHelper helper = new DSXmlHelper("GetUpdateInfoListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); helper.AddElement("Condition", "ID", updateid); DSRequest dsreq = new DSRequest(helper); return(DSAServices.CallService("SmartSchool.Student.UpdateRecord.GetDetailList", dsreq)); }
public static XmlNode GetClassInfo(string studentid) { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetClassRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); helper.AddElement("Condition", "ID", studentid); dsreq.SetContent(helper); return(DSAServices.CallService("SmartSchool.Student.GetClassInfo", dsreq).GetContent().BaseElement); }
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); }
// [QueryRequest()] public static void DeleteBatch(string id) { DSXmlHelper helper = new DSXmlHelper("DeleteUpdateRecordBatchRequest"); helper.AddElement("UpdateRecord"); helper.AddElement("UpdateRecord", "ID", id); DSRequest dsreq = new DSRequest(helper); FISCA.Authentication.DSAServices.CallService("SmartSchool.Student.UpdateRecord.DeleteBatch", dsreq); // 先註解 //CurrentUser.Instance.CallService("SmartSchool.Student.UpdateRecord.DeleteBatch", dsreq); }
public static void InsertSchoolYearEntryScore(params InsertInfo[] items) { string req = "<InsertRequest>"; foreach (InsertInfo info in items) { req += "<SchoolYearEntryScore><RefStudentId>" + info.RefStudentId + "</RefStudentId><SchoolYear>" + info.SchoolYear + "</SchoolYear><GradeYear>" + info.GradeYear + "</GradeYear><EntryGroup>" + info.EntryGroup + "</EntryGroup><ScoreInfo>" + info.ScoreInfo.OuterXml + "</ScoreInfo></SchoolYearEntryScore>"; } req += "</InsertRequest>"; DSRequest dsreq = new DSRequest(req); DSAServices.CallService("SmartSchool.Score.InsertSchoolYearEntryScore", dsreq); }
public static void UpdateGraduatePhoto(string picBase64String, string StudentID) { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("UpdateStudentList"); helper.AddElement("Student"); helper.AddElement("Student", "Field"); helper.AddElement("Student/Field", "GraduatePhoto"); helper.AddCDataSection("Student/Field/GraduatePhoto", picBase64String); helper.AddElement("Student", "Condition"); helper.AddElement("Student/Condition", "ID", StudentID); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService(UPDATE_SERVICENAME, dsreq); }
public static DSResponse GetClassList() { DSXmlHelper helper = new DSXmlHelper("GetGradeYearRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ClassID"); helper.AddElement("Field", "ClassName"); helper.AddElement("Order"); helper.AddElement("Order", "DisplayOrder"); helper.AddElement("Order", "ClassName"); DSRequest dsreq = new DSRequest(helper); return(DSAServices.CallService("SmartSchool.Class.GetAbstractList", dsreq)); }
public static void UpdateSchoolYearEntryScore(params UpdateInfo[] infos) { string req = "<UpdateRequest>"; foreach (UpdateInfo info in infos) { int tryParseInt; req += "<SchoolYearEntryScore><Field> " + (int.TryParse(info.GradeYear, out tryParseInt) ? ("<GradeYear>" + info.GradeYear + "</GradeYear> ") : "") + " <ScoreInfo>" + info.ScoreInfo.OuterXml + "</ScoreInfo></Field><Condition><ID>" + info.ID + "</ID></Condition></SchoolYearEntryScore>"; } req += "</UpdateRequest>"; DSRequest dsreq = new DSRequest(req); DSAServices.CallService("SmartSchool.Score.UpdateSchoolYearEntryScore", dsreq); }
public static void DeleteSchoolYearSubjectScore(params string[] idlist) { string req = "<DeleteRequest><SchoolYearSubjectScore>"; foreach (string id in idlist) { req += "<ID>" + id + "</ID>"; } req += "</SchoolYearSubjectScore></DeleteRequest>"; DSRequest dsreq = new DSRequest(req); //DSRequest dsreq = new DSRequest("<DeleteRequest><SchoolYearSubjectScore><ID>" + id + "</ID></SchoolYearSubjectScore></DeleteRequest>"); DSAServices.CallService("SmartSchool.Score.DeleteSchoolYearSubjectScore", dsreq); }
public static void ChangeStudentStatus(string newStatus, params string[] ids) { if ( ids.Length > 0 ) { string req = "<ChangeStatusRequest><Student><Field><Status>" + newStatus + "</Status></Field><Condition>"; foreach ( string id in ids ) { req += "<ID>" + id + "</ID>"; } req += "</Condition></Student></ChangeStatusRequest>"; DSRequest dsreq = new DSRequest(req); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Student.Update", dsreq); } }
public static DSResponse GetAddress(string RunningID) { DSXmlHelper helper = new DSXmlHelper("GetStudentListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "PermanentAddress"); helper.AddElement("Field", "MailingAddress"); helper.AddElement("Field", "OtherAddresses"); helper.AddElement("Condition"); helper.AddElement("Condition", "ID", RunningID); DSRequest dsreq = new DSRequest(helper); return(DSAServices.CallService("SmartSchool.Student.GetDetailList", dsreq)); }
/// <summary> /// 取得學生異動資料清單 /// </summary> /// <param name="RunningID"></param> /// <returns></returns> public static DSResponse GetUpdateInfoList(string RunningID) { DSXmlHelper helper = new DSXmlHelper("GetUpdateInfoListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); helper.AddElement("Condition", "RefStudentID", RunningID); helper.AddElement("Order"); helper.AddElement("Order", "UpdateDate", "desc"); DSRequest dsreq = new DSRequest(helper); return(DSAServices.CallService("SmartSchool.Student.UpdateRecord.GetDetailList", dsreq)); }
public static List<StudentRecord> GetAllStudents() { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = CreateBriefFieldHelper(); helper.AddElement("Condition"); helper.AddElement("Order"); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Student.GetAbstractListWithTag", dsreq); List<StudentRecord> result = new List<StudentRecord>(); foreach ( XmlElement var in dsrsp.GetContent().GetElements("Student") ) { result.Add(new StudentRecord(var)); } return result; }
public static List<TeacherRecord> GetAllTeachers() { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = CreateBriefFieldHelper(); helper.AddElement("Condition"); helper.AddElement("Order"); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Teacher.GetDetailList", dsreq); List<TeacherRecord> result = new List<TeacherRecord>(); foreach (XmlElement var in dsrsp.GetContent().GetElements("Teacher")) { result.Add(new TeacherRecord(var)); } return result; }
public static DSResponse GetAbsenceList() { string serviceName = "GetAbsenceList"; if (DataCacheManager.Get(serviceName) == null) { DSRequest request = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetAbsenceListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); request.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Others.GetAbsenceList", request); DataCacheManager.Add(serviceName, dsrsp); } return DataCacheManager.Get(serviceName); }
public static DSXmlHelper GetAbstractList(params string[] gradeYear) { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("Request"); helper.AddElement(".", "Field", "<ID/><Name/><RefClassID/><ClassName/><SeatNo/><RefDepartmentID/><DepartmentName/><GradeYear/>", true); helper.AddElement("Condition"); helper.AddElement("Condition", "Status", "�@��"); foreach (string each in gradeYear) helper.AddElement("Condition", "GradeYear", each); helper.AddElement(".", "Order", "<GradeYear/><RefClassID/><SeatNo/>", true); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Student.GetAbstractList", dsreq); return dsrsp.GetContent(); }
public static List<string> GetCountyList() { DSRequest request = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("Request"); helper.AddElement("Fields"); helper.AddElement("Fields", "All"); request.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Config.GetCountyTownList", request); List<string> countyList = new List<string>(); foreach (XmlNode node in dsrsp.GetContent().GetElements("Town")) { string county = node.Attributes["County"].Value; if (!countyList.Contains(county)) countyList.Add(county); } return countyList; }
public static DSResponse GetAbstractInfo(params string[] list) { //string req = "<GetStudentListRequest><Fields><ID/><StudentID/><Name/><EnglishName/><Gender/><Nationality/><SSN/><NationalityLocation/><EthnicGroup/><ClassID/><GradeYear/><ClassName/><SeatNo/><Status/></Fields><Condition>"; //foreach (string var in list) //{ // req += "<ID>" + var + "</ID>"; //} //req += "</Condition><Order><GradeYear/><ClassName/><SeatNo/></Order></GetStudentListRequest>"; DSXmlHelper helper = CreateBriefFieldHelper(); helper.AddElement("Condition"); foreach (string var in list) { helper.AddElement("Condition", "ID", var); } helper.AddElement("Order"); helper.AddElement("Order", "SeatNo"); DSRequest dsreq = new DSRequest(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Student.GetAbstractListWithTag", dsreq); return dsrsp; }
public static DSResponse GetAbstractList() { //DSRequest dsreq = new DSRequest( // "<GetStudentListRequest><Fields><ID/><StudentID/><Name/><EnglishName/><Gender/><Nationality/><SSN/><NationalityLocation/><EthnicGroup/><ClassID/><GradeYear/><ClassName/><SeatNo/><Status/></Fields>"+ // "<Condition><Status>�@��</Status><Status>���</Status><Status>����</Status><Status>�R��</Status></Condition>" + // "<Order><GradeYear/><ClassName/><SeatNo/></Order>"+ // "</GetStudentListRequest>"); DSRequest dsreq = new DSRequest(); DSXmlHelper helper = CreateBriefFieldHelper(); helper.AddElement("Condition"); //helper.AddElement("Condition", "Status", "�@��"); //helper.AddElement("Condition", "Status", "���"); //helper.AddElement("Condition", "Status", "����"); //helper.AddElement("Condition", "Status", "�R��"); helper.AddElement("Order"); helper.AddElement("Order", "SeatNo"); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Student.GetAbstractListWithTag", dsreq); //DSResponse dsrsp = CallService("SmartSchool.Student.GetAbstractListWithClassInfo", dsreq); return dsrsp; }
public static List<CourseRecord> GetCourses(IEnumerable<string> primaryKeys) { bool hasKey = false; DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetDetailListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ID"); helper.AddElement("Field", "CourseName"); helper.AddElement("Field", "SchoolYear"); helper.AddElement("Field", "Semester"); helper.AddElement("Field", "Period"); helper.AddElement("Field", "Credit"); //helper.AddElement("Field", "IsRequired"); //helper.AddElement("Field", "RequiredBy"); helper.AddElement("Field", "RefExamTemplateID"); helper.AddElement("Field", "RefClassID"); helper.AddElement("Field", "Subject"); helper.AddElement("Field", "Domain"); helper.AddElement("Field", "ScoreCalcFlag"); helper.AddElement("Condition"); foreach (var key in primaryKeys) { helper.AddElement("Condition", "ID", key); hasKey = true; } helper.AddElement("Order"); List<CourseRecord> result = new List<CourseRecord>(); if (hasKey) { dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Course.GetDetailList", dsreq); foreach (XmlElement var in dsrsp.GetContent().GetElements("Course")) { result.Add(new CourseRecord(var)); } } return result; }
public static void SetExtend(string nameSpace, string field, IDictionary<string, string> list) { if ( list.Count == 0 ) return; foreach ( string var in new string[]{"0","1","2","3","4","5","6","7","8","9"} ) { if ( field.StartsWith(var) ) throw new Exception("���W�ٶ}�Y���i���Ʀr"); } DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("Request"); helper.SetAttribute(".", "Namespace", nameSpace); foreach ( string id in list.Keys ) { helper.AddElement("Student"); helper.SetAttribute("Student", "ID", id); if(string.IsNullOrEmpty(list[id])) helper.AddElement("Student", field); else helper.AddElement("Student", field,list[id]); } dsreq.SetContent(helper); DSAServices.CallService("SmartSchool.Student.SetExtend", dsreq); }
public static List<TeacherRecord> GetTeachers(IEnumerable<string> primaryKeys) { bool hasKey = false; DSRequest dsreq = new DSRequest(); DSXmlHelper helper = CreateBriefFieldHelper(); helper.AddElement("Condition"); foreach ( var key in primaryKeys ) { hasKey = true; helper.AddElement("Condition", "ID", key); } helper.AddElement("Order"); List<TeacherRecord> result = new List<TeacherRecord>(); if ( hasKey ) { dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Teacher.GetDetailList", dsreq); foreach ( XmlElement var in dsrsp.GetContent().GetElements("Teacher") ) { result.Add(new TeacherRecord(var)); } } return result; }
/// <summary> /// 取得異動集合 /// </summary> /// <returns></returns> public List<ChangeEntry> GetChangeSet() { List<ChangeEntry> ChangeEntries = new List<ChangeEntry>(); DSXmlHelper helper = new DSXmlHelper("Request"); //<Request> //<All/> //<Condition> //<Sequence>1</Sequence> //</Condition> //</Request> helper.AddElement("All"); helper.AddElement("Condition"); helper.AddElement("Condition", "Sequence", CurrentSequence.ToString()); DSRequest Req = new DSRequest(helper.BaseElement); DSXmlHelper rsp = DSAServices.CallService(GETCHANGESET_SERVICENAME, Req).GetContent(); //從Server端取回多筆的ChangeEntry foreach (XmlElement element in rsp.GetElements("Change")) { //將ChangeEntry的XML格式轉為物件 ChangeEntry Entry = new ChangeEntry(); Entry.Load(element); //將ChangeEntry根據表格名稱、異動類別(Insert、Update、Delete)及鍵值組合成異動鍵值 string UID = Entry.TableName + "-" + Entry.Action.ToString() + "-" + Entry.DataID; Console.WriteLine("UID:"+UID); Console.WriteLine("ClientChangeSetCount:"+mClientChangeSet.Count); //假設在ClientChangeSet當中有對應的異動鍵值,並且該異動鍵值裡的集合數大於零,那麼就進行合併消去動作 if (mClientChangeSet.ContainsKey(UID) && mClientChangeSet[UID].Count>0) { List<ChangeEntry> RemoveEntries = new List<ChangeEntry>(); foreach (ChangeEntry LocalEntry in mClientChangeSet[UID]) { //狀況一:本機異動(ClientChangeEntry)與遠端異動(ServerChangeEntry)的異動筆數(Count)一樣: //1.遠端異動(ServerChangeEntry)不加入到實際異動(GetChangeSet的傳回值)。 //2.本機異動(ClientChangeEntry)移除。 //3.發生情況:當新增本機異動至取得遠端異動期間,只有本機對於該筆資料做異動。 if (LocalEntry.Count == Entry.Count) { Console.WriteLine("狀況一"); RemoveEntries.Add(LocalEntry); //將ClientChangeEntry及ServerChangeEntry進行對消。 } //狀況二:本機異動(ClientChangeEntry)大於遠端異動(ServerChangeEntry)的異動筆數(Count): //1.遠端異動(ServerChangeEntry)不加入到實際異動(GetChangeSet的傳回值)。 //2.本機異動(ClientChangeEntry)的異動筆數減去遠端異動(ServerChangeEntry)並保留本機異動。 //3.發生情況:理論上不會有此種情況發生,可能情況是新增本機異動時,馬上就取得遠端異動,而本機異動尚未反應到遠端異動。 else if (LocalEntry.Count > Entry.Count) { Console.WriteLine("狀況二"); LocalEntry.Count -= Entry.Count; //保留ClientChangeEntry,消去ServerChangeEntry } //狀況三:本機異動(ClientChangeEntry)小於遠端異動(ServerChangeEntry)的異動筆數(Count): //1.遠端異動(ServerChangeEntry)加入到實際異動(GetChangeSet的傳回值),並且減去本機異動的異動筆數。 //2.本機異動(ClientChangeEntry)移除。 //3.發生情況:當新增本機異動至取得遠端異動期間,還有其他機器對於此筆資料做修改。 else if (LocalEntry.Count < Entry.Count) { Console.WriteLine("狀況三"); Entry.Count -= LocalEntry.Count; RemoveEntries.Add(LocalEntry); //將ClientChangeEntry移除 ChangeEntries.Add(Entry); //將ServerChangeEntry加入到ChangeSet當中 } } //將ClientEntry自ClientChangeSet當中移除 foreach (ChangeEntry RemoveEntry in RemoveEntries) mClientChangeSet[UID].Remove(RemoveEntry); } //本機沒有異動,但是遠端有異動的情況 else { Console.WriteLine("狀況四"); ChangeEntries.Add(Entry); } //不管是哪種狀況,都要將Sequence的值設為最大值,下次才不會重覆取得 if (Entry.Sequence > CurrentSequence) CurrentSequence = Entry.Sequence; } return ChangeEntries; }
//�ꤤ���ʤ��ϥβ��ʥN���A�G�ϥβ��ʭ�]�Ψƶ� public static DSResponse GetUpdateRecordByDescription(params string[] updateDescs) { DSXmlHelper helper = new DSXmlHelper("GetUpdateInfoListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); foreach (string var in updateDescs) { helper.AddElement("Condition", "UpdateDescription", var); } helper.AddElement("Order"); helper.AddElement("Order", "UpdateDate"); DSRequest dsreq = new DSRequest(helper); return DSAServices.CallService("SmartSchool.Student.UpdateRecord.GetDetailList", dsreq); }
public static Dictionary<string,string> SelectFreshmanPhoto(IEnumerable<string> StudentIDs) { Dictionary<string, string> PhotoList = new Dictionary<string, string>(); DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetStudentListRequest"); helper.AddElement("Field"); helper.AddElement("Field","ID"); helper.AddElement("Field", "FreshmanPhoto"); helper.AddElement("Condition"); foreach(string StudentID in StudentIDs) if (!string.IsNullOrEmpty(StudentID)) helper.AddElement("Condition", "ID", StudentID); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService(SELECT_SERVICENAME, dsreq); foreach (XmlElement element in dsrsp.GetContent().GetElements("Student")) { string strStudentID = element.GetAttribute("ID"); string strFrshmanPhoto = element.SelectSingleNode("FreshmanPhoto").InnerText; PhotoList.Add(strStudentID,strFrshmanPhoto); } return PhotoList; }
public static string SelectGraduatePhoto(string StudentID) { DSRequest dsreq = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetStudentListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "GraduatePhoto"); helper.AddElement("Condition"); helper.AddElement("Condition", "ID", StudentID); dsreq.SetContent(helper); DSResponse dsrsp = DSAServices.CallService(SELECT_SERVICENAME, dsreq); string strFreshmanPhoto = dsrsp.GetContent().GetText("Student/GraduatePhoto"); return strFreshmanPhoto; }
/// <summary> /// ���o�ǥͲ��ʸ�ƲM�� /// </summary> /// <param name="RunningID"></param> /// <returns></returns> public static DSResponse GetUpdateInfoList(string RunningID) { DSXmlHelper helper = new DSXmlHelper("GetUpdateInfoListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); helper.AddElement("Condition", "RefStudentID", RunningID); helper.AddElement("Order"); helper.AddElement("Order", "UpdateDate", "desc"); DSRequest dsreq = new DSRequest(helper); return DSAServices.CallService("SmartSchool.Student.UpdateRecord.GetDetailList", dsreq); }
public static DSResponse GetUpdateRecord(DSRequest req) { return DSAServices.CallService("SmartSchool.Student.UpdateRecord.GetDetailList", req); }
public static DSResponse GetUpdateRecordByStudentIDList(params string[] idList) { DSXmlHelper helper = new DSXmlHelper("GetUpdateInfoListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); foreach (string id in idList) { helper.AddElement("Condition", "RefStudentID", id); } helper.AddElement("Order"); helper.AddElement("Order", "UpdateDate", "desc"); DSRequest dsreq = new DSRequest(helper); return DSAServices.CallService("SmartSchool.Student.UpdateRecord.GetDetailList", dsreq); }
public static DSResponse CallService(string serviceName, DSRequest request) { return FISCA.Authentication.DSAServices.CallService(serviceName, request); }
public static DSResponse SearchStudent(string key, int pageSize, int startPage, bool _SearchInStudentID, bool _SearchInSSN, bool _SearchInName, params string[] _StatusList) { key = "%" + key.Replace("*", "%") + "%"; DSXmlHelper helper = CreateBriefFieldHelper(); helper.AddElement("Condition"); foreach (string status in _StatusList) { helper.AddElement("Condition", "Status", status); } helper.AddElement("Condition", "Search"); helper.AddElement("Condition/Search", "Or"); if (_SearchInStudentID) helper.AddElement("Condition/Search/Or", "StudentNumber", key); if (_SearchInSSN) helper.AddElement("Condition/Search/Or", "IDNumber", key); if (_SearchInName) helper.AddElement("Condition/Search/Or", "Name", key); helper.AddElement("Order"); helper.AddElement("Order", "SeatNo"); helper.AddElement("Pagination"); helper.AddElement("Pagination", "PageSize", pageSize.ToString()); helper.AddElement("Pagination", "StartPage", startPage.ToString()); DSRequest dsreq = new DSRequest(helper); return DSAServices.CallService("SmartSchool.Student.GetAbstractListWithTag", dsreq); }
public static DSResponse GetStudentExamScore(DSRequest dSRequest) { return DSAServices.CallService("SmartSchool.Student.GetStudentExamScore", dSRequest); }
public static DSResponse GetStudentMajorCourse(DSRequest dSRequest) { return DSAServices.CallService("SmartSchool.Student.GetMajorCourse", dSRequest); }
public static DSResponse GetAddressWithID(params string[] RunningID) { DSXmlHelper helper = new DSXmlHelper("GetStudentListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "ID"); helper.AddElement("Field", "PermanentAddress"); helper.AddElement("Field", "MailingAddress"); helper.AddElement("Field", "OtherAddresses"); helper.AddElement("Condition"); foreach (string var in RunningID) { helper.AddElement("Condition", "ID", var); } DSRequest dsreq = new DSRequest(helper); return DSAServices.CallService("SmartSchool.Student.GetDetailList", dsreq); }
public static DSResponse GetUpdateRecord(string updateid) { DSXmlHelper helper = new DSXmlHelper("GetUpdateInfoListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); helper.AddElement("Condition", "ID", updateid); DSRequest dsreq = new DSRequest(helper); return DSAServices.CallService("SmartSchool.Student.UpdateRecord.GetDetailList", dsreq); }