private void btnAdd_Click(object sender, EventArgs e) { // 初始化資料 SHUpdateRecordRecord updateRec = new SHUpdateRecordRecord(); // 取得學生ID // 先清DAL Cache List <string> rmIDs = new List <string> (); rmIDs.Add(PrimaryKey); SHStudent.RemoveByIDs(rmIDs); SHStudentRecord studRec = SHStudent.SelectByID(PrimaryKey); // 取得最後一筆異動資料,備查使用。 List <SHUpdateRecordRecord> UpdList = (from rec in SHUpdateRecord.SelectByStudentID(PrimaryKey) where rec.ID != updateRec.ID && rec.ADDate.Trim() != "" orderby DateTime.Parse(rec.ADDate) descending, int.Parse(rec.ID) descending select rec).ToList(); if (UpdList.Count > 0) { updateRec.LastADDate = UpdList[0].ADDate; updateRec.LastADNumber = UpdList[0].ADNumber; updateRec.LastUpdateCode = UpdList[0].UpdateCode; } updateRec.StudentID = studRec.ID; updateRec.StudentNumber = studRec.StudentNumber; updateRec.StudentName = studRec.Name; updateRec.IDNumber = studRec.IDNumber; if (studRec.Birthday.HasValue) { updateRec.Birthdate = studRec.Birthday.Value.ToShortDateString(); } updateRec.Gender = studRec.Gender; if (studRec.Department != null) { updateRec.Department = studRec.Department.FullName; } // 取得學生學籍特殊身分代碼 updateRec.SpecialStatus = DALTransfer.GetSpecialCode(studRec.ID); updateRec.UpdateDate = DateTime.Now.ToShortDateString(); if (updateRec == null) { return; } UpdateRecordItemForm form = new UpdateRecordItemForm(UpdateRecordItemForm.actMode.新增, updateRec, PrimaryKey); form.ShowDialog(); }
// 修改異動紀錄 private void EditStudentUpdateRecord() { SHUpdateRecordRecord objUpdate = lstRecord.SelectedItems[0].Tag as SHUpdateRecordRecord; // 檢查畫面是否 XElement _UpdateCode = DALTransfer.GetUpdateCodeList(); List <string> xx = (from elm in _UpdateCode.Elements("異動") where elm.Element("代號").Value == objUpdate.UpdateCode select elm.Element("代號").Value).ToList(); if (xx.Count == 0) { FISCA.Presentation.Controls.MsgBox.Show("異動代碼無法解析,無法開啟相關輸入畫面。"); return; } UpdateRecordItemForm form = new UpdateRecordItemForm(UpdateRecordItemForm.actMode.修改, objUpdate, PrimaryKey); form.ShowDialog(); }
/// <summary> /// 從學期科目成績,計算核心學習領域成績 /// </summary> /// <param name="Score"></param> /// <returns></returns> public static decimal GetCoreDomainLearningScore(this SemesterScore Score) { decimal result = 0; decimal resultWeight = 0; //取得核心學習領域 List <string> Domains = DALTransfer.GetCoreDomainNameList(); //若是新竹版本 if (Program.Mode == ModuleMode.HsinChu) { //國語文及英語領域,由科目成績計算 List <string> ExceptDomains = new List <string>() { "國語文", "英語" }; #region 計算國文領域成績及權重 Tuple <decimal, decimal, decimal> resultChinese = Score.GetDomainScoreFromSubject("國"); result += resultChinese.Item3; //加上國文領域成績 resultWeight += resultChinese.Item2; //加上國文領域權重 #endregion #region 計算英文領域成績及權重 Tuple <decimal, decimal, decimal> resultEnglish = Score.GetDomainScoreFromSubject("英"); result += resultEnglish.Item3; //加上英文領域成績 resultWeight += resultEnglish.Item2; //加上英文領域權重 #endregion //加總其他領域成績 foreach (string Domain in Domains) { //假設不在排外清單中 if (!ExceptDomains.Contains(Domain) && Score.Domain.Contains(Domain)) { if (Score.Domain[Domain].Value.HasValue && Score.Domain[Domain].Weight.HasValue) { result += Score.Domain[Domain].Value.Value * Score.Domain[Domain].Weight.Value; resultWeight += Score.Domain[Domain].Weight.Value; } } } if (resultWeight > 0) { result /= resultWeight; } return(result); } else { //當高雄時直接依照領域判斷 foreach (string Domain in Domains) { if (Score.Domain.Contains(Domain)) { if (Score.Domain[Domain].Value.HasValue && Score.Domain[Domain].Weight.HasValue) { result += Score.Domain[Domain].Value.Value * Score.Domain[Domain].Weight.Value; //計算加權總分 resultWeight += Score.Domain[Domain].Weight.Value; //計算加權分數 } } } if (resultWeight > 0) { result = result / resultWeight; //加權平均 } return(Math.Round(result, 2, MidpointRounding.AwayFromZero)); } }
private void _loader_DoWork(object sender, DoWorkEventArgs e) { //先能Run _UpdateCodeList = DALTransfer.GetUpdateCodeList(); //_codeHelper = GetUpdateCodeSynopsis().GetContent(); }