Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4590908
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:19:08+00:00 2026-05-21T22:19:08+00:00

I´ve come to a total stop with my program and im in need of

  • 0

I´ve come to a total stop with my program and im in need of some help.

I got an xml file with customer billings and billing dates. This file has about 4000 billing dates. What i want is to sort them so the once that is in a range of a period date of 2010-04-01 - 2011-03-31 adds to a table column named period1. And the other dates goes to period2 that is 2011-04-01 - 2012-03-31.

Ive been testing and testing this solution in diffrent ways but it wont work. Im adding all the dats to a list named dates. And trying:

if (dates.All(date => date >= startDatePeriod1 && date <= stopDatePeriod1))
{
    adapterBonus.InsertPeriod1Query(// insert to database));
}
else if (dates.All(date => date >= startDatePeriod2 && date >= stopDatePeriod2))
{
    adapterBonus.InsertPeriod2Query(// insert to database));
}

startDatePeriod1 = 2010-04-01
stopDatePeriiod1 = 2011-03-31  

and so on

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T22:19:09+00:00Added an answer on May 21, 2026 at 10:19 pm

    The Enumerable.All extension method returns true if every element in the sequence verifies the condition. If dates contains dates in both periods, none of the ifs will run, because both calls to Enumerable.All will return false.

    I’m not sure what you mean by “adds to a table column named period1”, but if you mean to count all the dates in each period, use Enumerable.Count:

    int period1Count = dates.Count(date => date >= startDatePeriod1 && date <= stopDatePeriod1);
    int period2Count = dates.Count(date => date >= startDatePeriod2 && date <= stopDatePeriod2);
    adapterBonus.InsertPeriod1Query(period1Count);
    adapterBonus.InsertPeriod2Query(period2Count);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I come across this problem when i am writing an event handler in SharePoint.
How come this doesn't work (operating on an empty select list <select id=requestTypes></select> $(function()
I am a total jQuery newbie (well web coding newbie come to that) and
How come this code returns true? string to match: ab pattern: /^a|b$/ but when
I come from a Java background, where packages are used, not namespaces. I'm used
I come from the Microsoft world (and I come in peace). I want to
I come from a .NET world and I'm new to writting C++. I'm just
How come the following doesn't work? CREATE FUNCTION Test (@top integer) RETURNS TABLE AS
I come from a mainly PHP background and make good use of the Apache
I come from a CVS background. I'm currently investigating using SVN for a project.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.