protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string SearchValue = (string)Session["SearchValue"]; LoadAllLists(); txtSearchValue.Text = SearchValue; List <MovieDTO> resultList = (List <MovieDTO>)Session["SearchResult"]; if (resultList == null || resultList.Count == 0) { ResultEmpty.Visible = true; ResultFor.Text = ""; ResultFor.Visible = true; } else { ResultEmpty.Visible = false; ResultFor.Text = resultList.Count + " matches for \'" + SearchValue + "\'"; ResultFor.Visible = true; ResultDetail.DataSource = resultList; ResultDetail.DataBind(); } Session["CurrentPage"] = "SearchResultPage.aspx"; } }
private void AddTestResultDetailToDB(ODataValidationSuiteEntities ctx, int testResulID, ExtensionRuleResultDetail detail) { // Write one detail information to the DB. ResultDetail resultDetailInDB = new ResultDetail(); int resultID = testResulID; resultDetailInDB.TestResultID = resultID; resultDetailInDB.RuleName = detail.RuleName; resultDetailInDB.URI = detail.URI; resultDetailInDB.HTTPMethod = detail.HTTPMethod; resultDetailInDB.RequestHeaders = detail.RequestHeaders; resultDetailInDB.RequestData = detail.RequestData; if (string.IsNullOrEmpty(detail.ResponseStatusCode)) { resultDetailInDB.ResponseStatusCode = detail.ResponseStatusCode; } else { HttpStatusCode?responseStatusCode = (HttpStatusCode)Enum.Parse(typeof(HttpStatusCode), detail.ResponseStatusCode); int statusCode = Convert.ToInt32(responseStatusCode); resultDetailInDB.ResponseStatusCode = string.Format("{0},{1}", statusCode.ToString(), detail.ResponseStatusCode.ToString()); } resultDetailInDB.ResponseHeaders = detail.ResponseHeaders; resultDetailInDB.ResponsePayload = detail.ResponsePayload; resultDetailInDB.ErrorMessage = detail.ErrorMessage; ctx.AddToResultDetails(resultDetailInDB); }
public void CreateResultDetails(Result result, int month) { var resultTypes = this.GetAllResultTypes(); foreach (var t in resultTypes) { if (t.Coefficient != 3) { var detail = new ResultDetail { ResultID = result.ResultID, ResultTypeID = t.ResultTypeID, Month = month }; _unitOfWork.Result.AddDetail(detail); } else { if (month == 12 || month == 5) { var detail = new ResultDetail { ResultID = result.ResultID, ResultTypeID = t.ResultTypeID, Month = month }; _unitOfWork.Result.AddDetail(detail); } } } _unitOfWork.Complete(); }
public void ResultProcessing_WhenReceived_ValidResultSaved() { //Arrange UserRef user = new UserRef(Guid.NewGuid(), "Brian Mwasi", UserType.Clerk); PollingCentreRef pollingCentre = new PollingCentreRef(Guid.NewGuid(), "Jamuhuri Primary"); ResultDetail resultDetail = new ResultDetail { Candidate = new CandidateRef(Guid.NewGuid(), "Sonko", CandidateType.PartyBacked), Result = 1000 }; ResultDetail resultDetail1 = new ResultDetail { Candidate = new CandidateRef(Guid.NewGuid(), "Waititu", CandidateType.PartyBacked), Result = 2000 }; List <ResultDetail> resultDetails = new List <ResultDetail>(); resultDetails.Add(resultDetail); resultDetails.Add(resultDetail1); ISenatorialResultService senatorialResultService = _ioc.Resolve <ISenatorialResultService>(); ISenatorialResultRepository senatorialResultRepository = _ioc.Resolve <ISenatorialResultRepository>(); //Act senatorialResultService.Excecute(user, pollingCentre, resultDetails); //Assert var senatorialResult = senatorialResultRepository.GetAll().OrderByDescending(n => n.ResultSendDate).First(); Assert.That(senatorialResult.Id, Is.Not.EqualTo(Guid.Empty)); Assert.IsNotNull(senatorialResult.ResultReference); Assert.That(senatorialResult.ResultSender, Is.EqualTo(user)); Assert.That(senatorialResult.PollingCentre, Is.EqualTo(pollingCentre)); Assert.That(senatorialResult.Status, Is.EqualTo(ResultStatus.Confirmed)); Assert.That(senatorialResult.ResultSender, Is.EqualTo(user)); Assert.That(senatorialResult.LineItems.OrderBy(n => n.Candidate.FullName).First().Candidate, Is.EqualTo(resultDetail.Candidate)); Assert.That(senatorialResult.LineItems.OrderBy(n => n.Candidate.FullName).Last().Candidate, Is.EqualTo(resultDetail1.Candidate)); Assert.That(senatorialResult.LineItems.OrderBy(n => n.Candidate.FullName).First().ResultCount, Is.EqualTo(resultDetail.Result)); Assert.That(senatorialResult.LineItems.OrderBy(n => n.Candidate.FullName).Last().ResultCount, Is.EqualTo(resultDetail1.Result)); }
public JsonResult InitSingle() { #region 权限控制 int[] iRangePage = { AddPageNodeId, EditPageNodeId, DetailPageNodeId }; int iCurrentPageNodeId = RequestParameters.Pint("NodeId"); var tempAuth = Utits.IsNodePageAuth(iRangePage, iCurrentPageNodeId); if (tempAuth.ErrorType != 1) { return(Json(tempAuth)); } #endregion #region InitSingle Guid ID = RequestParameters.PGuid("ID"); if (ID != Guid.Empty) { var cBll = new DeptsBll(); var item = cBll.GetObjectById(ID); var szDetailModel = new ResultDetail(); szDetailModel.Entity = item; szDetailModel.ErrorType = 1; return(Json(szDetailModel)); } else { var sRetrunModel = new ResultMessage(); sRetrunModel.ErrorType = 0; sRetrunModel.MessageContent = "参数错误."; return(Json(sRetrunModel)); } #endregion }
public async Task <IHttpActionResult> Information([FromBody] UserInformationRequest apiRequest) { try { if (apiRequest == null) { return(Ok(new ResultDetail(ErrorConstants.InvalidPropertyValue, "Empty required fields", null))); } if (string.IsNullOrEmpty(apiRequest.UserID)) { return(Ok(new ResultDetail(ErrorConstants.InvalidPropertyValue, "UserID is required", null))); } var result = (await RespositoryService.UserService.GetUserInfo(apiRequest)).ResponseObject; if (result == null) { return(Ok(new ResultDetail(ErrorConstants.Unknown, "User not found", Version, result))); } var response = new ResultDetail(ErrorConstants.Success, "Success", Version, result); return(Ok(response)); } catch (Exception ex) { throw new AppHttpException(HttpStatusCode.OK , new ResultDetail(ErrorConstants.Unknown, ex.Message, Version)); } }
private ModifyPresidentialResultsCommand DefaultModifyPresidentialResultsCommand(int executionOrder, ResultRef result, PollingCentreRef pollingCentre, UserRef user) { var fixture = new Fixture(); ModifyPresidentialResultsCommand cmd = fixture .Build <ModifyPresidentialResultsCommand>() .With(n => n.ApplyToResult, result) .With(n => n.CommandGeneratedByUser, user) .With(n => n.OriginatingPollingCentre, pollingCentre) .Create(); cmd.CommandId = Guid.NewGuid(); cmd.ApplyToResult = result; CandidateRef candidate = new CandidateRef(Guid.NewGuid(), "Pombe Magufuli", CandidateType.PartyBacked); var res = new ResultDetail { Candidate = candidate, Result = 1000 }; var resList = new List <ResultDetail>(); resList.Add(res); cmd.ResultDetail = resList; cmd.OriginatingPollingCentre = pollingCentre; cmd.CommandGeneratedByUser = user; cmd.CommandExecutionOrder = executionOrder; return(cmd); }
//private void SetResultDetails(DR_ResultEdit result, string logResult, List<EditQueryResultItem> editItems) //{ // if (!string.IsNullOrEmpty(logResult)) // result.Details.Add(ToResultDetail("خطا در ثبت لاگ", "", logResult)); // foreach (var item in editItems) // { // if (item.AfterSaveActionActivitiesResult == Enum_DR_SimpleResultType.ExceptionThrown) // result.Details.Add(ToResultDetail(item.QueryItem.DataItem.ViewInfo, "فعالیتهای بعد از ذخیره شدن داده با خطا همراه بود", item.AfterSaveActionActivitiesMessage)); // if (item.BeforeSaveActionActivitiesResult == Enum_DR_SimpleResultType.ExceptionThrown) // result.Details.Add(ToResultDetail(item.QueryItem.DataItem.ViewInfo, "فعالیتهای قبل از ذخیره شدن داده با خطا همراه بود", item.BeforeSaveActionActivitiesMessage)); // if (item.DataUpdateResult == Enum_DR_SimpleResultType.ExceptionThrown) // result.Details.Add(ToResultDetail(item.QueryItem.DataItem.ViewInfo, "ذخیره شدن داده با خطا همراه بود", item.DataUpdateMessage)); // //if (item.ForumulaUsageResult == Enum_DR_ResultType.ExceptionThrown) // // result.Details.Add(ToResultDetail(item.QueryItem.DataItem.ViewInfo, "ذخیره شدن سابقه فرمول برای داده با خطا همراه بود", item.ForumulaUsageMessage)); // } //} private ResultDetail ToResultDetail(string title, string description, string technicalDescription) { var detail = new ResultDetail(); detail.Title = title; detail.Description = description; detail.TechnicalDescription = technicalDescription; return(detail); }
/// <summary> /// Write conformance test result to database. /// </summary> /// <param name="testResultID">The updated rule's test result ID.</param> /// <param name="result">The result info.</param> /// <param name="errorMessage">The error message.</param> private static void WriteToTestResult(int testResultID, string result, string errorMessage) { try { var testResult = (from j in allRulesResult where j.ID == testResultID select j).FirstOrDefault(); if (testResult != null) { using (var ctx = SuiteEntitiesUtility.GetODataValidationSuiteEntities()) { var resultInTable = (from j in ctx.TestResults where j.ID == testResultID && j.ValidationJobID == testResult.ValidationJobID select j).FirstOrDefault(); if (resultInTable != null) { resultInTable.Classification = result; resultInTable.ErrorMessage = errorMessage; ctx.SaveChanges(); var detailInTable = (from j in ctx.ResultDetails where j.TestResultID == testResultID select j); if (detailInTable != null && detailInTable.Count() > 0) { detailInTable.FirstOrDefault().ErrorMessage = errorMessage; } else { ResultDetail resultDetailInDB = new ResultDetail(); resultDetailInDB.TestResultID = resultInTable.ID; resultDetailInDB.RuleName = resultInTable.RuleName; resultDetailInDB.URI = ""; resultDetailInDB.HTTPMethod = ""; resultDetailInDB.RequestHeaders = ""; resultDetailInDB.RequestData = ""; resultDetailInDB.ResponseStatusCode = ""; resultDetailInDB.ResponseHeaders = ""; resultDetailInDB.ResponsePayload = ""; resultDetailInDB.ErrorMessage = errorMessage; ctx.AddToResultDetails(resultDetailInDB); } ctx.SaveChanges(); } } } } catch (System.Data.OptimisticConcurrencyException) { // error occurred while trying to mark operation as complete. This is not a terminal error for this system and // this is on a thread-pool thread so swallow the exception } }
public static void ThrowException(this ResultDetail @this) { throw @this switch { ExceptionError exceptionError when exceptionError.Exception != null => exceptionError .GetMainException(), ErrorDetail errorDetail => new Exception(JsonSerializer.Serialize(errorDetail)), _ => new Exception(JsonSerializer.Serialize(@this)), }; }
public static object?GetSuitableObject(bool isSuccess, object?value, ResultDetail detail, bool isDevelopMode) { if (isSuccess) { return(value); } return(!isDevelopMode ? (object)new { Result = detail.GetViewModel() } : new { Result = detail.GetViewModel(), AllDetails = detail }); }
void unittest() { GameOverPlayerInfo info = new GameOverPlayerInfo(); info.angangs = new List <int> (); info.angangs.Add(11); info.diangangs = new List <int> (); info.wangangs = new List <int> (); info.chis = new List <int> (); info.chis.Add(133); info.pengs = new List <int> (); info.button = 0; info.holds = new List <int> (); info.holds.Add(21); info.holds.Add(22); info.holds.Add(23); info.holds.Add(24); info.holds.Add(25); info.holds.Add(26); info.holds.Add(27); info.ma = 31; info.userid = 2; HuInfo hu = new HuInfo(); hu.fangpao = false; hu.zimo = true; hu.hued = true; hu.pai = 39; info.hu = hu; info.score = -9000; info.name = "小叶子"; ResultDetail detail = new ResultDetail(); detail.tips = "底1花300 抢杠胡"; info.detail = detail; List <GameOverPlayerInfo> results = new List <GameOverPlayerInfo> (); results.Add(info); results.Add(info); results.Add(info); results.Add(info); showResults(results); }
private void ResultControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { ResultDetail current = (sender as TabControl).SelectedItem as ResultDetail; if (e.OriginalSource != FindName("ResultControl")) { return; } if (current == null || !current.CanBeEdited) // can be edited for show only { return; } current.CreateNewForm(); }
public void SetCreateResult(ResultDetail detail) { this.CreateResult = detail; switch (detail) { case ResultDetail.Success: this.ProcessState.Value = CreateProcess.Completed; break; case ResultDetail.ImageExtractFolderNotFound: this.ProcessState.Value = CreateProcess.Failure; break; } }
public ActionResult Details(int id) { ResultDetail details = _raceRepository.GetResultDetails(UserContext.User.Id, UserContext.User.OrganizationId, id); if (details == null) { return(NotFoundResult()); } ResultDetailViewModel viewModel = Mapper.Map <ResultDetailViewModel>(details); viewModel.SeasonName = $"{GetSeasonTypeName(viewModel.SeasonTypeId)}-{viewModel.Year}"; viewModel.AverageDistance = viewModel.AverageDistance / 1000; return(View(Mvc.View.Result.Details, viewModel)); }
private static ResultDetail GetModuleResult(ApplicationResult ar, Module module) { ResultDetail detailResult = null; if (module == null) { return(null); } var modResult = ar.ModulesResult.FirstOrDefault(mr => mr != null && mr.Module.Id == module.Id); if (modResult != null) { detailResult = modResult.DetailResult; } return(detailResult); }
public async Task <IHttpActionResult> Login([FromBody] UserRequest apiRequest) { try { if (string.IsNullOrEmpty(apiRequest.Email)) { return(Ok(new ResultDetail(ErrorConstants.InvalidPropertyValue, "Email is required", null))); } if (string.IsNullOrEmpty(apiRequest.Password)) { return(Ok(new ResultDetail(ErrorConstants.InvalidPropertyValue, "Password is required", null))); } var result = (await RespositoryService.UserService.GetUser(apiRequest)).ResponseObject; if (result == null) { return(Ok(new ResultDetail(ErrorConstants.Unknown, "User not found", Version, result))); } if (!result.Password.ToUpper().Equals(ConfigHelpers.EncryptStringMD5(apiRequest.Password).ToUpper())) { return(Ok(new ResultDetail(ErrorConstants.WRONG_USER_AUTHENTICATION, ErrorConstants.ErrorDescription(ErrorConstants.WRONG_USER_AUTHENTICATION), Version, null))); } JwtManager jwtManager = new JwtManager(); TokenRequest tokenRequest = new TokenRequest(); tokenRequest.UserID = result.ID; tokenRequest.Name = result.Name; tokenRequest.Email = result.Email; tokenRequest.RoleID = result.RoleID; var token = jwtManager.GenerateSecurityToken(tokenRequest); token.UserDetail = result; var response = new ResultDetail(ErrorConstants.Success, "Success", Version, token); return(Ok(response)); }catch (Exception ex) { throw new AppHttpException(HttpStatusCode.OK , new ResultDetail(ErrorConstants.Unknown, ex.Message, Version)); } }
public async Task <IHttpActionResult> SignUp([FromBody] CreateUserRequest apiRequest) { try { if (apiRequest == null) { return(Ok(new ResultDetail(ErrorConstants.InvalidPropertyValue, "Empty required fields", null))); } if (string.IsNullOrEmpty(apiRequest.Name)) { return(Ok(new ResultDetail(ErrorConstants.InvalidPropertyValue, "Name is required", null))); } if (string.IsNullOrEmpty(apiRequest.Email)) { return(Ok(new ResultDetail(ErrorConstants.InvalidPropertyValue, "Email is required", null))); } if (string.IsNullOrEmpty(apiRequest.Password)) { return(Ok(new ResultDetail(ErrorConstants.InvalidPropertyValue, "Password is required", null))); } if (apiRequest.RoleID == 0) { return(Ok(new ResultDetail(ErrorConstants.InvalidPropertyValue, "RoleId is required", null))); } var result = (await RespositoryService.UserService.CreateUser(apiRequest)).ResponseObject; if (result < 0) { return(Ok(new ResultDetail(result, ErrorConstants.ErrorDescription(result), Version, result))); } var response = new ResultDetail(ErrorConstants.Success, "Success", Version, result); return(Ok(response)); }catch (Exception ex) { throw new AppHttpException(HttpStatusCode.OK , new ResultDetail(ErrorConstants.Unknown, ex.Message, Version)); } }
internal List <ResultDetail> GetResultDetailsWithQuesId(string questionID) { //throw new NotImplementedException(); SqlCommand cmd = new SqlCommand(); cmd.Connection = connection; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = ConfigurationManager.ConnectionStrings["GetResultDetailRound3"].ConnectionString; cmd.Parameters.AddWithValue("@questionID", questionID); // // //string kq = null; SqlDataReader reader = null; List <ResultDetail> resultDetails = new List <ResultDetail>(); try { reader = cmd.ExecuteReader(); while (reader.Read()) { ResultDetail myResultDetail = new ResultDetail(); myResultDetail.ID = reader.GetString(0); myResultDetail.Team = (new PointScreen.DAL()).GetTeam(reader.GetString(1)); myResultDetail.RoundNum = reader.GetInt32(7); myResultDetail.QuestionNum = reader.GetInt32(8); myResultDetail.Question = (new dbConnection()).GetQuestion(reader.GetString(2)); myResultDetail.Score = reader.GetInt32(3); myResultDetail.Point = reader.GetInt32(9); myResultDetail.IsCorrect = reader.GetBoolean(4); // resultDetails.Add(myResultDetail); } } finally { reader.Close(); connection.Close(); } return(resultDetails); }
public ActionResult DownloadTitlePdfFile(int id) { ResultDetail details = _raceRepository.GetResultDetails(UserContext.User.Id, UserContext.User.OrganizationId, id); if (details == null) { return(NotFoundResult()); } ResultDetailViewModel model = Mapper.Map <ResultDetailViewModel>(details); model.AverageDistance = model.AverageDistance / 1000; model.SeasonName = $"{GetSeasonTypeName(model.SeasonTypeId)}-{model.Year}"; return(PdfView( $"{model.Name}_{StyleContext.GetTranslation(Dom.Translation.Result.Title)}", Mvc.View.Result.Title, Mvc.View.Shared.EmptyLayout, model )); }
public List <ResultDetail> GetAllResultDetail() { SqlCommand cmd = new SqlCommand(); cmd.Connection = connection; cmd.CommandText = "exec GetResultDetail"; // // //string kq = null; SqlDataReader reader = null; List <ResultDetail> resultDetails = new List <ResultDetail>(); try { reader = cmd.ExecuteReader(); while (reader.Read()) { ResultDetail myResultDetail = new ResultDetail(); myResultDetail.ID = reader.GetString(0); myResultDetail.Team = (new PointScreen.DAL()).GetTeam(reader.GetString(1)); myResultDetail.RoundNum = reader.GetInt32(7); myResultDetail.QuestionNum = reader.GetInt32(8); myResultDetail.Question = (new dbConnection()).GetQuestion(reader.GetString(2)); myResultDetail.Score = reader.GetInt32(3); myResultDetail.Point = reader.GetInt32(9); myResultDetail.IsCorrect = reader.GetBoolean(4); // resultDetails.Add(myResultDetail); } } finally { reader.Close(); connection.Close(); } return(resultDetails); }
private AddWomenRepLineItemsCommand DefaultAddWomenRepLineItemsCommand(int executionOrder, ResultRef result, PollingCentreRef pollingCentre, UserRef user) { var fixture = new Fixture(); AddWomenRepLineItemsCommand cmd = fixture .Build <AddWomenRepLineItemsCommand>() .With(n => n.ApplyToResult, result) .Create(); cmd.CommandId = Guid.NewGuid(); cmd.ApplyToResult = result; CandidateRef candidate = new CandidateRef(Guid.NewGuid(), "Rachel Shebesh", CandidateType.PartyBacked); var res = new ResultDetail { Candidate = candidate, Result = 1000 }; var resList = new List <ResultDetail>(); resList.Add(res); cmd.ResultDetail = resList; cmd.OriginatingPollingCentre = pollingCentre; cmd.CommandGeneratedByUser = user; cmd.CommandExecutionOrder = executionOrder; return(cmd); }
public static AppHttpException BadRequest(ResultDetail detail) { return(new AppHttpException(HttpStatusCode.OK, detail)); }
protected BusinessRuleException(string message, string version, Exception innerException = null) : base(message, innerException) { resultDetail = new ResultDetail(ErrorConstants.Unknown, message, version); }
public AppHttpException(HttpStatusCode code, ResultDetail result, Exception innerException = null) : base(result, innerException) { HttpCode = code; }
public BusinessRuleException(ResultDetail resultDetails, Exception innerException) : base(resultDetails.Message, innerException) { resultDetail = resultDetails; }
public BusinessRuleException(ResultDetail resultDetails) : base(resultDetails.Message) { resultDetail = resultDetails; }
public BusinessRuleException(int code, string message, string version, object detail = null) : base(message) { resultDetail = new ResultDetail(code, message, version, detail); }
public void AddDetail(ResultDetail detail) { HighSchoolContext.ResultDetails.Add(detail); }
Dictionary <string, bool> IEvaluative.Evaluate(IEnumerable <StudentRecord> list) { _result.Clear(); Dictionary <string, bool> passList = new Dictionary <string, bool>(); //// 取得學生目前班級年級 //Dictionary<string, int> studGrYearDic = new Dictionary<string, int>(); //foreach (JHSchool.Data.JHStudentRecord stud in JHSchool.Data.JHStudent.SelectByIDs(list.AsKeyList())) //{ // if (stud.Class != null) // if (stud.Class.GradeYear.HasValue) // studGrYearDic.Add(stud.ID, stud.Class.GradeYear.Value); //} //bool checkInsShi = false; //// 取得學生學期歷程 //Dictionary<string, JHSchool.Data.JHSemesterHistoryRecord> studentHistories = new Dictionary<string, JHSchool.Data.JHSemesterHistoryRecord>(); //foreach (JHSchool.Data.JHSemesterHistoryRecord rec in JHSchool.Data.JHSemesterHistory.SelectByStudentIDs(list.AsKeyList())) //{ // checkInsShi = true; // K12.Data.SemesterHistoryItem shi = new K12.Data.SemesterHistoryItem(); // shi.SchoolYear = UIConfig._UserSetSHSchoolYear; // shi.Semester = UIConfig._UserSetSHSemester; // if (studGrYearDic.ContainsKey(rec.RefStudentID)) // shi.GradeYear = studGrYearDic[rec.RefStudentID]; // foreach (K12.Data.SemesterHistoryItem shiItem in rec.SemesterHistoryItems) // if (shiItem.SchoolYear == shi.SchoolYear && shiItem.Semester == shi.Semester) // checkInsShi = false; // if (checkInsShi) // rec.SemesterHistoryItems.Add(shi); // studentHistories.Add(rec.RefStudentID, rec); //} //Dictionary<string, List<Data.JHMoralScoreRecord>> morals = new Dictionary<string, List<JHSchool.Data.JHMoralScoreRecord>>(); //foreach (Data.JHMoralScoreRecord moral in Data.JHMoralScore.SelectByStudentIDs(list.AsKeyList())) //{ // if (!morals.ContainsKey(moral.RefStudentID)) // morals.Add(moral.RefStudentID, new List<JHSchool.Data.JHMoralScoreRecord>()); // morals[moral.RefStudentID].Add(moral); //} Dictionary <string, List <AutoSummaryRecord> > morals = new Dictionary <string, List <AutoSummaryRecord> >(); foreach (AutoSummaryRecord record in AutoSummary.Select(list.AsKeyList(), null)) { if (!morals.ContainsKey(record.RefStudentID)) { morals.Add(record.RefStudentID, new List <AutoSummaryRecord>()); } morals[record.RefStudentID].Add(record); } foreach (StudentRecord student in list) { passList.Add(student.ID, true); Dictionary <SemesterInfo, int> gyMapping = new Dictionary <SemesterInfo, int>(); Dictionary <SemesterInfo, decimal> schoolDayMapping = new Dictionary <SemesterInfo, decimal>(); foreach (K12.Data.SemesterHistoryItem item in UIConfig._StudentSHistoryRecDict[student.ID].SemesterHistoryItems) { SemesterInfo info = new SemesterInfo(); info.SchoolYear = item.SchoolYear; info.Semester = item.Semester; if (!gyMapping.ContainsKey(info)) { gyMapping.Add(info, item.GradeYear); if (item.SchoolDayCount.HasValue) { decimal num = (decimal)item.SchoolDayCount.Value; //設定臨界值 decimal count = 0; count += num * _dayPeriod; //foreach (string type in _SelectedType) //{ // count += num * _periodMapping[type] * _typeWeight[type]; //} count = count * _amount / 100; schoolDayMapping.Add(info, count); //num *= _dayPeriod; //num = num * _amount / 100; //schoolDayMapping.Add(info, num); } } } if (!morals.ContainsKey(student.ID)) { continue; } Dictionary <SemesterInfo, decimal> counter = new Dictionary <SemesterInfo, decimal>(); foreach (AutoSummaryRecord record in morals[student.ID]) { SemesterInfo info = new SemesterInfo(); info.SchoolYear = record.SchoolYear; info.Semester = record.Semester; if (gyMapping.ContainsKey(info) && !((gyMapping[info] == 3 || gyMapping[info] == 9) && info.Semester == 2)) { continue; } //foreach (XmlElement itemElement in record.Summary.SelectNodes("AttendanceStatistics/Absence")) foreach (AbsenceCountRecord acRecord in record.AbsenceCounts) { //string name = itemElement.GetAttribute("Name"); //string periodType = itemElement.GetAttribute("PeriodType"); if (!_types.ContainsKey(acRecord.PeriodType + ":" + acRecord.Name)) { continue; } //decimal count; //if (!decimal.TryParse(itemElement.GetAttribute("Count"), out count)) // count = 0; //else // count *= _types[periodType + ":" + name]; if (!counter.ContainsKey(info)) { counter.Add(info, 0); } counter[info] += acRecord.Count * _types[acRecord.PeriodType + ":" + acRecord.Name]; } } List <ResultDetail> resultList = new List <ResultDetail>(); foreach (SemesterInfo info in counter.Keys) { if (!gyMapping.ContainsKey(info)) { continue; } if (!schoolDayMapping.ContainsKey(info)) { continue; } if (counter[info] > schoolDayMapping[info]) { ResultDetail rd = new ResultDetail(student.ID, "" + gyMapping[info], "" + info.Semester); rd.AddMessage("上課天數不足"); rd.AddDetail("上課天數不足(累計" + counter[info] + "節)"); resultList.Add(rd); } } if (resultList.Count > 0) { _result.Add(student.ID, resultList); passList[student.ID] = false; } } return(passList); }