85 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.ComponentModel;
 | 
						|
using System.Data;
 | 
						|
using System.Drawing;
 | 
						|
using System.Text;
 | 
						|
using System.Windows.Forms;
 | 
						|
using DevComponents.DotNetBar;
 | 
						|
using DevComponents.DotNetBar.Controls;
 | 
						|
using VEPROMS.CSLA.Library;
 | 
						|
 | 
						|
 | 
						|
namespace VEPROMS
 | 
						|
{
 | 
						|
	public partial class dlgSetChangeBarStartDate : DevComponents.DotNetBar.Office2007Form
 | 
						|
	{
 | 
						|
		private ProcedureConfig _MyProcConfig = null;
 | 
						|
 | 
						|
		public ProcedureConfig MyProcConfig
 | 
						|
		{
 | 
						|
			get { return _MyProcConfig; }
 | 
						|
			set { _MyProcConfig = value; }
 | 
						|
		}
 | 
						|
 | 
						|
		public dlgSetChangeBarStartDate(ProcedureConfig pc)
 | 
						|
		{
 | 
						|
			InitializeComponent();
 | 
						|
			_MyProcConfig = pc;
 | 
						|
		}
 | 
						|
 | 
						|
		private void dlgSetChangeBarStartDate_Load(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			string cbdt = MyProcConfig.Print_ChangeBarDate;
 | 
						|
			string[] tmp = cbdt.Split(' ');
 | 
						|
 | 
						|
			if (tmp[0] == null || tmp[0] == "")  // First time date set.
 | 
						|
			{
 | 
						|
				cbdt = DateTime.Now.ToString("MM/dd/yyyy") + " " + DateTime.Now.ToString("HH:mm:ss");
 | 
						|
				dateTimeInput1.Value = DateTime.Parse(cbdt);
 | 
						|
				return;
 | 
						|
			}
 | 
						|
			else
 | 
						|
			{
 | 
						|
				DateTime tmpdt = DateTime.Parse(cbdt);
 | 
						|
				if (tmpdt.Date == DateTime.Today) // Date has before been set.
 | 
						|
				{
 | 
						|
					TimeSpan start = TimeSpan.Parse("00:00:00");
 | 
						|
 | 
						|
					var time = tmpdt.TimeOfDay;
 | 
						|
					if (start < time) // If time is greater than 12:00:00 AM
 | 
						|
					{
 | 
						|
						cbdt = DateTime.Now.ToString("MM/dd/yyyy") + " " + tmpdt.TimeOfDay.ToString();
 | 
						|
						dateTimeInput1.Value = DateTime.Parse(cbdt);
 | 
						|
						return;
 | 
						|
					}
 | 
						|
					else // if time is 12:00:00 AM
 | 
						|
					{
 | 
						|
						cbdt = DateTime.Now.ToString("MM/dd/yyyy") + " " + " 00:00:00";
 | 
						|
						dateTimeInput1.Value = DateTime.Parse(cbdt);
 | 
						|
						return;
 | 
						|
					}
 | 
						|
				}
 | 
						|
				else
 | 
						|
				{
 | 
						|
					cbdt = tmpdt.ToString();
 | 
						|
					dateTimeInput1.Value = DateTime.Parse(cbdt);
 | 
						|
					return;
 | 
						|
				}
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		private void btnOK_Click(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			MyProcConfig.Print_ChangeBarDate = dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss");// ("MM/dd/yyyy HH:mm:ss");
 | 
						|
		}
 | 
						|
 | 
						|
 | 
						|
		private void btnNow_Click(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			dateTimeInput1.Value = DateTime.Now;
 | 
						|
		}
 | 
						|
 | 
						|
	}
 | 
						|
}
 |