Visual C#: Detect Conflict Schedule

Screenshot
It seems a lot of people are searching about solving conflict schedule. So I decided to create a sample. Below is the core code of checking conflict schedule…
// sample conflict detection (defined) [start]
DateTime d = new DateTime(2010, 1, 13);
richTextBox1.Text = DateTime.Now.ToLongDateString() + ” = ” + d.ToLongDateString() + “\n”;
if (DateTime.Now.CompareTo(d) > 0)
{
richTextBox1.Text += “true\n” + DateTime.Now.CompareTo(d).ToString();
}
else
{
richTextBox1.Text += “false\n” + DateTime.Now.CompareTo(d).ToString();
}
richTextBox1.Text += “\n\n”;
DateTime dx = DateTime.Now;
//MessageBox.Show(dx.Hour.ToString());
DateTime[] dt = new DateTime[4];
// enrolled schedule
dt[0] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 8, 0, 0);
dt[1] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 9, 0, 0);
// adding new schedule
dt[2] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 9, 0, 0);
dt[3] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 10, 0, 0);
// checking schedule conflict
if (((dt[0].CompareTo(dt[2]) < 0) && (dt[1].CompareTo(dt[2]) > 0)) || (dt[0].ToShortTimeString() == dt[2].ToShortTimeString()))
{
richTextBox1.Text += dt[0].ToShortTimeString() + ” – ” + dt[1].ToShortTimeString() + ” against ” + dt[2].ToShortTimeString() + ” – ” + dt[3].ToShortTimeString() + “\nResult: CONFLICT”;
}
else
{
richTextBox1.Text += dt[0].ToShortTimeString() + ” – ” + dt[1].ToShortTimeString() + ” against ” + dt[2].ToShortTimeString() + ” – ” + dt[3].ToShortTimeString() + “\nResult: NO CONFLICT”;
}
// sample conflict detection (defined) [end]
If you want to download the whole code, link below and enjoy… Do not practice the copy and paste!
Download: Detect Conflict Schedule (15)
how about in vb.net?…
sorry can’t help about VB.. i don’t like VB programming structure..
i’m more in C family programming…
I surely have to come along your great idea just about this post in time of the research papers or just america essay paper performing. Therefore, thank you for your contribution.
how about in vb.net?…