Click here to Skip to main content
12,700,567 members (33,113 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# SQL-Server Visual-Studio , +
Hi,
I am currently working on a web application. In this I have to display today's sales, weekly sale's and monthly sales. I didn't get the idea to display weekly sales. I want to display both details and chart. Anybody have the idea to get the current weeks details...?

Thank you....
Posted 6-Aug-12 19:52pm
Updated 6-Aug-12 21:05pm
v2
Comments
   
You want to show in Chart or as details?
Neha Thanka 7-Aug-12 1:01am
   
I have to display in both ways in 2 different pages.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

if you are asking for getting current week range then below is the function code for getting current week range
// to get First date of week
        public string fDate()
        {
            DayOfWeek weekStart = new DayOfWeek();
            DateTime startdate = DateTime.Today.AddDays(weekStart - DateTime.Today.DayOfWeek);
            string Fdateofweek= startdate.ToShortDateString();
            return Fdateofweek;
        }
        // to get today date
        public string cDate()
        {
            DateTime enddate = DateTime.Today;
            string CurrnetDay =enddate.ToShortDateString();
            return CurrnetDay;
        }
        


Now Make Sql Query
like
string query = "select * from tablename WHERE Date BETWEEN '" + fDate() + "' AND '" + cDate() + "'";
  Permalink  
v2
Comments
Neha Thanka 7-Aug-12 6:26am
   
Thank you so much.....
Volynsky Alex 8-Aug-12 18:21pm
   
+5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 7 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100