[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

default date alerts

Posted on 2007-03-31
4
Medium Priority
?
199 Views
Last Modified: 2013-12-16
hi all,
here is the problem,
i hv three date fileds in my form.one is openeddate,second duedate.third one is resolved date.....
opendate will be the currentdate.....
duedate will be three days from the opendate and i have to consider saturday and sunday,and this has to prompt a message saying you have to resolve this by today in the last date.please help me out how to do this one with current date.......resolved date must come after resolving the issue.
my problem is with duedate now..................help needed
0
Comment
Question by:hariprasadere
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
fredvr666 earned 2000 total points
ID: 18831471
Something like this:

private void Form1_Load(object sender, EventArgs e)
    {
      //this.textBoxCount.Text = Convert.ToString(3);
      this.textBoxToday.Text = DateTime.Now.ToString("dd-MM-yyyy");
    }
   
    private void button1_Click(object sender, EventArgs e)
    {
      DateTime From;
      DateTime Planned;
      GregorianCalendar Cal = new GregorianCalendar();
      long WorkDays = 0;
      Int32 Days = 0;

      From=Convert.ToDateTime(this.textBoxToday.Text);
      Days = Convert.ToInt32(this.textBoxCount.Text);
      Planned = Cal.AddDays(From, Days);
      WorkDays = WorkingDays(Cal.AddDays(From, 1), Planned);
      Days = Days + (Days - Convert.ToInt32(WorkDays));
      Planned = Cal.AddDays(From, Days);
     
      this.textBoxPlanned.Text = Planned.ToString("dd-MM-yyyy");
    }
   
    long WorkingDays(DateTime beginDate, DateTime endDate)
    {
      TimeSpan span = endDate.Subtract(beginDate);
      long wholeWeeks = ((long)Math.Round(Math.Floor(span.TotalDays))) / 7;
      DateTime dateCount = beginDate.AddDays(wholeWeeks * 7);
      int endDays = 0;

      while (dateCount.Date <= endDate.Date)
      {
        switch (dateCount.DayOfWeek)
        {
          case DayOfWeek.Saturday:
          case DayOfWeek.Sunday:
            break;
          default:
            endDays++;
            break;
        }
        dateCount = dateCount.AddDays(1);
      }
      return wholeWeeks * 5 + endDays;
    }
0
 

Author Comment

by:hariprasadere
ID: 18833954
thanks ....but it seems it only displays the duedate,how abt the alert messages that has to come when the due date is closing....pls help me out that too.
0
 

Author Comment

by:hariprasadere
ID: 18837534
Days = Convert.ToInt32(this.textBoxCount.Text);
what is this textBoxCount.Text?,Can you help me out as Iam unable to locate it in my form.....
0
 
LVL 3

Expert Comment

by:fredvr666
ID: 18838482
hariprasadere thanks for the points.
It's just a textbox with the name textBoxCount which is presented the duedate count.
The example is just a test to work with.
The alert message fired when you do something like planned<=today so fire the message
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question