www.pudn.com > PlanBoard.rar > UC_UpdatePlan.cs


using System; 
using System.Collections; 
using System.ComponentModel; 
using System.Drawing; 
using System.Data; 
using System.Windows.Forms; 
 
namespace PlanBoard 
{ 
	///  
	/// UC_UpdatePlan 的摘要说明。 
	///  
	public class UC_UpdatePlan : System.Windows.Forms.UserControl 
	{ 
		private System.Windows.Forms.Button btn_Cancel; 
		private System.Windows.Forms.Label label8; 
		private System.Windows.Forms.ComboBox cbb_Level; 
		private System.Windows.Forms.Button btn_Update; 
		private System.Windows.Forms.DateTimePicker dtp_DateEnd; 
		private System.Windows.Forms.DateTimePicker dtp_DateBegin; 
		private System.Windows.Forms.TextBox txt_Remarks; 
		private System.Windows.Forms.Panel panel1; 
		private System.Windows.Forms.CheckBox ccb_Finished; 
		private System.Windows.Forms.DateTimePicker dtp_FinishDate; 
		private System.Windows.Forms.DateTimePicker dtp_PlanDate; 
		private System.Windows.Forms.Label label7; 
		private System.Windows.Forms.Label label6; 
		private System.Windows.Forms.TextBox txt_Desc; 
		private System.Windows.Forms.TextBox txt_Item; 
		private System.Windows.Forms.Label label5; 
		private System.Windows.Forms.Label label4; 
		private System.Windows.Forms.Label label3; 
		private System.Windows.Forms.Label label2; 
		private System.Windows.Forms.Label label1; 
		///   
		/// 必需的设计器变量。 
		///  
		private System.ComponentModel.Container components = null; 
 
		public Form1 Parent_Form = null; 
		private PlanInfo thisPlanInfo = null; 
 
		public UC_UpdatePlan(PlanInfo info) 
		{ 
			// 该调用是 Windows.Forms 窗体设计器所必需的。 
			InitializeComponent(); 
 
			thisPlanInfo = info; 
			txt_Item.Text = info.Item; 
			txt_Desc.Text = info.Desc; 
			dtp_DateBegin.Value = info.DateBegin; 
			dtp_DateEnd.Value = info.DateEnd; 
			dtp_PlanDate.Value = info.PlanDate; 
			dtp_PlanDate.Enabled = false; 
			dtp_FinishDate.Value = info.FinishDate; 
			txt_Remarks.Text = info.Remarks; 
			ccb_Finished.Checked = info.Finished; 
			cbb_Level.Text = Global.ToLevel(info.Level); 
		} 
 
		///   
		/// 清理所有正在使用的资源。 
		///  
		protected override void Dispose( bool disposing ) 
		{ 
			if( disposing ) 
			{ 
				if(components != null) 
				{ 
					components.Dispose(); 
				} 
			} 
			base.Dispose( disposing ); 
		} 
 
		#region 组件设计器生成的代码 
		///   
		/// 设计器支持所需的方法 - 不要使用代码编辑器  
		/// 修改此方法的内容。 
		///  
		private void InitializeComponent() 
		{ 
			this.btn_Cancel = new System.Windows.Forms.Button(); 
			this.label8 = new System.Windows.Forms.Label(); 
			this.cbb_Level = new System.Windows.Forms.ComboBox(); 
			this.btn_Update = new System.Windows.Forms.Button(); 
			this.dtp_DateEnd = new System.Windows.Forms.DateTimePicker(); 
			this.dtp_DateBegin = new System.Windows.Forms.DateTimePicker(); 
			this.txt_Remarks = new System.Windows.Forms.TextBox(); 
			this.panel1 = new System.Windows.Forms.Panel(); 
			this.ccb_Finished = new System.Windows.Forms.CheckBox(); 
			this.dtp_FinishDate = new System.Windows.Forms.DateTimePicker(); 
			this.dtp_PlanDate = new System.Windows.Forms.DateTimePicker(); 
			this.label7 = new System.Windows.Forms.Label(); 
			this.label6 = new System.Windows.Forms.Label(); 
			this.txt_Desc = new System.Windows.Forms.TextBox(); 
			this.txt_Item = new System.Windows.Forms.TextBox(); 
			this.label5 = new System.Windows.Forms.Label(); 
			this.label4 = new System.Windows.Forms.Label(); 
			this.label3 = new System.Windows.Forms.Label(); 
			this.label2 = new System.Windows.Forms.Label(); 
			this.label1 = new System.Windows.Forms.Label(); 
			this.panel1.SuspendLayout(); 
			this.SuspendLayout(); 
			//  
			// btn_Cancel 
			//  
			this.btn_Cancel.Location = new System.Drawing.Point(516, 429); 
			this.btn_Cancel.Name = "btn_Cancel"; 
			this.btn_Cancel.TabIndex = 33; 
			this.btn_Cancel.Text = "取消"; 
			this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click); 
			//  
			// label8 
			//  
			this.label8.Location = new System.Drawing.Point(364, 93); 
			this.label8.Name = "label8"; 
			this.label8.Size = new System.Drawing.Size(80, 16); 
			this.label8.TabIndex = 21; 
			this.label8.Text = "截止日期:"; 
			//  
			// cbb_Level 
			//  
			this.cbb_Level.Items.AddRange(new object[] { 
														   "重要紧急", 
														   "重要不紧急", 
														   "不重要紧急", 
														   "不重要不紧急"}); 
			this.cbb_Level.Location = new System.Drawing.Point(156, 125); 
			this.cbb_Level.Name = "cbb_Level"; 
			this.cbb_Level.Size = new System.Drawing.Size(112, 20); 
			this.cbb_Level.TabIndex = 29; 
			this.cbb_Level.Text = "重要紧急"; 
			//  
			// btn_Update 
			//  
			this.btn_Update.Location = new System.Drawing.Point(420, 429); 
			this.btn_Update.Name = "btn_Update"; 
			this.btn_Update.TabIndex = 32; 
			this.btn_Update.Text = "修改"; 
			this.btn_Update.Click += new System.EventHandler(this.btn_Update_Click); 
			//  
			// dtp_DateEnd 
			//  
			this.dtp_DateEnd.CustomFormat = "yyyy-MM-dd"; 
			this.dtp_DateEnd.Location = new System.Drawing.Point(444, 93); 
			this.dtp_DateEnd.Name = "dtp_DateEnd"; 
			this.dtp_DateEnd.Size = new System.Drawing.Size(120, 21); 
			this.dtp_DateEnd.TabIndex = 28; 
			//  
			// dtp_DateBegin 
			//  
			this.dtp_DateBegin.Location = new System.Drawing.Point(156, 93); 
			this.dtp_DateBegin.Name = "dtp_DateBegin"; 
			this.dtp_DateBegin.Size = new System.Drawing.Size(120, 21); 
			this.dtp_DateBegin.TabIndex = 27; 
			//  
			// txt_Remarks 
			//  
			this.txt_Remarks.Location = new System.Drawing.Point(156, 285); 
			this.txt_Remarks.Multiline = true; 
			this.txt_Remarks.Name = "txt_Remarks"; 
			this.txt_Remarks.Size = new System.Drawing.Size(432, 56); 
			this.txt_Remarks.TabIndex = 31; 
			this.txt_Remarks.Text = ""; 
			//  
			// panel1 
			//  
			this.panel1.Controls.Add(this.ccb_Finished); 
			this.panel1.Controls.Add(this.dtp_FinishDate); 
			this.panel1.Controls.Add(this.dtp_PlanDate); 
			this.panel1.Controls.Add(this.label7); 
			this.panel1.Controls.Add(this.label6); 
			this.panel1.Location = new System.Drawing.Point(68, 357); 
			this.panel1.Name = "panel1"; 
			this.panel1.Size = new System.Drawing.Size(536, 72); 
			this.panel1.TabIndex = 25; 
			//  
			// ccb_Finished 
			//  
			this.ccb_Finished.Location = new System.Drawing.Point(16, 48); 
			this.ccb_Finished.Name = "ccb_Finished"; 
			this.ccb_Finished.TabIndex = 16; 
			this.ccb_Finished.Text = "是否已完成"; 
			//  
			// dtp_FinishDate 
			//  
			this.dtp_FinishDate.CustomFormat = "yyyy-MM-dd"; 
			this.dtp_FinishDate.Location = new System.Drawing.Point(376, 16); 
			this.dtp_FinishDate.Name = "dtp_FinishDate"; 
			this.dtp_FinishDate.Size = new System.Drawing.Size(120, 21); 
			this.dtp_FinishDate.TabIndex = 15; 
			//  
			// dtp_PlanDate 
			//  
			this.dtp_PlanDate.CustomFormat = "yyyy-MM-dd"; 
			this.dtp_PlanDate.Location = new System.Drawing.Point(88, 16); 
			this.dtp_PlanDate.Name = "dtp_PlanDate"; 
			this.dtp_PlanDate.Size = new System.Drawing.Size(120, 21); 
			this.dtp_PlanDate.TabIndex = 14; 
			//  
			// label7 
			//  
			this.label7.Location = new System.Drawing.Point(296, 16); 
			this.label7.Name = "label7"; 
			this.label7.Size = new System.Drawing.Size(80, 16); 
			this.label7.TabIndex = 7; 
			this.label7.Text = "完成日期:"; 
			//  
			// label6 
			//  
			this.label6.Location = new System.Drawing.Point(8, 16); 
			this.label6.Name = "label6"; 
			this.label6.Size = new System.Drawing.Size(80, 16); 
			this.label6.TabIndex = 6; 
			this.label6.Text = "计划日期:"; 
			//  
			// txt_Desc 
			//  
			this.txt_Desc.Location = new System.Drawing.Point(156, 157); 
			this.txt_Desc.Multiline = true; 
			this.txt_Desc.Name = "txt_Desc"; 
			this.txt_Desc.Size = new System.Drawing.Size(432, 112); 
			this.txt_Desc.TabIndex = 30; 
			this.txt_Desc.Text = ""; 
			//  
			// txt_Item 
			//  
			this.txt_Item.Location = new System.Drawing.Point(156, 61); 
			this.txt_Item.Name = "txt_Item"; 
			this.txt_Item.Size = new System.Drawing.Size(432, 21); 
			this.txt_Item.TabIndex = 26; 
			this.txt_Item.Text = ""; 
			//  
			// label5 
			//  
			this.label5.Location = new System.Drawing.Point(76, 125); 
			this.label5.Name = "label5"; 
			this.label5.Size = new System.Drawing.Size(80, 16); 
			this.label5.TabIndex = 22; 
			this.label5.Text = "优先级:"; 
			//  
			// label4 
			//  
			this.label4.Location = new System.Drawing.Point(76, 285); 
			this.label4.Name = "label4"; 
			this.label4.Size = new System.Drawing.Size(80, 16); 
			this.label4.TabIndex = 24; 
			this.label4.Text = "备注:"; 
			//  
			// label3 
			//  
			this.label3.Location = new System.Drawing.Point(76, 93); 
			this.label3.Name = "label3"; 
			this.label3.Size = new System.Drawing.Size(80, 16); 
			this.label3.TabIndex = 20; 
			this.label3.Text = "开始日期:"; 
			//  
			// label2 
			//  
			this.label2.Location = new System.Drawing.Point(76, 157); 
			this.label2.Name = "label2"; 
			this.label2.Size = new System.Drawing.Size(80, 16); 
			this.label2.TabIndex = 23; 
			this.label2.Text = "描述:"; 
			//  
			// label1 
			//  
			this.label1.Location = new System.Drawing.Point(76, 61); 
			this.label1.Name = "label1"; 
			this.label1.Size = new System.Drawing.Size(80, 16); 
			this.label1.TabIndex = 19; 
			this.label1.Text = "名称:"; 
			//  
			// UC_UpdatePlan 
			//  
			this.Controls.Add(this.btn_Cancel); 
			this.Controls.Add(this.label8); 
			this.Controls.Add(this.cbb_Level); 
			this.Controls.Add(this.btn_Update); 
			this.Controls.Add(this.dtp_DateEnd); 
			this.Controls.Add(this.dtp_DateBegin); 
			this.Controls.Add(this.txt_Remarks); 
			this.Controls.Add(this.panel1); 
			this.Controls.Add(this.txt_Desc); 
			this.Controls.Add(this.txt_Item); 
			this.Controls.Add(this.label5); 
			this.Controls.Add(this.label4); 
			this.Controls.Add(this.label3); 
			this.Controls.Add(this.label2); 
			this.Controls.Add(this.label1); 
			this.Name = "UC_UpdatePlan"; 
			this.Size = new System.Drawing.Size(672, 512); 
			this.panel1.ResumeLayout(false); 
			this.ResumeLayout(false); 
 
		} 
		#endregion 
 
		private void btn_Update_Click(object sender, System.EventArgs e) 
		{ 
			thisPlanInfo.Item = txt_Item.Text; 
			thisPlanInfo.Desc = txt_Desc.Text; 
			thisPlanInfo.DateBegin = dtp_DateBegin.Value; 
			thisPlanInfo.DateEnd = dtp_DateEnd.Value; 
			thisPlanInfo.PlanDate = DateTime.Today; 
			thisPlanInfo.FinishDate = dtp_FinishDate.Value; 
			thisPlanInfo.Remarks = txt_Remarks.Text; 
			thisPlanInfo.Finished = ccb_Finished.Checked; 
			thisPlanInfo.Level = Global.ToLevel(cbb_Level.Text); 
 
			Global.SaveConfig(); 
		 
			this.Visible = false; 
			Parent_Form.ReturnParent(this); 
		} 
 
		private void btn_Cancel_Click(object sender, System.EventArgs e) 
		{ 
			this.Visible = false; 
			Parent_Form.ReturnParent(this); 
		} 
	} 
}