/// <summary> /// 儲存異動名冊 /// </summary> /// <param name="StudUpdateRecBRec"></param> public static void SetStudUpdateRecBatchRec(BL.StudUpdateRecBatchRec StudUpdateRecBRec, bool isInsert) { SHUpdateRecordBatchRecord shurbr = new SHUpdateRecordBatchRecord(); shurbr.ADDate = StudUpdateRecBRec.ADDate; shurbr.ADNumber = StudUpdateRecBRec.ADNumber; Global._GSchoolCode = K12.Data.School.Code; Global._GSchoolName = K12.Data.School.ChineseName; Global._GUpdateBatchType = StudUpdateRecBRec.UpdateType; Global._GSchoolYear = StudUpdateRecBRec.SchoolYear.ToString(); Global._GSemester = StudUpdateRecBRec.Semester.ToString(); Global._GDocName = StudUpdateRecBRec.Name; // 將 XElement 轉型 XmlElement shurbr.Content = new XmlDocument().ReadNode(ConvertStudUpdateRecDocToXML(StudUpdateRecBRec.StudUpdateRecDocList).CreateReader()) as XmlElement; shurbr.ID = StudUpdateRecBRec.ID; shurbr.Name = StudUpdateRecBRec.Name; shurbr.SchoolYear = StudUpdateRecBRec.SchoolYear; shurbr.Semester = StudUpdateRecBRec.Semester; if (isInsert) { SHUpdateRecordBatch.Insert(shurbr); } else { SHUpdateRecordBatch.Update(shurbr); } }
//儲存調整結果 private void btnSave_Click(object sender, EventArgs e) { //整理UI介面的資料 打包成xml 儲存 foreach (DataGridViewRow dr in dataGridViewX1.Rows) { StudUpdateRecCoverRec coverData = new StudUpdateRecCoverRec(); coverData.grYear = "" + dr.Cells["年級"].Value; coverData.DeptCode = "" + dr.Cells["科別代碼"].Value; coverData.ReportType = "" + dr.Cells["名冊別"].Value; coverData.ClassType = "" + dr.Cells["班別"].Value; coverData.UpdateType = "" + dr.Cells["上傳類別"].Value; coverData.ApprovedClassCount = "" + dr.Cells["核定班數"].Value; coverData.ApprovedStudentCount = "" + dr.Cells["核定學生數"].Value; coverData.ActualClassCount = "" + dr.Cells["實招班數"].Value; coverData.ActualStudentCount = "" + dr.Cells["實招新生數"].Value; coverData.OriginalStudentCount = "" + dr.Cells["原有學生數"].Value; coverData.IncreaseStudentCount = "" + dr.Cells["增加學生數"].Value; coverData.DecreaseStudentCount = "" + dr.Cells["減少學生數"].Value; coverData.ModifiedStudentCount = "" + dr.Cells["更正學生數"].Value; coverData.CurrentStudentCount = "" + dr.Cells["現有學生數"].Value; coverData.Remarks1 = "" + dr.Cells["註1"].Value; coverData.RemarksContent = "" + dr.Cells["備註說明"].Value; coverDataList.Add(coverData); } // 下面這段是自 DALTransfer.SetStudUpdateRecBatchRec 抄過來 SHUpdateRecordBatchRecord shurbr = new SHUpdateRecordBatchRecord(); shurbr.ADDate = _BRec.ADDate; shurbr.ADNumber = _BRec.ADNumber; Global._GSchoolCode = K12.Data.School.Code; Global._GSchoolName = K12.Data.School.ChineseName; Global._GUpdateBatchType = _BRec.UpdateType; Global._GSchoolYear = _BRec.SchoolYear.ToString(); Global._GSemester = _BRec.Semester.ToString(); Global._GDocName = _BRec.Name; // 將 XElement 轉型 XmlElement shurbr.Content = new XmlDocument().ReadNode(ConvertStudUpdateRecDocToXML(_BRec.StudUpdateRecDocList).CreateReader()) as XmlElement; shurbr.ID = _BRec.ID; shurbr.Name = _BRec.Name; shurbr.SchoolYear = _BRec.SchoolYear; shurbr.Semester = _BRec.Semester; // 在此處永遠只有 update 方法,從來源哪一個異動名冊改的內容就存回去(另外 有 insert 方法可以使用) SHUpdateRecordBatch.Update(shurbr); FISCA.Presentation.Controls.MsgBox.Show("上傳更動成功!!"); this.Close(); }
//儲存調整結果 private void btnSave_Click(object sender, EventArgs e) { //整理UI介面的資料 打包成xml 儲存 foreach (DataGridViewRow dr in dataGridViewX1.Rows) { RetaintoStudentListRecCoverRec coverData = new RetaintoStudentListRecCoverRec(); coverData.grYear = "" + dr.Cells["年級"].Value; coverData.DeptCode = "" + dr.Cells["科別代碼"].Value; coverData.ReportType = "" + dr.Cells["名冊別"].Value; coverData.ClassType = "" + dr.Cells["班別"].Value; coverData.UpdateType = "" + dr.Cells["上傳類別"].Value; coverData.LongTermCareStudentCount = "" + dr.Cells["因病須長期療養或懷孕申請保留學生數"].Value; coverData.MilitaryStudentCount = "" + dr.Cells["因服兵役申請保留學生數"].Value; coverData.ReCallStudentCount = "" + dr.Cells["因病申請保留錄取資格期間復受徵召服役者申請學生數"].Value; coverData.RemarksContent = "" + dr.Cells["備註說明"].Value; coverDataList.Add(coverData); } // 下面這段是自 DALTransfer.SetStudUpdateRecBatchRec 抄過來 SHUpdateRecordBatchRecord shurbr = new SHUpdateRecordBatchRecord(); shurbr.ADDate = _BRec.ADDate; shurbr.ADNumber = _BRec.ADNumber; Global._GSchoolCode = K12.Data.School.Code; Global._GSchoolName = K12.Data.School.ChineseName; Global._GUpdateBatchType = _BRec.UpdateType; Global._GSchoolYear = _BRec.SchoolYear.ToString(); Global._GSemester = _BRec.Semester.ToString(); Global._GDocName = _BRec.Name; // 將 XElement 轉型 XmlElement shurbr.Content = new XmlDocument().ReadNode(ConvertStudUpdateRecDocToXML(_BRec.StudUpdateRecDocList).CreateReader()) as XmlElement; shurbr.ID = _BRec.ID; shurbr.Name = _BRec.Name; shurbr.SchoolYear = _BRec.SchoolYear; shurbr.Semester = _BRec.Semester; // 在此處永遠只有 update 方法,從來源哪一個異動名冊改的內容就存回去(另外 有 insert 方法可以使用) SHUpdateRecordBatch.Update(shurbr); FISCA.Presentation.Controls.MsgBox.Show("上傳更動成功!!"); this.Close(); }
/// <summary> /// 取得異動名冊 /// </summary> public static BL.StudUpdateRecBatchRec GetStudUpdateRecBatchRec(string ID) { if (string.IsNullOrEmpty(ID)) { return(null); } BL.StudUpdateRecBatchRec surbr = new UpdateRecordModule_IBSH.BL.StudUpdateRecBatchRec(); SHUpdateRecordBatchRecord recBatch = SHUpdateRecordBatch.SelectByID(ID); surbr.ID = recBatch.ID; surbr.ADDate = recBatch.ADDate; surbr.ADNumber = recBatch.ADNumber; surbr.Name = recBatch.Name; surbr.SchoolYear = recBatch.SchoolYear; surbr.Semester = recBatch.Semester; surbr.Content = recBatch.Content; string content = recBatch.Content.InnerXml; XElement elm = XElement.Parse(content); surbr.StudUpdateRecDocList = ConvertXmlToStudUpdateRecDocList(elm); foreach (XAttribute xx in elm.Attributes()) { switch (xx.Name.ToString()) { case "學校代號": surbr.SchoolCode = xx.Value; break; case "學校代碼": surbr.SchoolCode = xx.Value; break; case "學校名稱": surbr.SchoolName = xx.Value; break; case "類別": surbr.UpdateType = xx.Value; break; } } return(surbr); }
/// <summary> /// 儲存異動名冊 /// </summary> /// <param name="StudUpdateRecBRec"></param> public static void SetStudUpdateRecBatchRec(BL.StudUpdateRecBatchRec StudUpdateRecBRec,bool isInsert) { SHUpdateRecordBatchRecord shurbr = new SHUpdateRecordBatchRecord(); shurbr.ADDate = StudUpdateRecBRec.ADDate; shurbr.ADNumber = StudUpdateRecBRec.ADNumber; Global._GSchoolCode = K12.Data.School.Code; Global._GSchoolName = K12.Data.School.ChineseName; Global._GUpdateBatchType = StudUpdateRecBRec.UpdateType; Global._GSchoolYear = StudUpdateRecBRec.SchoolYear.ToString (); Global._GSemester = StudUpdateRecBRec.Semester.ToString(); Global._GDocName = StudUpdateRecBRec.Name; // 將 XElement 轉型 XmlElement shurbr.Content = new XmlDocument().ReadNode(ConvertStudUpdateRecDocToXML(StudUpdateRecBRec.StudUpdateRecDocList).CreateReader()) as XmlElement; shurbr.ID = StudUpdateRecBRec.ID; shurbr.Name = StudUpdateRecBRec.Name; shurbr.SchoolYear = StudUpdateRecBRec.SchoolYear; shurbr.Semester = StudUpdateRecBRec.Semester; if (isInsert) SHUpdateRecordBatch.Insert(shurbr); else SHUpdateRecordBatch.Update(shurbr); }