Solved

default date alerts

Posted on 2007-03-31
4
189 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 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now