private void ShowEditDialog() { FromEdit = true; EditRating nxtview = view.CreateEditRatingDlg(Int32.Parse(view.SelectedId), view.SelectedMPAA, view.SelectedDescrip); EditRatingPresenter nxtprs = new EditRatingPresenter(nxtview); nxtview.StartPosition = FormStartPosition.CenterParent; view.HideView(); nxtprs.ShowAsDialog(); }
//Edit rating of book or video. private void btnEditRating_Click(object sender, RoutedEventArgs e) { string[] keys = (sender as Button).Tag.ToString().Split(':'); EngServRef.ServerData type = keys[0] == "Book"? EngServRef.ServerData.Book : EngServRef.ServerData.Video; EditRating book = new EditRating(_proxy, Convert.ToInt32(keys[1]), Convert.ToInt32(keys[2]), Convert.ToInt32(keys[3]), type); book.ShowDialog(); switch (type) { case EngServRef.ServerData.Video: btnVideos_Click(null, null); break; case EngServRef.ServerData.Book: btnBooks_Click(null, null); break; } }
public override bool Update() { SubProgress progress = new SubProgress(MainProgress, WeightTable.GetJobWeight("SetYearSubject")); try { Utility.StartTime("SetYearSubject"); progress.ReportMessage("更新學年科目成績排名資料…"); List <List <Student> > packages = Utility.SplitUpdatePackage(Students, PackageSize); int offset = 1; foreach (List <Student> eachPackage in packages) { if (MainProgress.Cancellation) { return(false); //這個部份要看的必須是 MainProgress。 } DSXmlCreator request = new DSXmlCreator(false); bool updateRequired = false; request.CreateStartElement("Request"); foreach (Student eachStudent in eachPackage) { //代表沒有排名。 if (eachStudent.YearSubjects.Count <= 0) { continue; } updateRequired = true; request.CreateStartElement("SchoolYearSubjectRating"); //學期成績記錄的編號。 request.CreateElement("ScoreId", eachStudent.YearSubjects.ScoreRecordIdentity); RatingScope scopeClass = new RatingScope("ClassRating"); RatingScope scopeDept = new RatingScope("DeptRating"); RatingScope scopeYear = new RatingScope("YearRating"); foreach (YearSubjectScore eachScore in eachStudent.YearSubjects.Values) { foreach (ResultPlace eachPlace in eachScore.RatingResults.Values) { if (eachPlace.Scope.ScopeType == ScopeType.Class) { scopeClass.CreateRatingItem(eachScore, eachPlace); } else if (eachPlace.Scope.ScopeType == ScopeType.Dept) { scopeDept.CreateRatingItem(eachScore, eachPlace); } else if (eachPlace.Scope.ScopeType == ScopeType.GradeYear) { scopeYear.CreateRatingItem(eachScore, eachPlace); } } } scopeClass.FinalizeCreate(); scopeDept.FinalizeCreate(); scopeYear.FinalizeCreate(); request.CreateSubtree(scopeClass.GetResult()); request.CreateSubtree(scopeDept.GetResult()); request.CreateSubtree(scopeYear.GetResult()); request.CreateEndElement(); } request.CreateEndElement(); if (updateRequired) { EditRating.UpdateSchoolYearSubjectRating(request.GetResultAsDSXmlHelper()); } progress.ReportProgress((int)(((float)offset / packages.Count) * 100)); offset++; } progress.ReportProgress(100); Utility.EndTime("SetYearSubject"); return(true); } catch (Exception ex) { progress.ReportException(ex); return(false); } }