public results_speed(CMemberAndResults localResult, string groupFullName, enRounds roundId) { UpdateFromLocalData(localResult); groups = groupFullName; round = GlobalDefines.ROUND_NAMES[(byte)roundId]; }
public COneRoundResults GetResultsForRound(enRounds round) { COneRoundResults result = null; if (!m_RoundResults.TryGetValue(round, out result)) { result = null; } return(result); }
public CRoundItem(enRounds id) { m_id = id; m_ExtraOption = new CExtraOption(m_id); OnPropertyChanged(RoundNamePropertyName); }
public override void RefreshFrom(ICanRefreshFrom rhs, bool SkipNullsForObjects, bool SkipNullsForNullables) { base.RefreshFrom(rhs, SkipNullsForObjects, SkipNullsForNullables); COneRoundResults rhsOneRoundResults = rhs as COneRoundResults; if (rhsOneRoundResults == null) { return; } if (Route1 == null) { Route1 = rhsOneRoundResults.Route1; } else if (rhsOneRoundResults.Route1 == null) { if (!SkipNullsForObjects) { Route1 = null; } } else { Route1.RefreshFrom(rhsOneRoundResults.Route1, SkipNullsForObjects, SkipNullsForNullables); } if (Route2 == null) { Route2 = rhsOneRoundResults.Route2; } else if (rhsOneRoundResults.Route2 == null) { if (!SkipNullsForObjects) { Route2 = null; } } else { Route2.RefreshFrom(rhsOneRoundResults.Route2, SkipNullsForObjects, SkipNullsForNullables); } if (Sum == null) { Sum = rhsOneRoundResults.Sum; } else if (rhsOneRoundResults.Sum == null) { if (!SkipNullsForObjects) { Sum = null; } } else { Sum.RefreshFrom(rhsOneRoundResults.Sum, SkipNullsForObjects, SkipNullsForNullables); } m_Round = rhsOneRoundResults.m_Round; IsLastMember = rhsOneRoundResults.IsLastMember; IsLooser = rhsOneRoundResults.IsLooser; }
public void SetResultsForRound(enRounds round, COneRoundResults Results) { m_RoundResults[round] = Results; OnPropertyChanged(PropertyNames[round]); OnPropertyChanged(IsLastMemberInAnyRoundPropertyName); }
public CExtraOption(enRounds id) { m_id = id; OnPropertyChanged(NamePropertyName); OnPropertyChanged(ShowPropertyName); }
public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { enCellType DestColumnType = parameter == null ? enCellType.None : (enCellType)parameter; CResult result = values[0] as CResult; if (values.Length == 4) { if (result == null || !(values[1] is byte) || !(values[2] is int) || !(values[3] is int)) { if (result != null && result.CondFormating.HasValue && (values[1] is byte) && values[3] is int) { // Возможно участник стоит на старте lock (DBManagerApp.m_AppSettings.m_SettigsSyncObj) { if (result.CondFormating.Value == enCondFormating.StayOnStart && DestColumnType != enCellType.StartNumber && DestColumnType != enCellType.SurnameAndName) { return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.StayOnStartFontStyle, false)); } } } else { return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.PlainResultsFontStyle, true)); } } } else if (values.Length == 2) { if (result == null || !(values[1] is byte)) { return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.PlainResultsFontStyle, true)); } } else { return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.PlainResultsFontStyle, true)); } enRounds Round = (enRounds)((byte)values[1]); if (!(result == null || result.CondFormating == null)) { lock (DBManagerApp.m_AppSettings.m_SettigsSyncObj) { switch (result.CondFormating.Value) { case enCondFormating.StayOnStart: // Находится на старте switch (DestColumnType) { case enCellType.StartNumber: case enCellType.SurnameAndName: if (Round == enRounds.Qualif || Round == enRounds.Qualif2) { return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.InvitedToStartFontStyle, false)); } break; case enCellType.None: return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.StayOnStartFontStyle, false)); default: break; } break; case enCondFormating.JustRecievedResult: // Только что полученный результат if (Round == enRounds.Qualif || Round == enRounds.Qualif2 || (Round > enRounds.Qualif2 && Round <= enRounds.Final && result.ResultColumnNumber == enResultColumnNumber.Sum)) { // Тут подсветка не нужна break; } else { return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.JustRecievedResultFontStyle, false)); } case enCondFormating.Preparing: // Участник готовится if (Round == enRounds.Qualif || Round == enRounds.Qualif2) { switch (DestColumnType) { case enCellType.StartNumber: case enCellType.SurnameAndName: return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.PreparingFontStyle, false)); default: break; } } break; default: break; } } } if (values.Length == 4) { int RoundPlace = values[2] is int?(int)values[2] : 0; int MembersFromQualif = values[3] is int?(int)values[3] : 0; if (RoundPlace > 0 && RoundPlace <= MembersFromQualif) { // Участник проходит в следуюущий тур return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.NextRoundMembersCountFontStyle, false)); } else { return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.PlainResultsFontStyle, true)); } } else { return(ConvResultVal(DBManagerApp.m_AppSettings.m_Settings.PlainResultsFontStyle, true)); } }
/// <summary> /// /// </summary> /// <param name="excelApp"> /// Приложение Excel, в котором открыты книги /// <paramref name="wbkTarget"/> и <paramref name="wbkTemplates"/> /// </param> /// <param name="wbkTarget"> /// Книга, в которую добавляется отчёт. Добавление всегда происходит в конец /// </param> /// <param name="wbkTemplates"> /// Книга с шаблонами отчётов /// </param> /// <returns></returns> public override bool CreateReport(MSExcel.Application excelApp, MSExcel.Workbook wbkTarget, MSExcel.Workbook wbkTemplates) { // Копируем в конец новой книги лист-шаблон MSExcel.Worksheet wsh = null; lock (DBManagerApp.m_AppSettings.m_SettingsSyncObj) { wsh = wbkTemplates.Worksheets[DBManagerApp.m_AppSettings.m_Settings.ExcelSettings.dictReportTemplates[enReportTypes.Final]]; } wsh.Copy(After: wbkTarget.Worksheets[wbkTarget.Worksheets.Count]); // Лист, в который нужно будет вставлять данные wsh = wbkTarget.Worksheets[wbkTarget.Worksheets.Count]; wsh.Name = CurTask.m_GroupToExport.Rounds.First(arg => arg.id == enRounds.Final).SheetName; groups GroupInDB = CurTask.m_CompDesc.groups.First(arg => { return(arg.id_group == CurTask.m_GroupToExport.id); }); CCompSettings CompSettings = new CCompSettings(GroupInDB); wsh.Range[RN_COMP_NAME].Value = CompSettings.CompName; if (CompSettings.RoundDates == null) { wsh.Range[RN_ROUND_DATE].Value = CompSettings.StartDate.Date.ToLongDateString(); } else { wsh.Range[RN_ROUND_DATE].Value = CompSettings.FinalDate; } wsh.Range[RN_MAIN_JUDGE].Value = CompSettings.MainJudge; wsh.Range[RN_MAIN_SECRETARY].Value = CompSettings.MainSecretary; wsh.Range[RN_SECOND_COL_NAME].Value = CompSettings.SecondColName; if (CompSettings.Row6 == GlobalDefines.DEFAULT_XML_STRING_VAL) { wsh.Rows[6].Delete(); } else { wsh.Range[RN_ROW_6].Value = CompSettings.Row6; } string ReportName = wsh.Range[RN_REPORT_NAME].Value; wsh.Range[RN_REPORT_NAME].Value = ReportName.Replace(GlobalDefines.EXCEL_REPORT_NAME_TEXT_TO_REPLACE, CreateGroupName(CurTask.m_GroupToExport, CompSettings.AgeGroup, out int SelectedStartYear, out int SelectedEndYear)); // Выводим участников соревнования List <enRounds> CompRounds = (from round in CurTask.m_GroupToExport.Rounds orderby round.id select round.id).ToList(); enRounds PrevRound = CompRounds[CompRounds.IndexOf(enRounds.Final) - 1]; List <CMemberAndResults> lstResults = (from member in DBManagerApp.m_Entities.members join part in DBManagerApp.m_Entities.participations on member.id_member equals part.member join result in DBManagerApp.m_Entities.results_speed on part.id_participation equals result.participation where result.round == (byte)enRounds.Final && part.Group == GroupInDB.id_group && member.year_of_birth >= SelectedStartYear && member.year_of_birth <= SelectedEndYear && result.place.HasValue orderby result.number select new CMemberAndResults { MemberInfo = new CFullMemberInfo() { IDMember = member.id_member, Surname = member.surname, Name = member.name, YearOfBirth = member.year_of_birth, Coach = part.coach, Team = part.team, InitGrade = part.init_grade, }, Results = new COneRoundResults() { m_Round = (enRounds)result.round, Route1 = new CResult() { ResultInDB = result, Time = result.route1, }, Route2 = new CResult() { ResultInDB = result, Time = result.route2, }, Sum = new CResult() { ResultInDB = result, Time = result.sum, }, }, StartNumber = result.number, Place = result.place }).ToList(); foreach (CMemberAndResults MemberAndResults in lstResults) { int Row = 0; if (MemberAndResults.StartNumber.Value < 3) { Row = wsh.Range[RN_FIRST_DATA_ROW_34].Row; } else { Row = wsh.Range[RN_FIRST_DATA_ROW_12].Row; } if (MemberAndResults.StartNumber.Value % 2 == 0) { Row++; } wsh.Cells[Row, EXCEL_PERSONAL_COL_NUM].Value = MemberAndResults.MemberInfo.SurnameAndName; if (CompSettings.SecondColNameType == enSecondColNameType.Coach) { wsh.Cells[Row, EXCEL_TEAM_COL_NUM].Value = DBManagerApp.m_Entities.coaches.First(arg => arg.id_coach == MemberAndResults.MemberInfo.Coach).name; } else { wsh.Cells[Row, EXCEL_TEAM_COL_NUM].Value = DBManagerApp.m_Entities.teams.First(arg => arg.id_team == MemberAndResults.MemberInfo.Team).name; } wsh.Cells[Row, EXCEL_YEAR_OF_BIRTH_COL_NUM].Value = MemberAndResults.MemberInfo.YearOfBirth; GradeMarkupConverter conv = new GradeMarkupConverter(); wsh.Cells[Row, EXCEL_GRADE_COL_NUM].Value = conv.Convert(MemberAndResults.MemberInfo.InitGrade, MemberAndResults.MemberInfo.InitGrade.GetType(), null, CultureInfo.GetCultureInfo(GlobalDefines.RUSSIAN_CULTURE_NAME)); wsh.Cells[Row, EXCEL_ROUTE1_COL_NUM].Value = GlobalDefines.EncodeSpeedResult(MemberAndResults.Results.Route1.Time, MemberAndResults.Results.Route1.AdditionalEventTypes); wsh.Cells[Row, EXCEL_ROUTE2_COL_NUM].Value = GlobalDefines.EncodeSpeedResult(MemberAndResults.Results.Route2.Time, MemberAndResults.Results.Route2.AdditionalEventTypes); wsh.Cells[Row, EXCEL_SUM_COL_NUM].Value = GlobalDefines.EncodeSpeedResult(MemberAndResults.Results.Sum.Time, MemberAndResults.Results.Sum.AdditionalEventTypes); wsh.Cells[Row, EXCEL_PLACE_COL_NUM].Value = GlobalDefines.EncodePlace((byte)MemberAndResults.Place.Value); } return(true); }