Solved

default date alerts

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

730 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