private void Save(string schoolyear, string semester, string groupName) { List <ActivityRecordItem> list = new List <ActivityRecordItem>(); foreach (DataGridViewRow row in dgEditor.Rows) { StudentRecord student = row.Tag as StudentRecord; if (student != null) { ActivityRecordItem item = new ActivityRecordItem(); item.StudentID = student.ID; item.SchoolYear = schoolyear; item.Semester = semester; item.Item = row.Cells[colItem.Name].Value.ToString(); item.Type = "社團幹部"; item.Unit = groupName; list.Add(item); } } ActivityRecordDAL.SaveGroupLeader(schoolyear, semester, groupName, list.ToArray()); _dirty = false; }
public static List <ActivityRecordItem> GetActivityRecordItems(string schoolyear, string semester, string type, string unit) { DSXmlHelper helper = new DSXmlHelper("Request"); helper.BaseElement.SetAttribute("TableName", TABLE_活動表現紀錄); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); XmlElement element = helper.AddElement("Condition", "Equals", schoolyear); element.SetAttribute("FieldName", "學年度"); XmlElement element1 = helper.AddElement("Condition", "Equals", semester); element1.SetAttribute("FieldName", "學期"); XmlElement element2 = helper.AddElement("Condition", "Equals", type); element2.SetAttribute("FieldName", "類別"); if (!string.IsNullOrEmpty(unit)) { XmlElement element3 = helper.AddElement("Condition", "Equals", unit); element3.SetAttribute("FieldName", "單位"); } string targetService = "UDTService.DML.Select"; DSResponse rsp = FISCA.Authentication.DSAServices.CallService(targetService, new DSRequest(helper.BaseElement)); List <ActivityRecordItem> list = new List <ActivityRecordItem>(); foreach (XmlNode node in rsp.GetContent().BaseElement.SelectNodes(TABLE_活動表現紀錄)) { ActivityRecordItem item = new ActivityRecordItem(); item.Item = node.SelectSingleNode("細項").InnerText; item.SchoolYear = node.SelectSingleNode("學年度").InnerText; item.Semester = node.SelectSingleNode("學期").InnerText; item.StudentID = node.SelectSingleNode("學生編號").InnerText; item.Type = node.SelectSingleNode("類別").InnerText; if (string.IsNullOrEmpty(unit)) { item.Unit = node.SelectSingleNode("單位").InnerText; } list.Add(item); } return(list); }
/// <summary> /// 儲存社團幹部名單 /// </summary> /// <param name="schoolyear">學年度</param> /// <param name="semester">學期</param> /// <param name="unit">社團名稱</param> /// <param name="items">項目</param> public static void SaveGroupLeader(string schoolyear, string semester, string unit, ActivityRecordItem[] items) { DSXmlHelper helper = new DSXmlHelper("DeleteRequest"); helper.AddElement(TABLE_活動表現紀錄); helper.AddElement(TABLE_活動表現紀錄, "Condition"); XmlElement conditionElement1 = helper.AddElement(TABLE_活動表現紀錄 + "/Condition", "Equals", unit); conditionElement1.SetAttribute("FieldName", "單位"); XmlElement conditionElement2 = helper.AddElement(TABLE_活動表現紀錄 + "/Condition", "Equals", "社團幹部"); conditionElement2.SetAttribute("FieldName", "類別"); XmlElement conditionElement3 = helper.AddElement(TABLE_活動表現紀錄 + "/Condition", "Equals", schoolyear); conditionElement3.SetAttribute("FieldName", "學年度"); XmlElement conditionElement4 = helper.AddElement(TABLE_活動表現紀錄 + "/Condition", "Equals", semester); conditionElement4.SetAttribute("FieldName", "學期"); string targetService = "UDTService.DML.Delete"; FISCA.Authentication.DSAServices.CallService(targetService, new DSRequest(helper.BaseElement)); helper = new DSXmlHelper("InsertRequest"); for (int i = 0; i < items.Length; i++) { ActivityRecordItem item = items[i]; helper.AddElement("活動表現紀錄"); helper.AddElement("活動表現紀錄[" + (i + 1) + "]", "單位", unit); helper.AddElement("活動表現紀錄[" + (i + 1) + "]", "學年度", item.SchoolYear); helper.AddElement("活動表現紀錄[" + (i + 1) + "]", "學期", item.Semester); helper.AddElement("活動表現紀錄[" + (i + 1) + "]", "學生編號", item.StudentID); helper.AddElement("活動表現紀錄[" + (i + 1) + "]", "細項", item.Item); helper.AddElement("活動表現紀錄[" + (i + 1) + "]", "類別", "社團幹部"); } targetService = "UDTService.DML.Insert"; FISCA.Authentication.DSAServices.CallService(targetService, new DSRequest(helper.BaseElement)); }
private void Save() { List <ActivityRecordItem> list = new List <ActivityRecordItem>(); if (!string.IsNullOrEmpty(errorProvider1.GetError(cboSemester)) || !string.IsNullOrEmpty(errorProvider1.GetError(cboSchoolYear))) { MessageBoxEx.Show("資料有誤, 請修正後再行儲存!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (DataGridViewRow row in dgEditor.Rows) { if (!string.IsNullOrEmpty(row.ErrorText)) { MessageBoxEx.Show("資料有誤, 請修正後再行儲存!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } StudentRecord student = row.Tag as StudentRecord; if (student != null) { ActivityRecordItem item = new ActivityRecordItem(); item.StudentID = student.ID; item.SchoolYear = cboSchoolYear.Text; item.Semester = cboSemester.Text; item.Item = row.Cells[colItem.Name].Value.ToString(); item.Type = "學校幹部"; item.Unit = string.Empty; list.Add(item); } } ActivityRecordDAL.SaveSchoolLeader(cboSchoolYear.Text, cboSemester.Text, list.ToArray()); _dirty = false; }
/// <summary> /// 取得學生活動紀錄 /// </summary> /// <param name="studentid"></param> /// <returns></returns> public static List <ActivityRecordItem> GetActivityRecordHistory(string studentid) { DSXmlHelper helper = new DSXmlHelper("Request"); helper.BaseElement.SetAttribute("TableName", TABLE_活動表現紀錄); helper.AddElement("Field"); helper.AddElement("Field", "All"); helper.AddElement("Condition"); XmlElement element = helper.AddElement("Condition", "Equals", studentid); element.SetAttribute("FieldName", "學生編號"); //helper.AddElement("Order"); //helper.AddElement("Order", "學年度", "desc"); //helper.AddElement("Order", "學期", "asc"); string targetService = "UDTService.DML.Select"; DSResponse rsp = FISCA.Authentication.DSAServices.CallService(targetService, new DSRequest(helper.BaseElement)); List <ActivityRecordItem> list = new List <ActivityRecordItem>(); foreach (XmlNode node in rsp.GetContent().BaseElement.SelectNodes(TABLE_活動表現紀錄)) { ActivityRecordItem item = new ActivityRecordItem(); item.Item = node.SelectSingleNode("細項").InnerText; item.SchoolYear = node.SelectSingleNode("學年度").InnerText; item.Semester = node.SelectSingleNode("學期").InnerText; item.StudentID = node.SelectSingleNode("學生編號").InnerText; item.Type = node.SelectSingleNode("類別").InnerText; item.Unit = node.SelectSingleNode("單位").InnerText; list.Add(item); } return(list); }