Iterate through linq query results by day to check conditions











up vote
0
down vote

favorite
1












I have a query that returns a list of events in a date range.



enter image description here



string EOOmessage = "";[enter image description here][2]
string eventText = "";
DateTime js = DateTime.Now;
DateTime je = DateTime.Now;
var itCompareDay = (from h in db.DailyGPSTables
where (h.EventDateTime >= startDate
&& h.EventDateTime <= endDate)
select h).ToList();


I want to check the time for each event to make sure its in the proper sequence. For example JE(Job End) cannot be before JS(Job Start). I have tried many ways but this is my latest. It checks for a matching JE tag correctly but it doesn't account for which day it is in.



int rowNumber = -1;
foreach (DailyGPSTable e in itCompareDay)
{
if (e.EventType == "JS")
{
js = e.EventDateTime.Value;
}
if (e.EventType == "JE")
{
je = e.EventDateTime.Value;
}
if (je < js)
{
EOOmessage = " On " + e.EventDateTime.Value.ToShortDateString() + " Job end is before Job Start " + eventText;
errorList.Add(EOOmessage);
errorListRow.Add(rowNumber);
}
rowNumber = rowNumber + 1;
}


Is there a way to check each day for out of sequence events and if found report them if not go to the next day?










share|improve this question
























  • Actually since the attribute is a DateTime, it should include the day in the comparison without you needing to check it manually.
    – stybl
    Nov 9 at 17:34










  • What is wrong with the current code example you gave?
    – ivcubr
    Nov 9 at 17:57










  • it checks the entire week not just the day.
    – Doug Farrell
    Nov 9 at 18:02










  • so on the 1st it finds a je before a js but on the 3rd it finds another je abut doesn't realize there was another js on the 3rd. It's as if it uses the js on the 1st.
    – Doug Farrell
    Nov 9 at 18:15






  • 2




    I really don't understand what you're asking. Can you post "desired output" so we can visualize what kind of result you're looking for?
    – T.S.
    Nov 9 at 18:37















up vote
0
down vote

favorite
1












I have a query that returns a list of events in a date range.



enter image description here



string EOOmessage = "";[enter image description here][2]
string eventText = "";
DateTime js = DateTime.Now;
DateTime je = DateTime.Now;
var itCompareDay = (from h in db.DailyGPSTables
where (h.EventDateTime >= startDate
&& h.EventDateTime <= endDate)
select h).ToList();


I want to check the time for each event to make sure its in the proper sequence. For example JE(Job End) cannot be before JS(Job Start). I have tried many ways but this is my latest. It checks for a matching JE tag correctly but it doesn't account for which day it is in.



int rowNumber = -1;
foreach (DailyGPSTable e in itCompareDay)
{
if (e.EventType == "JS")
{
js = e.EventDateTime.Value;
}
if (e.EventType == "JE")
{
je = e.EventDateTime.Value;
}
if (je < js)
{
EOOmessage = " On " + e.EventDateTime.Value.ToShortDateString() + " Job end is before Job Start " + eventText;
errorList.Add(EOOmessage);
errorListRow.Add(rowNumber);
}
rowNumber = rowNumber + 1;
}


Is there a way to check each day for out of sequence events and if found report them if not go to the next day?










share|improve this question
























  • Actually since the attribute is a DateTime, it should include the day in the comparison without you needing to check it manually.
    – stybl
    Nov 9 at 17:34










  • What is wrong with the current code example you gave?
    – ivcubr
    Nov 9 at 17:57










  • it checks the entire week not just the day.
    – Doug Farrell
    Nov 9 at 18:02










  • so on the 1st it finds a je before a js but on the 3rd it finds another je abut doesn't realize there was another js on the 3rd. It's as if it uses the js on the 1st.
    – Doug Farrell
    Nov 9 at 18:15






  • 2




    I really don't understand what you're asking. Can you post "desired output" so we can visualize what kind of result you're looking for?
    – T.S.
    Nov 9 at 18:37













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I have a query that returns a list of events in a date range.



enter image description here



string EOOmessage = "";[enter image description here][2]
string eventText = "";
DateTime js = DateTime.Now;
DateTime je = DateTime.Now;
var itCompareDay = (from h in db.DailyGPSTables
where (h.EventDateTime >= startDate
&& h.EventDateTime <= endDate)
select h).ToList();


I want to check the time for each event to make sure its in the proper sequence. For example JE(Job End) cannot be before JS(Job Start). I have tried many ways but this is my latest. It checks for a matching JE tag correctly but it doesn't account for which day it is in.



int rowNumber = -1;
foreach (DailyGPSTable e in itCompareDay)
{
if (e.EventType == "JS")
{
js = e.EventDateTime.Value;
}
if (e.EventType == "JE")
{
je = e.EventDateTime.Value;
}
if (je < js)
{
EOOmessage = " On " + e.EventDateTime.Value.ToShortDateString() + " Job end is before Job Start " + eventText;
errorList.Add(EOOmessage);
errorListRow.Add(rowNumber);
}
rowNumber = rowNumber + 1;
}


Is there a way to check each day for out of sequence events and if found report them if not go to the next day?










share|improve this question















I have a query that returns a list of events in a date range.



enter image description here



string EOOmessage = "";[enter image description here][2]
string eventText = "";
DateTime js = DateTime.Now;
DateTime je = DateTime.Now;
var itCompareDay = (from h in db.DailyGPSTables
where (h.EventDateTime >= startDate
&& h.EventDateTime <= endDate)
select h).ToList();


I want to check the time for each event to make sure its in the proper sequence. For example JE(Job End) cannot be before JS(Job Start). I have tried many ways but this is my latest. It checks for a matching JE tag correctly but it doesn't account for which day it is in.



int rowNumber = -1;
foreach (DailyGPSTable e in itCompareDay)
{
if (e.EventType == "JS")
{
js = e.EventDateTime.Value;
}
if (e.EventType == "JE")
{
je = e.EventDateTime.Value;
}
if (je < js)
{
EOOmessage = " On " + e.EventDateTime.Value.ToShortDateString() + " Job end is before Job Start " + eventText;
errorList.Add(EOOmessage);
errorListRow.Add(rowNumber);
}
rowNumber = rowNumber + 1;
}


Is there a way to check each day for out of sequence events and if found report them if not go to the next day?







c# asp.net linq entity-framework-6






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 20:09

























asked Nov 9 at 17:31









Doug Farrell

176




176












  • Actually since the attribute is a DateTime, it should include the day in the comparison without you needing to check it manually.
    – stybl
    Nov 9 at 17:34










  • What is wrong with the current code example you gave?
    – ivcubr
    Nov 9 at 17:57










  • it checks the entire week not just the day.
    – Doug Farrell
    Nov 9 at 18:02










  • so on the 1st it finds a je before a js but on the 3rd it finds another je abut doesn't realize there was another js on the 3rd. It's as if it uses the js on the 1st.
    – Doug Farrell
    Nov 9 at 18:15






  • 2




    I really don't understand what you're asking. Can you post "desired output" so we can visualize what kind of result you're looking for?
    – T.S.
    Nov 9 at 18:37


















  • Actually since the attribute is a DateTime, it should include the day in the comparison without you needing to check it manually.
    – stybl
    Nov 9 at 17:34










  • What is wrong with the current code example you gave?
    – ivcubr
    Nov 9 at 17:57










  • it checks the entire week not just the day.
    – Doug Farrell
    Nov 9 at 18:02










  • so on the 1st it finds a je before a js but on the 3rd it finds another je abut doesn't realize there was another js on the 3rd. It's as if it uses the js on the 1st.
    – Doug Farrell
    Nov 9 at 18:15






  • 2




    I really don't understand what you're asking. Can you post "desired output" so we can visualize what kind of result you're looking for?
    – T.S.
    Nov 9 at 18:37
















Actually since the attribute is a DateTime, it should include the day in the comparison without you needing to check it manually.
– stybl
Nov 9 at 17:34




Actually since the attribute is a DateTime, it should include the day in the comparison without you needing to check it manually.
– stybl
Nov 9 at 17:34












What is wrong with the current code example you gave?
– ivcubr
Nov 9 at 17:57




What is wrong with the current code example you gave?
– ivcubr
Nov 9 at 17:57












it checks the entire week not just the day.
– Doug Farrell
Nov 9 at 18:02




it checks the entire week not just the day.
– Doug Farrell
Nov 9 at 18:02












so on the 1st it finds a je before a js but on the 3rd it finds another je abut doesn't realize there was another js on the 3rd. It's as if it uses the js on the 1st.
– Doug Farrell
Nov 9 at 18:15




so on the 1st it finds a je before a js but on the 3rd it finds another je abut doesn't realize there was another js on the 3rd. It's as if it uses the js on the 1st.
– Doug Farrell
Nov 9 at 18:15




2




2




I really don't understand what you're asking. Can you post "desired output" so we can visualize what kind of result you're looking for?
– T.S.
Nov 9 at 18:37




I really don't understand what you're asking. Can you post "desired output" so we can visualize what kind of result you're looking for?
– T.S.
Nov 9 at 18:37












1 Answer
1






active

oldest

votes

















up vote
1
down vote













Using an extension method that scans sequentially and groups while a test is true (or false) named GroupByWhile based on my extension method for scanning by pairs:



public static class IEnumerableExt {
// TKey combineFn((TKey Key, T Value) PrevKeyItem, T curItem):
// PrevKeyItem.Key = Previous Key
// PrevKeyItem.Value = Previous Item
// curItem = Current Item
// returns new Key
public static IEnumerable<(TKey Key, T Value)> ScanPair<T, TKey>(this IEnumerable<T> src, TKey seedKey, Func<(TKey Key, T Value), T, TKey> combineFn) {
using (var srce = src.GetEnumerator()) {
if (srce.MoveNext()) {
var prevkv = (seedKey, srce.Current);

while (srce.MoveNext()) {
yield return prevkv;
prevkv = (combineFn(prevkv, srce.Current), srce.Current);
}
yield return prevkv;
}
}
}

// bool testFn(T prevItem, T curItem)
// returns groups by sequential matching bool
public static IEnumerable<IGrouping<int, T>> GroupByWhile<T>(this IEnumerable<T> src, Func<T, T, bool> testFn) =>
src.ScanPair(1, (kvp, cur) => testFn(kvp.Value, cur) ? kvp.Key : kvp.Key + 1)
.GroupBy(kvp => kvp.Key, kvp => kvp.Value);
}


You can select out the interesting event types (JS/JE) ordered by EventDateTime and then group by JS followed by JE and throw out matching pairs:



var itCompareDay = (from h in db.DailyGPSTables
where (h.EventDateTime >= startDate
&& h.EventDateTime <= endDate)
orderby h.EventDateTime
select h).ToList();

var errEvents = itCompareDay
.Select((ev, rowNum) => new { ev.EventType, ev.EventDateTime, rowNum })
.Where(cd => cd.EventType == "JS" || cd.EventType == "JE")
.GroupByWhile((pd, cd) => pd.EventType == "JS" && cd.EventType == "JE" && pd.EventDateTime.Date == cd.EventDateTime.Date)
.Where(cdg => cdg.Count() != 2)
.SelectMany(cdg => cdg.Select(cd => new { cd.rowNum, ErrMsg = cd.EventType == "JE" ? "JE without preceding JS" : "JS without following JE" }));


Note that rowNum is 0 based but you could add 1 in the first Select if desired.






share|improve this answer























  • Wow, very impressive!
    – johey
    Nov 9 at 19:15










  • Thank You so much, I am having trouble implementing the extension class by simply copying and pasting your code into a new class
    – Doug Farrell
    Nov 9 at 19:58










  • An extension must be implemented in a static class. I added the wrapper in the answer.
    – NetMage
    Nov 9 at 20:00












  • Still getting errors. I am adding a pic of the page
    – Doug Farrell
    Nov 9 at 20:07










  • @NetMage I really appreciate your answer and would like to implement it. I have to leave the office now but would really appreciate the help on getting the GroupByWhile extensions set up on VS to operate..
    – Doug Farrell
    Nov 9 at 21:18











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230672%2fiterate-through-linq-query-results-by-day-to-check-conditions%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













Using an extension method that scans sequentially and groups while a test is true (or false) named GroupByWhile based on my extension method for scanning by pairs:



public static class IEnumerableExt {
// TKey combineFn((TKey Key, T Value) PrevKeyItem, T curItem):
// PrevKeyItem.Key = Previous Key
// PrevKeyItem.Value = Previous Item
// curItem = Current Item
// returns new Key
public static IEnumerable<(TKey Key, T Value)> ScanPair<T, TKey>(this IEnumerable<T> src, TKey seedKey, Func<(TKey Key, T Value), T, TKey> combineFn) {
using (var srce = src.GetEnumerator()) {
if (srce.MoveNext()) {
var prevkv = (seedKey, srce.Current);

while (srce.MoveNext()) {
yield return prevkv;
prevkv = (combineFn(prevkv, srce.Current), srce.Current);
}
yield return prevkv;
}
}
}

// bool testFn(T prevItem, T curItem)
// returns groups by sequential matching bool
public static IEnumerable<IGrouping<int, T>> GroupByWhile<T>(this IEnumerable<T> src, Func<T, T, bool> testFn) =>
src.ScanPair(1, (kvp, cur) => testFn(kvp.Value, cur) ? kvp.Key : kvp.Key + 1)
.GroupBy(kvp => kvp.Key, kvp => kvp.Value);
}


You can select out the interesting event types (JS/JE) ordered by EventDateTime and then group by JS followed by JE and throw out matching pairs:



var itCompareDay = (from h in db.DailyGPSTables
where (h.EventDateTime >= startDate
&& h.EventDateTime <= endDate)
orderby h.EventDateTime
select h).ToList();

var errEvents = itCompareDay
.Select((ev, rowNum) => new { ev.EventType, ev.EventDateTime, rowNum })
.Where(cd => cd.EventType == "JS" || cd.EventType == "JE")
.GroupByWhile((pd, cd) => pd.EventType == "JS" && cd.EventType == "JE" && pd.EventDateTime.Date == cd.EventDateTime.Date)
.Where(cdg => cdg.Count() != 2)
.SelectMany(cdg => cdg.Select(cd => new { cd.rowNum, ErrMsg = cd.EventType == "JE" ? "JE without preceding JS" : "JS without following JE" }));


Note that rowNum is 0 based but you could add 1 in the first Select if desired.






share|improve this answer























  • Wow, very impressive!
    – johey
    Nov 9 at 19:15










  • Thank You so much, I am having trouble implementing the extension class by simply copying and pasting your code into a new class
    – Doug Farrell
    Nov 9 at 19:58










  • An extension must be implemented in a static class. I added the wrapper in the answer.
    – NetMage
    Nov 9 at 20:00












  • Still getting errors. I am adding a pic of the page
    – Doug Farrell
    Nov 9 at 20:07










  • @NetMage I really appreciate your answer and would like to implement it. I have to leave the office now but would really appreciate the help on getting the GroupByWhile extensions set up on VS to operate..
    – Doug Farrell
    Nov 9 at 21:18















up vote
1
down vote













Using an extension method that scans sequentially and groups while a test is true (or false) named GroupByWhile based on my extension method for scanning by pairs:



public static class IEnumerableExt {
// TKey combineFn((TKey Key, T Value) PrevKeyItem, T curItem):
// PrevKeyItem.Key = Previous Key
// PrevKeyItem.Value = Previous Item
// curItem = Current Item
// returns new Key
public static IEnumerable<(TKey Key, T Value)> ScanPair<T, TKey>(this IEnumerable<T> src, TKey seedKey, Func<(TKey Key, T Value), T, TKey> combineFn) {
using (var srce = src.GetEnumerator()) {
if (srce.MoveNext()) {
var prevkv = (seedKey, srce.Current);

while (srce.MoveNext()) {
yield return prevkv;
prevkv = (combineFn(prevkv, srce.Current), srce.Current);
}
yield return prevkv;
}
}
}

// bool testFn(T prevItem, T curItem)
// returns groups by sequential matching bool
public static IEnumerable<IGrouping<int, T>> GroupByWhile<T>(this IEnumerable<T> src, Func<T, T, bool> testFn) =>
src.ScanPair(1, (kvp, cur) => testFn(kvp.Value, cur) ? kvp.Key : kvp.Key + 1)
.GroupBy(kvp => kvp.Key, kvp => kvp.Value);
}


You can select out the interesting event types (JS/JE) ordered by EventDateTime and then group by JS followed by JE and throw out matching pairs:



var itCompareDay = (from h in db.DailyGPSTables
where (h.EventDateTime >= startDate
&& h.EventDateTime <= endDate)
orderby h.EventDateTime
select h).ToList();

var errEvents = itCompareDay
.Select((ev, rowNum) => new { ev.EventType, ev.EventDateTime, rowNum })
.Where(cd => cd.EventType == "JS" || cd.EventType == "JE")
.GroupByWhile((pd, cd) => pd.EventType == "JS" && cd.EventType == "JE" && pd.EventDateTime.Date == cd.EventDateTime.Date)
.Where(cdg => cdg.Count() != 2)
.SelectMany(cdg => cdg.Select(cd => new { cd.rowNum, ErrMsg = cd.EventType == "JE" ? "JE without preceding JS" : "JS without following JE" }));


Note that rowNum is 0 based but you could add 1 in the first Select if desired.






share|improve this answer























  • Wow, very impressive!
    – johey
    Nov 9 at 19:15










  • Thank You so much, I am having trouble implementing the extension class by simply copying and pasting your code into a new class
    – Doug Farrell
    Nov 9 at 19:58










  • An extension must be implemented in a static class. I added the wrapper in the answer.
    – NetMage
    Nov 9 at 20:00












  • Still getting errors. I am adding a pic of the page
    – Doug Farrell
    Nov 9 at 20:07










  • @NetMage I really appreciate your answer and would like to implement it. I have to leave the office now but would really appreciate the help on getting the GroupByWhile extensions set up on VS to operate..
    – Doug Farrell
    Nov 9 at 21:18













up vote
1
down vote










up vote
1
down vote









Using an extension method that scans sequentially and groups while a test is true (or false) named GroupByWhile based on my extension method for scanning by pairs:



public static class IEnumerableExt {
// TKey combineFn((TKey Key, T Value) PrevKeyItem, T curItem):
// PrevKeyItem.Key = Previous Key
// PrevKeyItem.Value = Previous Item
// curItem = Current Item
// returns new Key
public static IEnumerable<(TKey Key, T Value)> ScanPair<T, TKey>(this IEnumerable<T> src, TKey seedKey, Func<(TKey Key, T Value), T, TKey> combineFn) {
using (var srce = src.GetEnumerator()) {
if (srce.MoveNext()) {
var prevkv = (seedKey, srce.Current);

while (srce.MoveNext()) {
yield return prevkv;
prevkv = (combineFn(prevkv, srce.Current), srce.Current);
}
yield return prevkv;
}
}
}

// bool testFn(T prevItem, T curItem)
// returns groups by sequential matching bool
public static IEnumerable<IGrouping<int, T>> GroupByWhile<T>(this IEnumerable<T> src, Func<T, T, bool> testFn) =>
src.ScanPair(1, (kvp, cur) => testFn(kvp.Value, cur) ? kvp.Key : kvp.Key + 1)
.GroupBy(kvp => kvp.Key, kvp => kvp.Value);
}


You can select out the interesting event types (JS/JE) ordered by EventDateTime and then group by JS followed by JE and throw out matching pairs:



var itCompareDay = (from h in db.DailyGPSTables
where (h.EventDateTime >= startDate
&& h.EventDateTime <= endDate)
orderby h.EventDateTime
select h).ToList();

var errEvents = itCompareDay
.Select((ev, rowNum) => new { ev.EventType, ev.EventDateTime, rowNum })
.Where(cd => cd.EventType == "JS" || cd.EventType == "JE")
.GroupByWhile((pd, cd) => pd.EventType == "JS" && cd.EventType == "JE" && pd.EventDateTime.Date == cd.EventDateTime.Date)
.Where(cdg => cdg.Count() != 2)
.SelectMany(cdg => cdg.Select(cd => new { cd.rowNum, ErrMsg = cd.EventType == "JE" ? "JE without preceding JS" : "JS without following JE" }));


Note that rowNum is 0 based but you could add 1 in the first Select if desired.






share|improve this answer














Using an extension method that scans sequentially and groups while a test is true (or false) named GroupByWhile based on my extension method for scanning by pairs:



public static class IEnumerableExt {
// TKey combineFn((TKey Key, T Value) PrevKeyItem, T curItem):
// PrevKeyItem.Key = Previous Key
// PrevKeyItem.Value = Previous Item
// curItem = Current Item
// returns new Key
public static IEnumerable<(TKey Key, T Value)> ScanPair<T, TKey>(this IEnumerable<T> src, TKey seedKey, Func<(TKey Key, T Value), T, TKey> combineFn) {
using (var srce = src.GetEnumerator()) {
if (srce.MoveNext()) {
var prevkv = (seedKey, srce.Current);

while (srce.MoveNext()) {
yield return prevkv;
prevkv = (combineFn(prevkv, srce.Current), srce.Current);
}
yield return prevkv;
}
}
}

// bool testFn(T prevItem, T curItem)
// returns groups by sequential matching bool
public static IEnumerable<IGrouping<int, T>> GroupByWhile<T>(this IEnumerable<T> src, Func<T, T, bool> testFn) =>
src.ScanPair(1, (kvp, cur) => testFn(kvp.Value, cur) ? kvp.Key : kvp.Key + 1)
.GroupBy(kvp => kvp.Key, kvp => kvp.Value);
}


You can select out the interesting event types (JS/JE) ordered by EventDateTime and then group by JS followed by JE and throw out matching pairs:



var itCompareDay = (from h in db.DailyGPSTables
where (h.EventDateTime >= startDate
&& h.EventDateTime <= endDate)
orderby h.EventDateTime
select h).ToList();

var errEvents = itCompareDay
.Select((ev, rowNum) => new { ev.EventType, ev.EventDateTime, rowNum })
.Where(cd => cd.EventType == "JS" || cd.EventType == "JE")
.GroupByWhile((pd, cd) => pd.EventType == "JS" && cd.EventType == "JE" && pd.EventDateTime.Date == cd.EventDateTime.Date)
.Where(cdg => cdg.Count() != 2)
.SelectMany(cdg => cdg.Select(cd => new { cd.rowNum, ErrMsg = cd.EventType == "JE" ? "JE without preceding JS" : "JS without following JE" }));


Note that rowNum is 0 based but you could add 1 in the first Select if desired.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 9 at 20:02

























answered Nov 9 at 19:08









NetMage

13k11834




13k11834












  • Wow, very impressive!
    – johey
    Nov 9 at 19:15










  • Thank You so much, I am having trouble implementing the extension class by simply copying and pasting your code into a new class
    – Doug Farrell
    Nov 9 at 19:58










  • An extension must be implemented in a static class. I added the wrapper in the answer.
    – NetMage
    Nov 9 at 20:00












  • Still getting errors. I am adding a pic of the page
    – Doug Farrell
    Nov 9 at 20:07










  • @NetMage I really appreciate your answer and would like to implement it. I have to leave the office now but would really appreciate the help on getting the GroupByWhile extensions set up on VS to operate..
    – Doug Farrell
    Nov 9 at 21:18


















  • Wow, very impressive!
    – johey
    Nov 9 at 19:15










  • Thank You so much, I am having trouble implementing the extension class by simply copying and pasting your code into a new class
    – Doug Farrell
    Nov 9 at 19:58










  • An extension must be implemented in a static class. I added the wrapper in the answer.
    – NetMage
    Nov 9 at 20:00












  • Still getting errors. I am adding a pic of the page
    – Doug Farrell
    Nov 9 at 20:07










  • @NetMage I really appreciate your answer and would like to implement it. I have to leave the office now but would really appreciate the help on getting the GroupByWhile extensions set up on VS to operate..
    – Doug Farrell
    Nov 9 at 21:18
















Wow, very impressive!
– johey
Nov 9 at 19:15




Wow, very impressive!
– johey
Nov 9 at 19:15












Thank You so much, I am having trouble implementing the extension class by simply copying and pasting your code into a new class
– Doug Farrell
Nov 9 at 19:58




Thank You so much, I am having trouble implementing the extension class by simply copying and pasting your code into a new class
– Doug Farrell
Nov 9 at 19:58












An extension must be implemented in a static class. I added the wrapper in the answer.
– NetMage
Nov 9 at 20:00






An extension must be implemented in a static class. I added the wrapper in the answer.
– NetMage
Nov 9 at 20:00














Still getting errors. I am adding a pic of the page
– Doug Farrell
Nov 9 at 20:07




Still getting errors. I am adding a pic of the page
– Doug Farrell
Nov 9 at 20:07












@NetMage I really appreciate your answer and would like to implement it. I have to leave the office now but would really appreciate the help on getting the GroupByWhile extensions set up on VS to operate..
– Doug Farrell
Nov 9 at 21:18




@NetMage I really appreciate your answer and would like to implement it. I have to leave the office now but would really appreciate the help on getting the GroupByWhile extensions set up on VS to operate..
– Doug Farrell
Nov 9 at 21:18


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230672%2fiterate-through-linq-query-results-by-day-to-check-conditions%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Academy of Television Arts & Sciences

L'Équipe

1995 France bombings