EveryDB2のデータベースを読み込んでWinFormでGUI表示するサンプル
リビジョン | 3e5e3ef449ec56f8f67dcff2e7e8ed377262cc46 (tree) |
---|---|
日時 | 2021-06-06 23:53:42 |
作者 | yoshy <yoshy@user...> |
コミッター | yoshy |
temp_20210605_0756
@@ -15,6 +15,8 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
15 | 15 | { |
16 | 16 | Kettonum = kettoNum; |
17 | 17 | Bataijyu = bataijyu; |
18 | + | |
19 | + InitProperties(); | |
18 | 20 | } |
19 | 21 | |
20 | 22 | public UmaRaceRowDto(TokuRaceRowDto tokuRace, string kettoNum, string bataijyu) |
@@ -24,65 +26,127 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
24 | 26 | Bataijyu = bataijyu; |
25 | 27 | |
26 | 28 | Race = BeanHelper.CreateAndCopy<NRace>(tokuRace); |
29 | + | |
30 | + InitProperties(); | |
27 | 31 | } |
28 | 32 | |
29 | 33 | public UmaRaceRowDto(UmaRaceInfo umaRace) |
30 | 34 | { |
31 | 35 | BeanHelper.Copy(this, umaRace); |
36 | + | |
37 | + InitProperties(); | |
32 | 38 | } |
33 | 39 | |
34 | - public string YearMonthDay => FormatHelper.FormatYearMonthDay(Year, Monthday); | |
40 | + private void InitProperties() | |
41 | + { | |
42 | + YearMonthDay = FormatHelper.FormatYearMonthDay(Year, Monthday); | |
43 | + | |
44 | + WakubanFormatted = FormatHelper.SuppressZeroLeading(Wakuban); | |
45 | + | |
46 | + UmabanFormatted = FormatHelper.SuppressZeroLeading(Umaban); | |
47 | + | |
48 | + JyoName = CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); | |
49 | + | |
50 | + RaceName = CodeHelper.GetInstance().GetRaceName(Race, "不明"); | |
51 | + | |
52 | + GradeName = CodeHelper.GetInstance().GetGradeName(Race, "?"); | |
35 | 53 | |
36 | - public string WakubanFormatted => FormatHelper.SuppressZeroLeading(Wakuban); | |
54 | + TurfDirtName = CodeHelper.GetInstance().GetTurfDurtName(Race?.Trackcd, "?"); | |
37 | 55 | |
38 | - public string UmabanFormatted => FormatHelper.SuppressZeroLeading(Umaban); | |
56 | + CourseName = TurfDirtName + Race?.Kyori; | |
39 | 57 | |
40 | - public string JyoName => CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); | |
58 | + TosuFormatted = FormatHelper.FormatTosu(Race); | |
41 | 59 | |
42 | - public string RaceName => CodeHelper.GetInstance().GetRaceName(Race, "不明"); | |
60 | + BabaJyotaiFormatted = FormatHelper.FormatBabaJyotai(Race); | |
43 | 61 | |
44 | - public string GradeName => CodeHelper.GetInstance().GetGradeName(Race, "?"); | |
62 | + NinkiFormatted = FormatHelper.SuppressZeroLeading(Ninki); | |
45 | 63 | |
46 | - public string TurfDirtName => CodeHelper.GetInstance().GetTurfDurtName(Race?.Trackcd, "?"); | |
64 | + TsukaJyuni = FormatHelper.FormatTsukaJyuni(this); | |
47 | 65 | |
48 | - public string CourseName => TurfDirtName + Race?.Kyori; | |
66 | + KakuteiJyuniFormatted = FormatHelper.SuppressZeroLeading(Kakuteijyuni); | |
49 | 67 | |
50 | - public string NinkiFormatted => FormatHelper.SuppressZeroLeading(Ninki); | |
68 | + Kimete = CodeHelper.GetInstance().GetName(CodeHelper.KYAKUSITU_KUBUN, Kyakusitukubun, "不明"); | |
51 | 69 | |
52 | - public string TosuFormatted => FormatHelper.FormatTosu(Race); | |
70 | + PCIRatioFormatted = FormatHelper.FormatPCIRatio(Harontimel3, Stat?.Harontimel3Avg, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
53 | 71 | |
54 | - public string BabaJyotaiFormatted => FormatHelper.FormatBabaJyotai(Race); | |
72 | + HaronTimeL3Formatted = FormatHelper.FormatTimeSSF(Harontimel3); | |
55 | 73 | |
56 | - public string KakuteiJyuniFormatted => FormatHelper.SuppressZeroLeading(Kakuteijyuni); | |
74 | + HaronTimeL3DevFormatted = FormatHelper.FormatHaronTimeL3Dev(Harontimel3, Stat?.Harontimel3Avg, Stat?.Harontimel3Dev); | |
57 | 75 | |
58 | - public string Kimete => CodeHelper.GetInstance().GetName(CodeHelper.KYAKUSITU_KUBUN, Kyakusitukubun, "不明"); | |
76 | + PCIFormatted = FormatHelper.FormatPCI(Harontimel3, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
59 | 77 | |
60 | - public string BataijyuFormatted => FormatHelper.FormatBataijyu(Bataijyu, Zogenfugo, Zogensa); | |
78 | + AvgHaronTimeMinus3Formatted = FormatHelper.FormatAvgHaronTimeMinus3(Time, Harontimel3, Race?.Kyori); | |
79 | + | |
80 | + AvgHaronTimeMinus3DevFormatted = FormatHelper.FormatAvgHaronTimeMinus3Dev(Time, Harontimel3, Race?.Kyori, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
81 | + | |
82 | + TimeFormatted = FormatHelper.FormatTimeMSSF(Time); | |
83 | + | |
84 | + FutanFormatted = FormatHelper.ToNumber(Futan, 3, 1); | |
85 | + | |
86 | + BataijyuFormatted = FormatHelper.FormatBataijyu(Bataijyu, Zogenfugo, Zogensa); | |
87 | + | |
88 | + StatPCIFormatted = FormatHelper.FormatPCI(Stat?.Harontimel3Avg, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
89 | + | |
90 | + StatHaronTimeL3Formatted = FormatHelper.FormatTimeSSF(Stat?.Harontimel3Avg); | |
91 | + | |
92 | + StatAvgHaronTimeMinus3Formatted = FormatHelper.FormatTimeSSF(Stat?.Avgharontimeminus3Avg); | |
93 | + } | |
61 | 94 | |
62 | - public string PCIFormatted => FormatHelper.FormatPCI(Time, Harontimel3, Race?.Kyori, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
95 | + public string YearMonthDay { get; private set; } | |
63 | 96 | |
64 | - public string HaronTimeL3Formatted => FormatHelper.FormatTimeSSF(Harontimel3); | |
97 | + public string WakubanFormatted { get; private set; } | |
65 | 98 | |
66 | - public string HaronTimeL3DevFormatted => FormatHelper.FormatHaronTimeL3Dev(Harontimel3, Stat?.Harontimel3Avg, Stat?.Harontimel3Dev); | |
99 | + public string UmabanFormatted { get; private set; } | |
67 | 100 | |
68 | - public string AvgHaronTimeMinus3Formatted => FormatHelper.FormatAvgHaronTimeMinus3(Time, Harontimel3, Race?.Kyori); | |
101 | + public string JyoName { get; private set; } | |
69 | 102 | |
70 | - public string AvgHaronTimeMinus3DevFormatted => FormatHelper.FormatAvgHaronTimeMinus3Dev(Time, Harontimel3, Race?.Kyori, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
103 | + public string RaceName { get; private set; } | |
71 | 104 | |
72 | - public string TimeFormatted => FormatHelper.FormatTimeMSSF(Time); | |
105 | + public string GradeName { get; private set; } | |
73 | 106 | |
74 | - public string FutanFormatted => FormatHelper.ToNumber(Futan, 3, 1); | |
107 | + public string TurfDirtName { get; private set; } | |
75 | 108 | |
76 | - public string TsukaJyuni => FormatHelper.FormatTsukaJyuni(this); | |
109 | + public string CourseName { get; private set; } | |
110 | + | |
111 | + public string TosuFormatted { get; private set; } | |
112 | + | |
113 | + public string BabaJyotaiFormatted { get; private set; } | |
114 | + | |
115 | + public string NinkiFormatted { get; private set; } | |
116 | + | |
117 | + public string TsukaJyuni { get; private set; } | |
118 | + | |
119 | + public string KakuteiJyuniFormatted { get; private set; } | |
120 | + | |
121 | + public string Kimete { get; private set; } | |
122 | + | |
123 | + public string BataijyuFormatted { get; private set; } | |
124 | + | |
125 | + public string PCIRatioFormatted { get; private set; } | |
126 | + | |
127 | + public string HaronTimeL3Formatted { get; private set; } | |
128 | + | |
129 | + public string AvgHaronTimeMinus3Formatted { get; private set; } | |
130 | + | |
131 | + public string PCIFormatted { get; private set; } | |
132 | + | |
133 | + public string HaronTimeL3DevFormatted { get; private set; } | |
134 | + | |
135 | + public string AvgHaronTimeMinus3DevFormatted { get; private set; } | |
136 | + | |
137 | + public string TimeFormatted { get; private set; } | |
138 | + | |
139 | + public string FutanFormatted { get; private set; } | |
77 | 140 | |
78 | 141 | public long? StatCnt => Stat?.Cnt; |
79 | 142 | |
80 | 143 | public string StatOriginDate => Stat?.Kaishudate; |
81 | 144 | |
82 | - public string StatPCIFormatted => FormatHelper.FormatPCI(Stat?.TimeAvg?.ToString("###"), Stat?.Harontimel3Avg?.ToString("###"), Race?.Kyori, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
145 | + public string StatPCIFormatted { get; private set; } | |
146 | + | |
147 | + public string StatHaronTimeL3Formatted { get; private set; } | |
83 | 148 | |
84 | - public string StatHaronTimeL3Formatted => FormatHelper.FormatTimeSSF(Stat?.Harontimel3Avg?.ToString("###")); | |
149 | + public string StatAvgHaronTimeMinus3Formatted { get; private set; } | |
85 | 150 | |
86 | - public string StatAvgHaronTimeMinus3Formatted => FormatHelper.FormatTimeSSF(Stat?.Avgharontimeminus3Avg?.ToString("###")); | |
87 | 151 | } |
88 | 152 | } |
@@ -23,6 +23,8 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
23 | 23 | |
24 | 24 | Wakuban = "仮"; |
25 | 25 | Umaban = umaban.ToString("00"); |
26 | + | |
27 | + InitProperties(); | |
26 | 28 | } |
27 | 29 | |
28 | 30 | public UmaSummaryRowDto(TokuUmaInfo uma) |
@@ -36,6 +38,8 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
36 | 38 | { |
37 | 39 | BeanHelper.Copy(this, uma.Uma, true); |
38 | 40 | } |
41 | + | |
42 | + InitProperties(); | |
39 | 43 | } |
40 | 44 | |
41 | 45 | public UmaSummaryRowDto(UmaRaceWithUmaInfo uma) |
@@ -45,96 +49,109 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
45 | 49 | { |
46 | 50 | BeanHelper.Copy(this, uma.Uma, true); |
47 | 51 | } |
52 | + | |
53 | + InitProperties(); | |
48 | 54 | } |
49 | 55 | |
50 | - public string Wakuban { get; set; } | |
56 | + private void InitProperties() | |
57 | + { | |
58 | + WakubanFormatted = FormatHelper.SuppressZeroLeading(Wakuban); | |
51 | 59 | |
52 | - public string WakubanFormatted => FormatHelper.SuppressZeroLeading(Wakuban); | |
60 | + UmabanFormatted = FormatHelper.SuppressZeroLeading(Umaban); | |
53 | 61 | |
54 | - public string Umaban { get; set; } | |
62 | + SexAge = FormatHelper.FormatSexAge(Sexcd, Birthdate); | |
63 | + } | |
55 | 64 | |
56 | - public string UmabanFormatted => FormatHelper.SuppressZeroLeading(Umaban); | |
65 | + public void LoadUmaRaceList(UmaRaceRowDto konso, UmaRaceRowDto zenso, UmaRaceRowDto nisoMae) | |
66 | + { | |
67 | + Konso = konso; | |
68 | + Zenso = zenso; | |
69 | + NisoMae = nisoMae; | |
57 | 70 | |
58 | - public string SenSuu { get; set; } | |
71 | + if (Konso?.Chichi != null) | |
72 | + { | |
73 | + Chichi = Konso.Chichi; | |
74 | + } | |
59 | 75 | |
60 | - public string SexAge => FormatHelper.FormatSexAge(Sexcd, Birthdate); | |
76 | + if (Zenso?.Chichi != null) | |
77 | + { | |
78 | + Chichi = Zenso.Chichi; | |
79 | + } | |
61 | 80 | |
62 | - public NHansyoku Chichi | |
63 | - { | |
64 | - get | |
81 | + if (Konso?.HahaChichi != null) | |
65 | 82 | { |
66 | - if (Konso?.Chichi != null) | |
67 | - { | |
68 | - return Konso.Chichi; | |
69 | - } | |
70 | - if (Zenso?.Chichi != null) | |
71 | - { | |
72 | - return Zenso.Chichi; | |
73 | - } | |
83 | + HahaChichi = Konso.HahaChichi; | |
84 | + } | |
85 | + if (Zenso?.HahaChichi != null) | |
86 | + { | |
87 | + HahaChichi = Zenso.HahaChichi; | |
88 | + } | |
74 | 89 | |
75 | - return null; | |
90 | + if (!string.IsNullOrEmpty(Konso?.Bataijyu) && (Konso.Bataijyu != "0000")) | |
91 | + { | |
92 | + BataijyuFormatted = Konso.BataijyuFormatted; | |
76 | 93 | } |
77 | - } | |
78 | 94 | |
79 | - public NHansyoku HahaChichi | |
80 | - { | |
81 | - get | |
95 | + if (!string.IsNullOrEmpty(Zenso?.Bataijyu)) | |
82 | 96 | { |
83 | - if (Konso?.HahaChichi != null) | |
97 | + if (string.IsNullOrEmpty(Konso?.Bataijyu) || (Konso?.Bataijyu == "0000")) | |
84 | 98 | { |
85 | - return Konso.HahaChichi; | |
86 | - } | |
87 | - if (Zenso?.HahaChichi != null) | |
88 | - { | |
89 | - return Zenso.HahaChichi; | |
99 | + Konso.Bataijyu = Zenso.Bataijyu; | |
100 | + Konso.Zogensa = null; | |
101 | + BataijyuFormatted = Konso.Bataijyu; | |
90 | 102 | } |
91 | 103 | |
92 | - return null; | |
104 | + BataijyuFormatted = Zenso.BataijyuFormatted; | |
93 | 105 | } |
94 | - } | |
95 | 106 | |
96 | - public string BataijyuFormatted | |
97 | - { | |
98 | - get | |
99 | - { | |
100 | - if (!string.IsNullOrEmpty(Konso?.Bataijyu) && (Konso.Bataijyu != "0000")) | |
101 | - { | |
102 | - return Konso.BataijyuFormatted; | |
103 | - } | |
107 | + KonsoKankaku = FormatHelper.ToWeekSpan(Konso?.Year, Konso?.Monthday, Zenso?.Year, Zenso?.Monthday); | |
104 | 108 | |
105 | - if (!string.IsNullOrEmpty(Zenso?.Bataijyu)) | |
106 | - { | |
107 | - if ( string.IsNullOrEmpty(Konso?.Bataijyu) || (Konso?.Bataijyu == "0000") ) | |
108 | - { | |
109 | - Konso.Bataijyu = Zenso.Bataijyu; | |
110 | - Konso.Zogensa = null; | |
111 | - return Konso.Bataijyu; | |
112 | - } | |
113 | - | |
114 | - return Zenso.BataijyuFormatted; | |
115 | - } | |
109 | + KonsoLongerFlag = FormatHelper.ToLongerFlag(Konso?.Race?.Kyori, Zenso?.Race?.Kyori); | |
116 | 110 | |
117 | - return String.Empty; | |
118 | - } | |
111 | + KonsoShorterFlag = FormatHelper.ToShorterFlag(Konso?.Race?.Kyori, Zenso?.Race?.Kyori); | |
112 | + | |
113 | + ZensoKankaku = FormatHelper.ToWeekSpan(Zenso?.Year, Zenso?.Monthday, NisoMae?.Year, NisoMae?.Monthday); | |
114 | + | |
115 | + ZensoLongerFlag = FormatHelper.ToLongerFlag(Zenso?.Race?.Kyori, NisoMae?.Race?.Kyori); | |
116 | + | |
117 | + ZensoShorterFlag = FormatHelper.ToShorterFlag(Zenso?.Race?.Kyori, NisoMae?.Race?.Kyori); | |
119 | 118 | } |
120 | 119 | |
121 | - public string KonsoKankaku => FormatHelper.ToWeekSpan(Konso?.Year, Konso?.Monthday, Zenso?.Year, Zenso?.Monthday); | |
120 | + public string Wakuban { get; set; } | |
121 | + | |
122 | + public string WakubanFormatted { get; private set; } | |
123 | + | |
124 | + public string Umaban { get; set; } | |
125 | + | |
126 | + public string UmabanFormatted { get; private set; } | |
127 | + | |
128 | + public string SenSuu { get; set; } | |
129 | + | |
130 | + public string SexAge { get; private set; } | |
131 | + | |
132 | + public NHansyoku Chichi { get; private set; } | |
133 | + | |
134 | + public NHansyoku HahaChichi { get; private set; } | |
135 | + | |
136 | + public string BataijyuFormatted { get; private set; } | |
137 | + | |
138 | + public string KonsoKankaku { get; private set; } | |
122 | 139 | |
123 | - public string KonsoLongerFlag => FormatHelper.ToLongerFlag(Konso?.Race?.Kyori, Zenso?.Race?.Kyori); | |
140 | + public string KonsoLongerFlag { get; private set; } | |
124 | 141 | |
125 | - public string KonsoShorterFlag => FormatHelper.ToShorterFlag(Konso?.Race?.Kyori, Zenso?.Race?.Kyori); | |
142 | + public string KonsoShorterFlag { get; private set; } | |
126 | 143 | |
127 | - public string ZensoKankaku => FormatHelper.ToWeekSpan(Zenso?.Year, Zenso?.Monthday, NisoMae?.Year, NisoMae?.Monthday); | |
144 | + public string ZensoKankaku { get; private set; } | |
128 | 145 | |
129 | - public string ZensoLongerFlag => FormatHelper.ToLongerFlag(Zenso?.Race?.Kyori, NisoMae?.Race?.Kyori); | |
146 | + public string ZensoLongerFlag { get; private set; } | |
130 | 147 | |
131 | - public string ZensoShorterFlag => FormatHelper.ToShorterFlag(Zenso?.Race?.Kyori, NisoMae?.Race?.Kyori); | |
148 | + public string ZensoShorterFlag { get; private set; } | |
132 | 149 | |
133 | - public UmaRaceRowDto Konso { get; set; } | |
150 | + public UmaRaceRowDto Konso { get; private set; } | |
134 | 151 | |
135 | - public UmaRaceRowDto Zenso { get; set; } | |
152 | + public UmaRaceRowDto Zenso { get; private set; } | |
136 | 153 | |
137 | - public UmaRaceRowDto NisoMae { get; set; } | |
154 | + public UmaRaceRowDto NisoMae { get; private set; } | |
138 | 155 | |
139 | 156 | public ChakudosuuByKyoriAndGradeRowDto Short { get; set; } = new ChakudosuuByKyoriAndGradeRowDto(); |
140 | 157 | public ChakudosuuByKyoriAndGradeRowDto Mile { get; set; } = new ChakudosuuByKyoriAndGradeRowDto(); |
@@ -65,9 +65,11 @@ namespace UmaTest.App.Gateway.Presenter | ||
65 | 65 | IList<UmaRaceRowDto> umaRaceList = CreateUmaRaceRowsAndAddMap(kettoNum, res.Races); |
66 | 66 | |
67 | 67 | // FIXME |
68 | - summaryDto.Zenso = umaRaceList.Count > 0 ? umaRaceList[0] : null; | |
69 | - summaryDto.NisoMae = umaRaceList.Count > 1 ? umaRaceList[1] : null; | |
70 | - summaryDto.Konso = new UmaRaceRowDto(kettoNum, summaryDto?.Zenso.Bataijyu); | |
68 | + UmaRaceRowDto zenso = umaRaceList.Count > 0 ? umaRaceList[0] : null; | |
69 | + UmaRaceRowDto nisoMae = umaRaceList.Count > 1 ? umaRaceList[1] : null; | |
70 | + UmaRaceRowDto konso = new UmaRaceRowDto(kettoNum, zenso?.Bataijyu); | |
71 | + | |
72 | + summaryDto.LoadUmaRaceList(konso, zenso, nisoMae); | |
71 | 73 | |
72 | 74 | summaryDto.SenSuu = umaRaceList.Count.ToString(); |
73 | 75 | } |
@@ -51,9 +51,11 @@ namespace UmaTest.App.Gateway.Presenter | ||
51 | 51 | IList<UmaRaceRowDto> umaRaceList = CreateUmaRaceRowsAndAddMap(kettoNum, res.Races); |
52 | 52 | |
53 | 53 | // FIXME |
54 | - summaryDto.Konso = umaRaceList.Count > 0 ? umaRaceList[0] : null; | |
55 | - summaryDto.Zenso = umaRaceList.Count > 1 ? umaRaceList[1] : null; | |
56 | - summaryDto.NisoMae = umaRaceList.Count > 2 ? umaRaceList[2] : null; | |
54 | + UmaRaceRowDto konso = umaRaceList.Count > 0 ? umaRaceList[0] : null; | |
55 | + UmaRaceRowDto zenso = umaRaceList.Count > 1 ? umaRaceList[1] : null; | |
56 | + UmaRaceRowDto nisoMae = umaRaceList.Count > 2 ? umaRaceList[2] : null; | |
57 | + | |
58 | + summaryDto.LoadUmaRaceList(konso, zenso, nisoMae); | |
57 | 59 | |
58 | 60 | summaryDto.SenSuu = umaRaceList.Count.ToString(); |
59 | 61 | } |
@@ -49,10 +49,11 @@ namespace UmaTest.App.Gateway.Presenter | ||
49 | 49 | IList<UmaRaceRowDto> umaRaceList = CreateUmaRaceRowsAndAddMap(kettoNum, res.Races); |
50 | 50 | |
51 | 51 | // FIXME |
52 | - summaryDto.Zenso = umaRaceList.Count > 0 ? umaRaceList[0] : null; | |
53 | - summaryDto.NisoMae = umaRaceList.Count > 1 ? umaRaceList[1] : null; | |
54 | - summaryDto.Konso = new UmaRaceRowDto(req.Race, kettoNum, summaryDto?.Zenso.Bataijyu); | |
52 | + UmaRaceRowDto zenso = umaRaceList.Count > 0 ? umaRaceList[0] : null; | |
53 | + UmaRaceRowDto nisoMae = umaRaceList.Count > 1 ? umaRaceList[1] : null; | |
54 | + UmaRaceRowDto konso = new UmaRaceRowDto(req.Race, kettoNum, summaryDto?.Zenso.Bataijyu); | |
55 | 55 | |
56 | + summaryDto.LoadUmaRaceList(konso, zenso, nisoMae); | |
56 | 57 | summaryDto.SenSuu = umaRaceList.Count.ToString(); |
57 | 58 | } |
58 | 59 |
@@ -233,8 +233,8 @@ namespace UmaTest.App.Presentation.View | ||
233 | 233 | }, |
234 | 234 | new DataGridViewTextBoxColumn |
235 | 235 | { |
236 | - DataPropertyName = "Zenso.PCIFormatted", | |
237 | - Name = "前走ペース変化", | |
236 | + DataPropertyName = "Zenso.PCIRatioFormatted", | |
237 | + Name = "前走ペース変化指数", | |
238 | 238 | }, |
239 | 239 | new DataGridViewTextBoxColumn |
240 | 240 | { |
@@ -318,8 +318,8 @@ namespace UmaTest.App.Presentation.View | ||
318 | 318 | }, |
319 | 319 | new DataGridViewTextBoxColumn |
320 | 320 | { |
321 | - DataPropertyName = "NisoMae.PCIFormatted", | |
322 | - Name = "前々走ペース変化", | |
321 | + DataPropertyName = "NisoMae.PCIRatioFormatted", | |
322 | + Name = "前々走ペース変化指数", | |
323 | 323 | }, |
324 | 324 | new DataGridViewTextBoxColumn |
325 | 325 | { |
@@ -496,7 +496,7 @@ namespace UmaTest.App.Presentation.View | ||
496 | 496 | dataGridView1.Columns["前走通過順位"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
497 | 497 | dataGridView1.Columns["前走着順"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
498 | 498 | dataGridView1.Columns["前走決手"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; |
499 | - dataGridView1.Columns["前走ペース変化"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; | |
499 | + dataGridView1.Columns["前走ペース変化指数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; | |
500 | 500 | dataGridView1.Columns["前走平均-3F ペース"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
501 | 501 | dataGridView1.Columns["前走上3F指数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
502 | 502 | dataGridView1.Columns["前走間隔"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
@@ -507,7 +507,7 @@ namespace UmaTest.App.Presentation.View | ||
507 | 507 | dataGridView1.Columns["前々走通過順位"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
508 | 508 | dataGridView1.Columns["前々走着順"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
509 | 509 | dataGridView1.Columns["前々走決手"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; |
510 | - dataGridView1.Columns["前々走ペース変化"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; | |
510 | + dataGridView1.Columns["前々走ペース変化指数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; | |
511 | 511 | dataGridView1.Columns["前々走平均-3F ペース"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
512 | 512 | dataGridView1.Columns["前々走上3F指数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
513 | 513 |
@@ -617,8 +617,8 @@ namespace UmaTest.App.Presentation.View | ||
617 | 617 | }, |
618 | 618 | new DataGridViewTextBoxColumn |
619 | 619 | { |
620 | - DataPropertyName = "PCIFormatted", | |
621 | - Name = "ペース変化", | |
620 | + DataPropertyName = "PCIRatioFormatted", | |
621 | + Name = "ペース変化指数", | |
622 | 622 | }, |
623 | 623 | new DataGridViewTextBoxColumn |
624 | 624 | { |
@@ -632,6 +632,11 @@ namespace UmaTest.App.Presentation.View | ||
632 | 632 | }, |
633 | 633 | new DataGridViewTextBoxColumn |
634 | 634 | { |
635 | + DataPropertyName = "PCIFormatted", | |
636 | + Name = "ペース変化", | |
637 | + }, | |
638 | + new DataGridViewTextBoxColumn | |
639 | + { | |
635 | 640 | DataPropertyName = "AvgHaronTimeMinus3Formatted", |
636 | 641 | Name = "平均-3F", |
637 | 642 | }, |
@@ -698,6 +703,7 @@ namespace UmaTest.App.Presentation.View | ||
698 | 703 | dataGridView2.Columns["着順"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
699 | 704 | dataGridView2.Columns["通過順位"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
700 | 705 | dataGridView2.Columns["統計件数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
706 | + dataGridView2.Columns["ペース変化指数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; | |
701 | 707 | dataGridView2.Columns["ペース変化"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
702 | 708 | dataGridView2.Columns["平均-3F ペース"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
703 | 709 | dataGridView2.Columns["上3F指数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
@@ -23,6 +23,22 @@ namespace UmaTest.Infra.Helper | ||
23 | 23 | |
24 | 24 | public static readonly string KYAKUSITU_KUBUN = "9201"; |
25 | 25 | |
26 | + public const string TRACK_NAME_TURF_AND_DIRT = "芝ダ"; | |
27 | + public const string TRACK_NAME_TURF = "芝"; | |
28 | + public const string TRACK_NAME_DIRT = "ダ"; | |
29 | + public const string TRACK_NAME_SAND = "砂"; | |
30 | + public const string TRACK_NAME_HURDLE = "障"; | |
31 | + | |
32 | + public static readonly string RACE_CLASS_NEWCOMER = "新"; | |
33 | + public static readonly string RACE_CLASS_MAIDEN = "未"; | |
34 | + public static readonly string RACE_CLASS_OPEN = "OP"; | |
35 | + public static readonly string RACE_CLASS_ONE_WIN = "1勝"; | |
36 | + public static readonly string RACE_CLASS_TWO_WINS = "2勝"; | |
37 | + public static readonly string RACE_CLASS_THREE_WINS = "3勝"; | |
38 | + | |
39 | + private const string NODATA = "-"; | |
40 | + private const string NA = "NA"; | |
41 | + private const string UNKNOWN = "?"; | |
26 | 42 | private const string ERROR_VALUE = "#ERROR"; |
27 | 43 | |
28 | 44 | private static CodeHelper me = null; |
@@ -113,35 +129,35 @@ namespace UmaTest.Infra.Helper | ||
113 | 129 | { |
114 | 130 | case "701": |
115 | 131 | case "702": |
116 | - return "新"; | |
132 | + return RACE_CLASS_NEWCOMER; | |
117 | 133 | case "703": |
118 | - return "未"; | |
134 | + return RACE_CLASS_MAIDEN; | |
119 | 135 | case "999": |
120 | - return "OP"; | |
136 | + return RACE_CLASS_OPEN; | |
121 | 137 | default: |
122 | 138 | break; |
123 | 139 | } |
124 | 140 | |
125 | 141 | if (!int.TryParse(jyokenCd, out int winClass)) |
126 | 142 | { |
127 | - return "-"; | |
143 | + return NA; | |
128 | 144 | } |
129 | 145 | |
130 | 146 | if (winClass <= 5) |
131 | 147 | { |
132 | - return "1勝"; | |
148 | + return RACE_CLASS_ONE_WIN; | |
133 | 149 | } |
134 | 150 | else if (winClass <= 10) |
135 | 151 | { |
136 | - return "2勝"; | |
152 | + return RACE_CLASS_TWO_WINS; | |
137 | 153 | } |
138 | 154 | else if (winClass <= 16) |
139 | 155 | { |
140 | - return "3勝"; | |
156 | + return RACE_CLASS_THREE_WINS; | |
141 | 157 | } |
142 | 158 | else |
143 | 159 | { |
144 | - return "OP"; | |
160 | + return RACE_CLASS_OPEN; | |
145 | 161 | } |
146 | 162 | } |
147 | 163 |
@@ -155,8 +171,8 @@ namespace UmaTest.Infra.Helper | ||
155 | 171 | } |
156 | 172 | else |
157 | 173 | { |
158 | - string turfDartKbn = (trackCd != "52") ? ExtractTurfDartName(trackEngName) : "芝ダ"; | |
159 | - return "障" + turfDartKbn; | |
174 | + string turfDartKbn = (trackCd != "52") ? ExtractTurfDartName(trackEngName) : TRACK_NAME_TURF_AND_DIRT; | |
175 | + return TRACK_NAME_HURDLE + turfDartKbn; | |
160 | 176 | } |
161 | 177 | } |
162 | 178 |
@@ -171,16 +187,16 @@ namespace UmaTest.Infra.Helper | ||
171 | 187 | switch (trackEngName.Substring(0, 1)) |
172 | 188 | { |
173 | 189 | case "T": |
174 | - turfDartKbn = "芝"; | |
190 | + turfDartKbn = TRACK_NAME_TURF; | |
175 | 191 | break; |
176 | 192 | case "D": |
177 | - turfDartKbn = "ダ"; | |
193 | + turfDartKbn = TRACK_NAME_DIRT; | |
178 | 194 | break; |
179 | 195 | case "S": |
180 | - turfDartKbn = "砂"; | |
196 | + turfDartKbn = TRACK_NAME_SAND; | |
181 | 197 | break; |
182 | 198 | default: |
183 | - turfDartKbn = "?"; | |
199 | + turfDartKbn = UNKNOWN; | |
184 | 200 | break; |
185 | 201 | } |
186 | 202 |
@@ -248,7 +264,7 @@ namespace UmaTest.Infra.Helper | ||
248 | 264 | |
249 | 265 | var kyakusituKbn = new Dictionary<string, string[]>(); |
250 | 266 | master.Add(KYAKUSITU_KUBUN, kyakusituKbn); |
251 | - kyakusituKbn.Add("0", new string[] { "-" }); | |
267 | + kyakusituKbn.Add("0", new string[] { NODATA }); | |
252 | 268 | kyakusituKbn.Add("1", new string[] { "逃げ" }); |
253 | 269 | kyakusituKbn.Add("2", new string[] { "先行" }); |
254 | 270 | kyakusituKbn.Add("3", new string[] { "差し" }); |
@@ -10,6 +10,18 @@ namespace UmaTest.Infra.Helper | ||
10 | 10 | { |
11 | 11 | internal class FormatHelper |
12 | 12 | { |
13 | + public const string NA = "NA"; | |
14 | + | |
15 | + public const string NODATA = "-"; | |
16 | + | |
17 | + public const string INIT_DATA_00 = "00"; | |
18 | + | |
19 | + public const string INIT_DATA_000 = "000"; | |
20 | + | |
21 | + public const string INIT_DATA_0000 = "0000"; | |
22 | + | |
23 | + public const string INVALID_DATA_999 = "999"; | |
24 | + | |
13 | 25 | public static string FormatYearMonthDay(string year, string monthDay) |
14 | 26 | { |
15 | 27 | return !string.IsNullOrEmpty(year) && !string.IsNullOrEmpty(monthDay) && monthDay.Length == 4 |
@@ -53,7 +65,7 @@ namespace UmaTest.Infra.Helper | ||
53 | 65 | if (!TryParseYYYYMMDD(toYMD, out DateTime toDate) |
54 | 66 | || !TryParseYYYYMMDD(fromYMD, out DateTime fromDate)) |
55 | 67 | { |
56 | - return "NA"; | |
68 | + return NA; | |
57 | 69 | } |
58 | 70 | |
59 | 71 | return (toDate.Subtract(fromDate).Days / 7).ToString(); |
@@ -66,9 +78,9 @@ namespace UmaTest.Infra.Helper | ||
66 | 78 | |
67 | 79 | public static string FormatBataijyu(string bataijyu, string zogenfugo, string zogensa) |
68 | 80 | { |
69 | - if ( string.IsNullOrEmpty(bataijyu) || (bataijyu == "000") || (bataijyu == "999")) | |
81 | + if (string.IsNullOrEmpty(bataijyu) || (bataijyu == INIT_DATA_000) || (bataijyu == INVALID_DATA_999)) | |
70 | 82 | { |
71 | - return "-"; | |
83 | + return NODATA; | |
72 | 84 | } |
73 | 85 | |
74 | 86 | if (string.IsNullOrEmpty(zogensa)) |
@@ -104,60 +116,87 @@ namespace UmaTest.Infra.Helper | ||
104 | 116 | return ToLongerFlag(kyori2, kyori1); |
105 | 117 | } |
106 | 118 | |
119 | + public static string FormatTimeSSF(decimal? time3) | |
120 | + { | |
121 | + return FormatTimeMSSF(time3?.ToString("###")); | |
122 | + } | |
123 | + | |
107 | 124 | public static string FormatTimeSSF(string time3) |
108 | 125 | { |
109 | 126 | return time3?.Length == 3 |
110 | - ? time3 != "000" && time3 != "999" | |
127 | + ? time3 != INIT_DATA_000 && time3 != INVALID_DATA_999 | |
111 | 128 | ? $"{time3.Substring(0, 2)}.{time3.Substring(2, 1)}" |
112 | - : "-" | |
129 | + : NODATA | |
113 | 130 | : time3; |
114 | 131 | } |
115 | 132 | |
116 | 133 | public static string FormatTimeMSSF(string time4) |
117 | 134 | { |
118 | 135 | return time4?.Length == 4 |
119 | - ? time4 != "0000" | |
136 | + ? time4 != INIT_DATA_0000 | |
120 | 137 | ? $"{time4.Substring(0, 1)}:{time4.Substring(1, 2)}.{time4.Substring(3, 1)}" |
121 | - : "-" | |
138 | + : NODATA | |
122 | 139 | : time4; |
123 | 140 | } |
124 | 141 | |
125 | 142 | public static string FormatTimeHHMM(string time4) |
126 | 143 | { |
127 | 144 | return time4?.Length == 4 |
128 | - ? time4 != "0000" | |
145 | + ? time4 != INIT_DATA_0000 | |
129 | 146 | ? $"{time4.Substring(0, 2)}:{time4.Substring(2, 2)}" |
130 | - : "-" | |
147 | + : NODATA | |
131 | 148 | : time4; |
132 | 149 | } |
133 | 150 | |
134 | 151 | public static string FormatHaronTimeL3Dev(string haronTimeL3, decimal? avgHaronTimeL3, decimal? stdDevHaronTimeL3) |
135 | 152 | { |
136 | - if ( string.IsNullOrEmpty(haronTimeL3) || !avgHaronTimeL3.HasValue || !stdDevHaronTimeL3.HasValue ) | |
153 | + if (haronTimeL3 == INIT_DATA_000 || haronTimeL3 == INVALID_DATA_999) | |
154 | + { | |
155 | + return NODATA; | |
156 | + } | |
157 | + | |
158 | + if (int.TryParse(haronTimeL3, out int nHaronTimeL3)) | |
159 | + { | |
160 | + return FormatHaronTimeL3Dev(nHaronTimeL3, avgHaronTimeL3, stdDevHaronTimeL3); | |
161 | + } | |
162 | + | |
163 | + return NA; | |
164 | + } | |
165 | + | |
166 | + public static string FormatHaronTimeL3Dev(int? haronTimeL3, decimal? avgHaronTimeL3, decimal? stdDevHaronTimeL3) | |
167 | + { | |
168 | + if (!haronTimeL3.HasValue || !avgHaronTimeL3.HasValue || !stdDevHaronTimeL3.HasValue) | |
137 | 169 | { |
138 | 170 | return string.Empty; |
139 | 171 | } |
140 | 172 | |
141 | - if (haronTimeL3 == "000" || haronTimeL3 == "999") | |
173 | + if (haronTimeL3 == -1) | |
142 | 174 | { |
143 | - return "-"; | |
175 | + return NODATA; | |
144 | 176 | } |
145 | 177 | |
146 | 178 | try |
147 | 179 | { |
148 | - // unit: 10[msec.] | |
149 | - int nHaronTimeL3 = int.Parse(haronTimeL3); | |
150 | - | |
151 | - // unit: 1[sec.] | |
152 | - decimal dev = (avgHaronTimeL3.Value - nHaronTimeL3) * 20 / stdDevHaronTimeL3.Value + 80; | |
180 | + decimal dev = CalcScoreByStdDevReverse(haronTimeL3.Value, avgHaronTimeL3.Value, stdDevHaronTimeL3.Value, 80, 20); | |
153 | 181 | |
154 | 182 | return Math.Round(dev, 1, MidpointRounding.AwayFromZero).ToString("#0.0"); |
155 | 183 | } |
156 | 184 | catch (Exception) |
157 | 185 | { |
158 | - return "NA"; | |
186 | + return NA; | |
159 | 187 | } |
160 | 188 | } |
189 | + | |
190 | + public static decimal CalcScoreByStdDevReverse(decimal value, decimal average, decimal stdDev, int scoreOrigin, int oneSigmaRange) | |
191 | + { | |
192 | + return CalcScoreByStdDev(average, value, stdDev, scoreOrigin, oneSigmaRange); | |
193 | + } | |
194 | + | |
195 | + public static decimal CalcScoreByStdDev(decimal value, decimal average, decimal stdDev, int scoreOrigin, int oneSigmaRange) | |
196 | + { | |
197 | + return (value - average) * oneSigmaRange / stdDev + scoreOrigin; | |
198 | + } | |
199 | + | |
161 | 200 | public static string FormatAvgHaronTimeMinus3(string time, string haronTimeL3, string kyori) |
162 | 201 | { |
163 | 202 | if (string.IsNullOrEmpty(time) || string.IsNullOrEmpty(haronTimeL3) || string.IsNullOrEmpty(kyori)) |
@@ -165,91 +204,155 @@ namespace UmaTest.Infra.Helper | ||
165 | 204 | return string.Empty; |
166 | 205 | } |
167 | 206 | |
168 | - if (time == "0000" || haronTimeL3 == "000" || haronTimeL3 == "999") | |
207 | + if (time == INIT_DATA_0000 || haronTimeL3 == INIT_DATA_000 || haronTimeL3 == INVALID_DATA_999) | |
169 | 208 | { |
170 | - return "-"; | |
209 | + return NODATA; | |
171 | 210 | } |
172 | 211 | |
173 | 212 | try |
174 | 213 | { |
175 | - // unit: 1[sec.] | |
176 | - decimal avgHaronTime3 = CalcAvgHaronMinus3Time(time, haronTimeL3, kyori, 10); | |
214 | + // unit: 100[msec.] | |
215 | + int nTime = int.Parse(time.Substring(0, 1)) * 600 + int.Parse(time.Substring(1, 3)); | |
216 | + int nHaronTimeL3 = int.Parse(haronTimeL3); | |
217 | + | |
218 | + int nKyori = int.Parse(kyori); | |
177 | 219 | |
178 | - return Math.Round(avgHaronTime3, 2, MidpointRounding.AwayFromZero).ToString("0.00"); | |
220 | + return FormatAvgHaronTimeMinus3(nTime, nHaronTimeL3, nKyori); | |
179 | 221 | } |
180 | 222 | catch (Exception) |
181 | 223 | { |
182 | - return "NA"; | |
224 | + return NA; | |
183 | 225 | } |
184 | 226 | } |
185 | 227 | |
228 | + public static string FormatAvgHaronTimeMinus3(int time, int haronTimeL3, int kyori) | |
229 | + { | |
230 | + if (time == -1 || haronTimeL3 == -1) | |
231 | + { | |
232 | + return NODATA; | |
233 | + } | |
234 | + | |
235 | + // unit: 1[sec.] | |
236 | + decimal avgHaronTime3 = CalcAvgHaronTimeMinus3(time, haronTimeL3, kyori, 10); | |
237 | + | |
238 | + return Math.Round(avgHaronTime3, 2, MidpointRounding.AwayFromZero).ToString("0.00"); | |
239 | + } | |
240 | + | |
186 | 241 | public static string FormatAvgHaronTimeMinus3Dev(string time, string haronTimeL3, string kyori, decimal? avgAvgHaronTimeMinus3F, decimal? stdDevtAvgHaronTimeMinus3) |
187 | 242 | { |
188 | - if (string.IsNullOrEmpty(time) || string.IsNullOrEmpty(haronTimeL3) || string.IsNullOrEmpty(kyori) || !avgAvgHaronTimeMinus3F.HasValue || !stdDevtAvgHaronTimeMinus3.HasValue) | |
243 | + if (string.IsNullOrEmpty(time) || string.IsNullOrEmpty(haronTimeL3) || string.IsNullOrEmpty(kyori) | |
244 | + || !avgAvgHaronTimeMinus3F.HasValue || !stdDevtAvgHaronTimeMinus3.HasValue) | |
189 | 245 | { |
190 | 246 | return string.Empty; |
191 | 247 | } |
192 | 248 | |
193 | - if (time == "0000" || haronTimeL3 == "000" || haronTimeL3 == "999") | |
249 | + if (time == INIT_DATA_0000 || haronTimeL3 == INIT_DATA_000 || haronTimeL3 == INVALID_DATA_999) | |
194 | 250 | { |
195 | - return "-"; | |
251 | + return NODATA; | |
196 | 252 | } |
197 | 253 | |
198 | 254 | try |
199 | 255 | { |
200 | 256 | // unit: 100[msec.] |
201 | - decimal avgHaronTime3 = CalcAvgHaronMinus3Time(time, haronTimeL3, kyori, 1); | |
257 | + int nTime = int.Parse(time.Substring(0, 1)) * 600 + int.Parse(time.Substring(1, 3)); | |
258 | + int nHaronTimeL3 = int.Parse(haronTimeL3); | |
202 | 259 | |
203 | - decimal dev = (avgAvgHaronTimeMinus3F.Value - avgHaronTime3) * 20 / stdDevtAvgHaronTimeMinus3.Value + 100; | |
260 | + int nKyori = int.Parse(kyori); | |
204 | 261 | |
205 | - return Math.Round(dev, 1, MidpointRounding.AwayFromZero).ToString("#0.0"); | |
262 | + return FormatAvgHaronTimeMinus3Dev(nTime, nHaronTimeL3, nKyori, avgAvgHaronTimeMinus3F, stdDevtAvgHaronTimeMinus3); | |
206 | 263 | } |
207 | 264 | catch (Exception) |
208 | 265 | { |
209 | - return "NA"; | |
266 | + return NA; | |
210 | 267 | } |
211 | 268 | } |
212 | 269 | |
213 | - public static string FormatPCI(string time, string haronTimeL3, string kyori, decimal? avgAvgHaronTimeMinus3F, decimal? stdDevtAvgHaronTimeMinus3) | |
270 | + public static string FormatAvgHaronTimeMinus3Dev(int time, int haronTimeL3, int kyori, decimal? avgAvgHaronTimeMinus3F, decimal? stdDevtAvgHaronTimeMinus3) | |
214 | 271 | { |
215 | - if (string.IsNullOrEmpty(time) || string.IsNullOrEmpty(haronTimeL3) || string.IsNullOrEmpty(kyori)) | |
272 | + if (time == -1 || haronTimeL3 == -1) | |
273 | + { | |
274 | + return NODATA; | |
275 | + } | |
276 | + | |
277 | + // unit: 100[msec.] | |
278 | + decimal avgHaronTime3 = CalcAvgHaronTimeMinus3(time, haronTimeL3, kyori, 1); | |
279 | + | |
280 | + decimal dev = CalcScoreByStdDevReverse(avgHaronTime3, avgAvgHaronTimeMinus3F.Value, stdDevtAvgHaronTimeMinus3.Value, 100, 20); | |
281 | + | |
282 | + return Math.Round(dev, 1, MidpointRounding.AwayFromZero).ToString("#0.0"); | |
283 | + } | |
284 | + | |
285 | + private static decimal CalcAvgHaronTimeMinus3(int time, int haronTimeL3, int kyori, int divider) | |
286 | + { | |
287 | + // unit: 1[sec.] / divider | |
288 | + return ((decimal)(time - haronTimeL3)) * (600 / divider) / (kyori - 600); | |
289 | + } | |
290 | + | |
291 | + public static string FormatPCI(string haronTimeL3, decimal? avgAvgHaronTimeMinus3F, decimal? stdDevtAvgHaronTimeMinus3) | |
292 | + { | |
293 | + if (string.IsNullOrEmpty(haronTimeL3)) | |
216 | 294 | { |
217 | 295 | return string.Empty; |
218 | 296 | } |
219 | 297 | |
220 | - if (time == "0000" || haronTimeL3 == "000" || haronTimeL3 == "999") | |
298 | + if (haronTimeL3 == INIT_DATA_000 || haronTimeL3 == INVALID_DATA_999) | |
221 | 299 | { |
222 | - return "-"; | |
300 | + return NODATA; | |
223 | 301 | } |
224 | 302 | |
225 | - try | |
303 | + if (int.TryParse(haronTimeL3, out int nHaronTimeL3)) | |
226 | 304 | { |
227 | - //// unit: 100[msec.] | |
228 | - //decimal avgHaronTime3 = CalcAvgHaronMinus3Time(time, haronTimeL3, kyori, 1); | |
229 | - //decimal nHaronTimeL3 = int.Parse(haronTimeL3); | |
305 | + return FormatPCI(nHaronTimeL3, avgAvgHaronTimeMinus3F, stdDevtAvgHaronTimeMinus3); | |
306 | + } | |
230 | 307 | |
231 | - //decimal pci = avgHaronTime3 / nHaronTimeL3 * 100 - 50; | |
232 | - decimal nHaronTimeL3 = int.Parse(haronTimeL3); | |
233 | - decimal pci = (avgAvgHaronTimeMinus3F.Value - nHaronTimeL3) * 5 / stdDevtAvgHaronTimeMinus3.Value + 100; | |
308 | + return NA; | |
309 | + } | |
234 | 310 | |
235 | - return Math.Round(pci, 1, MidpointRounding.ToEven).ToString("#0.0"); | |
311 | + public static string FormatPCI(decimal? haronTimeL3, decimal? avgAvgHaronTimeMinus3F, decimal? stdDevtAvgHaronTimeMinus3) | |
312 | + { | |
313 | + if (!haronTimeL3.HasValue || !avgAvgHaronTimeMinus3F.HasValue || !stdDevtAvgHaronTimeMinus3.HasValue) | |
314 | + { | |
315 | + return string.Empty; | |
236 | 316 | } |
237 | - catch (Exception) | |
317 | + | |
318 | + decimal pci = CalcScoreByStdDevReverse(haronTimeL3.Value, avgAvgHaronTimeMinus3F.Value, stdDevtAvgHaronTimeMinus3.Value, 100, 5); | |
319 | + | |
320 | + return Math.Round(pci, 1, MidpointRounding.ToEven).ToString("#0.0"); | |
321 | + } | |
322 | + | |
323 | + public static string FormatPCIRatio(string haronTimeL3, decimal? avgHaronTimeL3, decimal? avgAvgHaronTimeMinus3F, decimal? stdDevtAvgHaronTimeMinus3) | |
324 | + { | |
325 | + if (string.IsNullOrEmpty(haronTimeL3)) | |
238 | 326 | { |
239 | - return "NA"; | |
327 | + return string.Empty; | |
240 | 328 | } |
329 | + | |
330 | + if (haronTimeL3 == INIT_DATA_000 || haronTimeL3 == INVALID_DATA_999) | |
331 | + { | |
332 | + return NODATA; | |
333 | + } | |
334 | + | |
335 | + if (int.TryParse(haronTimeL3, out int nHaronTimeL3)) | |
336 | + { | |
337 | + return FormatPCIRatio(nHaronTimeL3, avgHaronTimeL3, avgAvgHaronTimeMinus3F, stdDevtAvgHaronTimeMinus3); | |
338 | + } | |
339 | + | |
340 | + return NA; | |
241 | 341 | } |
242 | 342 | |
243 | - private static decimal CalcAvgHaronMinus3Time(string time, string haronTimeL3, string kyori, int divider) | |
343 | + private static string FormatPCIRatio(decimal? haronTimeL3, decimal? avgHaronTimeL3, decimal? avgAvgHaronTimeMinus3F, decimal? stdDevtAvgHaronTimeMinus3) | |
244 | 344 | { |
245 | - // unit: 100[msec.] | |
246 | - decimal nTime = int.Parse(time.Substring(0, 1)) * 600 + int.Parse(time.Substring(1, 3)); | |
247 | - decimal nHaronTimeL3 = int.Parse(haronTimeL3); | |
345 | + if (!haronTimeL3.HasValue || !avgHaronTimeL3.HasValue || !avgAvgHaronTimeMinus3F.HasValue || !stdDevtAvgHaronTimeMinus3.HasValue) | |
346 | + { | |
347 | + return string.Empty; | |
348 | + } | |
248 | 349 | |
249 | - decimal nKyori = int.Parse(kyori); | |
350 | + decimal pci = CalcScoreByStdDevReverse(haronTimeL3.Value, avgAvgHaronTimeMinus3F.Value, stdDevtAvgHaronTimeMinus3.Value, 100, 5); | |
351 | + decimal statPci = CalcScoreByStdDevReverse(avgHaronTimeL3.Value, avgAvgHaronTimeMinus3F.Value, stdDevtAvgHaronTimeMinus3.Value, 100, 5); | |
250 | 352 | |
251 | - // unit: 1[sec.] / divider | |
252 | - return (nTime - nHaronTimeL3) * (600 / divider) / (nKyori - 600); | |
353 | + decimal pciRatio = pci * 100 / statPci; | |
354 | + | |
355 | + return Math.Round(pciRatio, 1, MidpointRounding.ToEven).ToString("#0.0"); | |
253 | 356 | } |
254 | 357 | |
255 | 358 | public static string FormatTsukaJyuni(NUmaRace umaRace) |
@@ -261,14 +364,14 @@ namespace UmaTest.Infra.Helper | ||
261 | 364 | |
262 | 365 | try |
263 | 366 | { |
264 | - string jyuni1c = !string.IsNullOrEmpty(umaRace.Jyuni1c) && umaRace.Jyuni1c != "00" ? int.Parse(umaRace.Jyuni1c).ToString("#0") + "-" : string.Empty; | |
265 | - string jyuni2c = !string.IsNullOrEmpty(umaRace.Jyuni2c) && umaRace.Jyuni2c != "00" ? int.Parse(umaRace.Jyuni2c).ToString("#0") + "-" : string.Empty; | |
266 | - string jyuni3c = !string.IsNullOrEmpty(umaRace.Jyuni3c) && umaRace.Jyuni3c != "00" ? int.Parse(umaRace.Jyuni3c).ToString("#0") + "-" : string.Empty; | |
267 | - string jyuni4c = !string.IsNullOrEmpty(umaRace.Jyuni4c) && umaRace.Jyuni4c != "00" ? int.Parse(umaRace.Jyuni4c).ToString("#0") : string.Empty; | |
367 | + string jyuni1c = !string.IsNullOrEmpty(umaRace.Jyuni1c) && umaRace.Jyuni1c != INIT_DATA_00 ? int.Parse(umaRace.Jyuni1c).ToString("#0") + NODATA : string.Empty; | |
368 | + string jyuni2c = !string.IsNullOrEmpty(umaRace.Jyuni2c) && umaRace.Jyuni2c != INIT_DATA_00 ? int.Parse(umaRace.Jyuni2c).ToString("#0") + NODATA : string.Empty; | |
369 | + string jyuni3c = !string.IsNullOrEmpty(umaRace.Jyuni3c) && umaRace.Jyuni3c != INIT_DATA_00 ? int.Parse(umaRace.Jyuni3c).ToString("#0") + NODATA : string.Empty; | |
370 | + string jyuni4c = !string.IsNullOrEmpty(umaRace.Jyuni4c) && umaRace.Jyuni4c != INIT_DATA_00 ? int.Parse(umaRace.Jyuni4c).ToString("#0") : string.Empty; | |
268 | 371 | |
269 | 372 | string tsukaJyuni = string.Format("{0,3}{1,3}{2,3}{3,2}", jyuni1c, jyuni2c, jyuni3c, jyuni4c); |
270 | 373 | |
271 | - return !string.IsNullOrWhiteSpace(tsukaJyuni) ? tsukaJyuni : "-"; | |
374 | + return !string.IsNullOrWhiteSpace(tsukaJyuni) ? tsukaJyuni : NODATA; | |
272 | 375 | } |
273 | 376 | catch (Exception) |
274 | 377 | { |
@@ -292,14 +395,14 @@ namespace UmaTest.Infra.Helper | ||
292 | 395 | { |
293 | 396 | if (suppressZero && (number == 0)) |
294 | 397 | { |
295 | - return "-"; | |
398 | + return NODATA; | |
296 | 399 | } |
297 | 400 | |
298 | 401 | return number.ToString(); |
299 | 402 | } |
300 | 403 | else |
301 | 404 | { |
302 | - return "NA"; | |
405 | + return NA; | |
303 | 406 | } |
304 | 407 | } |
305 | 408 |
@@ -335,7 +438,7 @@ namespace UmaTest.Infra.Helper | ||
335 | 438 | |
336 | 439 | if (!int.TryParse(value, out int number)) |
337 | 440 | { |
338 | - return "NA"; | |
441 | + return NA; | |
339 | 442 | } |
340 | 443 | |
341 | 444 | return Math.Round((number / pow10s[digits]), digits, MidpointRounding.AwayFromZero).ToString(digitFormats[digits]); |
@@ -345,7 +448,7 @@ namespace UmaTest.Infra.Helper | ||
345 | 448 | { |
346 | 449 | if (race == null) |
347 | 450 | { |
348 | - return "-"; | |
451 | + return NODATA; | |
349 | 452 | } |
350 | 453 | |
351 | 454 | string sibaJyotai = CodeHelper.GetInstance().GetName(CodeHelper.BABA_JYOTAI_CODE, race.Sibababacd, string.Empty); |
@@ -355,11 +458,11 @@ namespace UmaTest.Infra.Helper | ||
355 | 458 | |
356 | 459 | switch(turfDirtName) |
357 | 460 | { |
358 | - case "芝": | |
461 | + case CodeHelper.TRACK_NAME_TURF: | |
359 | 462 | return sibaJyotai; |
360 | - case "ダ": | |
463 | + case CodeHelper.TRACK_NAME_DIRT: | |
361 | 464 | return dirtJyotai; |
362 | - case "芝ダ": | |
465 | + case CodeHelper.TRACK_NAME_TURF_AND_DIRT: | |
363 | 466 | return !string.IsNullOrEmpty(sibaJyotai) && !string.IsNullOrEmpty(dirtJyotai) ? sibaJyotai + "・" + dirtJyotai : string.Empty; |
364 | 467 | } |
365 | 468 |
@@ -370,19 +473,19 @@ namespace UmaTest.Infra.Helper | ||
370 | 473 | { |
371 | 474 | if (race == null) |
372 | 475 | { |
373 | - return "-"; | |
476 | + return NODATA; | |
374 | 477 | } |
375 | 478 | |
376 | 479 | string syussoTosuu = SuppressZeroLeading(race?.Syussotosu); |
377 | 480 | |
378 | - if ( !string.IsNullOrEmpty(syussoTosuu) && (syussoTosuu != "-") ) | |
481 | + if ( !string.IsNullOrEmpty(syussoTosuu) && (syussoTosuu != NODATA) ) | |
379 | 482 | { |
380 | 483 | return syussoTosuu; |
381 | 484 | } |
382 | 485 | |
383 | 486 | string torokuTosuu = SuppressZeroLeading(race?.Torokutosu); |
384 | 487 | |
385 | - if ( !string.IsNullOrEmpty(torokuTosuu) && (torokuTosuu != "-") ) | |
488 | + if ( !string.IsNullOrEmpty(torokuTosuu) && (torokuTosuu != NODATA) ) | |
386 | 489 | { |
387 | 490 | return torokuTosuu; |
388 | 491 | } |