質問編集履歴

2

改善点

2019/04/01 05:01

投稿

widget11
widget11

スコア221

test CHANGED
File without changes
test CHANGED
@@ -125,3 +125,115 @@
125
125
  どのように対処すればよいでしょうか?
126
126
 
127
127
  よろしくお願い致します。
128
+
129
+
130
+
131
+ # 追記分
132
+
133
+
134
+
135
+ ```
136
+
137
+ int PageNumber = candidateFilterList.pageNumber * candidateFilterList.pageSize - candidateFilterList.pageSize ?? 0;
138
+
139
+ int PageSize = candidateFilterList.pageSize ?? 20;
140
+
141
+
142
+
143
+ /*追加分*/
144
+
145
+ var selectiontable = (from o in _base.phoenixDB.t_selection
146
+
147
+ group o by o.EntryId into g
148
+
149
+ orderby g.Key descending
150
+
151
+ from item in g
152
+
153
+ where item.EntryId == g.Max(x => x.EntryId)
154
+
155
+ select item).Skip(PageNumber).Take(PageSize);
156
+
157
+
158
+
159
+ //viewで仕様する全てのデータを取得
160
+
161
+ var fulltables = (from entry in _base.phoenixDB.t_entry
162
+
163
+ join selection in selectiontable /*selectiontableをjoin*/ on entry.EntryId equals selection.EntryId
164
+
165
+ join phases in _base.phoenixDB.m_phase on selection.PhaseId equals phases.PhaseId
166
+
167
+ join jobcategories in _base.phoenixDB.m_jobcategory on entry.JobCategoryId equals jobcategories.JobCategoryId
168
+
169
+ join selectionstatuses in _base.phoenixDB.m_selection_status on entry.SelectionStatusId equals selectionstatuses.SelectionStatusId
170
+
171
+ join entryroutes in _base.phoenixDB.m_entry_route on entry.EntryRouteId equals entryroutes.EntryRouteId
172
+
173
+ join locations in _base.phoenixDB.m_location on entry.LocationId equals locations.LocationId
174
+
175
+ join interviewers in _base.phoenixDB.t_interviewer on selection.SelectionId equals interviewers.SelectionId into tInteviewers
176
+
177
+ orderby entry.EntryId descending
178
+
179
+ select new BaseEntry
180
+
181
+ {
182
+
183
+ candidateid = entry.EntryId,
184
+
185
+ candidatename = entry.CandidateName,
186
+
187
+ candidatenamekana = entry.CandidateNameKana,
188
+
189
+ locationIds = (int)entry.LocationId,
190
+
191
+ location = locations.LocationName,
192
+
193
+ jobcategory = jobcategories.JobCategoryName,
194
+
195
+ jobcateoryid = entry.JobCategoryId,
196
+
197
+ entryroute = entryroutes.EntryRouteName,
198
+
199
+ entryrouteid = entry.EntryRouteId,
200
+
201
+ attribute = entry.IsFresher,
202
+
203
+ phase = phases.PhaseName,
204
+
205
+ phaseid = selection.PhaseId,
206
+
207
+ selectionstatus = selectionstatuses.SelectionStatusName,
208
+
209
+ selectuonstatusids = entry.SelectionStatusId,
210
+
211
+ selectionlimit = selection.SelectionLimit,
212
+
213
+ expectedjoinsdate = entry.JoinExpectedDate,
214
+
215
+ department = entry.DepartmentName,
216
+
217
+ adoptcost = entry.AdoptCost,
218
+
219
+ adoptrecordmonth = entry.AdoptCostRecordMonth,
220
+
221
+ adoptpaymentmonth = entry.AdoptCostPaymentMonth,
222
+
223
+ createdate = entry.CreatedDate,
224
+
225
+ checkweather = tInteviewers.OrderByDescending(x => x.InterviewerId).Where(x => x.SelectionId == selection.SelectionId && x.UserId == userId).Count()
226
+
227
+ }).ToList();
228
+
229
+
230
+
231
+
232
+
233
+ /*
234
+
235
+ Result => skipはメソッド 'Skip' は、LINQ to Entities では並べ替え済みの入力に対してのみサポートされます
236
+
237
+ */
238
+
239
+ ```

1

文言修正

2019/04/01 05:01

投稿

widget11
widget11

スコア221

test CHANGED
File without changes
test CHANGED
@@ -90,7 +90,7 @@
90
90
 
91
91
  })
92
92
 
93
- /*.Distinct()を使いたい*/.Skip(PageNumber).Take(PageSize).ToList();
93
+ /*.Distinct(x => x.Entry_Id)を使いたい*/.Skip(PageNumber).Take(PageSize).ToList();
94
94
 
95
95
  ```
96
96
 
@@ -118,7 +118,7 @@
118
118
 
119
119
  `join selection in DB.t_selection on entry.EntryId equals selection.EntryId`部分に一意の値である’SelectionIdの最大値だけを結合する’結合条件を書き、結合させたいのですが、
120
120
 
121
- distinctはそのまま使うと重複条件が多いためまた引数に何を書いてよいか分からず(x => x.canditdateと書いてもオーバロードが違うのかうまくいかず)か、うまく重複削除してあげたいものを削除してくれません。
121
+ distinctはそのまま使うと重複条件が多いためまた引数に何を書いてよいか分からず(x => x.EntryIdと書いてもオーバロードが違うのかうまくいかず)か、うまく重複削除してあげたいものを削除してくれません。
122
122
 
123
123
  また結合条件を書くことに関しましては、クエリ式のサンプルが少なく’selectionIdの最大値の一つを取得する’といった結合条件の書き方が分かりません。
124
124