www.pudn.com > CRM.rar > logon.cs


using System; 
using System.Drawing; 
using System.Collections; 
using System.ComponentModel; 
using System.Windows.Forms; 
using System.Runtime.InteropServices; 
 
namespace WindowsApplication1 
{ 
	///  
	/// logon 的摘要说明。 
	///  
	public class logon : System.Windows.Forms.Form 
	{ 
//		[DllImport("appface.dll")] 
//		public static extern long SkinStart(string SkinFile,int nDefWinType,string CheckSum,long nType, 
//			long hInstance,long nLen); 
//		[DllImport("appface.dll")] 
//		public static extern long SkinRemove() ; 
 
		private System.Windows.Forms.Label label2; 
		private System.Windows.Forms.Button button2; 
		private System.Windows.Forms.Button button1; 
		private System.Windows.Forms.Label label3; 
		private System.Windows.Forms.TextBox textBox1; 
		private System.Windows.Forms.Label l1; 
		private System.Windows.Forms.Label label1; 
		private System.Windows.Forms.TextBox textBox2; 
		private System.Windows.Forms.Panel panel1; 
		private System.Windows.Forms.Button button3; 
		//public  string powerclass; 
		///  
		/// 必需的设计器变量。 
		///  
		private System.ComponentModel.Container components = null; 
 
		public logon() 
		{ 
			// 
			// Windows 窗体设计器支持所必需的 
			// 
			InitializeComponent(); 
 
			// 
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码 
			// 
		} 
 
		///  
		/// 清理所有正在使用的资源。 
		///  
		protected override void Dispose( bool disposing ) 
		{ 
			if( disposing ) 
			{ 
				if(components != null) 
				{ 
					components.Dispose(); 
				} 
			} 
			base.Dispose( disposing ); 
		} 
 
		#region Windows 窗体设计器生成的代码 
		///  
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改 
		/// 此方法的内容。 
		///  
		private void InitializeComponent() 
		{ 
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(logon)); 
			this.label2 = new System.Windows.Forms.Label(); 
			this.button2 = new System.Windows.Forms.Button(); 
			this.button1 = new System.Windows.Forms.Button(); 
			this.label3 = new System.Windows.Forms.Label(); 
			this.textBox1 = new System.Windows.Forms.TextBox(); 
			this.l1 = new System.Windows.Forms.Label(); 
			this.label1 = new System.Windows.Forms.Label(); 
			this.textBox2 = new System.Windows.Forms.TextBox(); 
			this.panel1 = new System.Windows.Forms.Panel(); 
			this.button3 = new System.Windows.Forms.Button(); 
			this.panel1.SuspendLayout(); 
			this.SuspendLayout(); 
			//  
			// label2 
			//  
			this.label2.BackColor = System.Drawing.Color.Transparent; 
			this.label2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); 
			this.label2.Location = new System.Drawing.Point(0, 112); 
			this.label2.Name = "label2"; 
			this.label2.Size = new System.Drawing.Size(272, 16); 
			this.label2.TabIndex = 17; 
			this.label2.Text = "请向开发者购买本软件,QQ:383224716"; 
			//  
			// button2 
			//  
			this.button2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button2.BackgroundImage"))); 
			this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; 
			this.button2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); 
			this.button2.Location = new System.Drawing.Point(112, 88); 
			this.button2.Name = "button2"; 
			this.button2.Size = new System.Drawing.Size(56, 24); 
			this.button2.TabIndex = 4; 
			this.button2.Text = "取消"; 
			this.button2.Click += new System.EventHandler(this.button2_Click); 
			//  
			// button1 
			//  
			this.button1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button1.BackgroundImage"))); 
			this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; 
			this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); 
			this.button1.Location = new System.Drawing.Point(32, 88); 
			this.button1.Name = "button1"; 
			this.button1.Size = new System.Drawing.Size(56, 24); 
			this.button1.TabIndex = 3; 
			this.button1.Text = "登录"; 
			this.button1.Click += new System.EventHandler(this.button1_Click); 
			//  
			// label3 
			//  
			this.label3.BackColor = System.Drawing.Color.Transparent; 
			this.label3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); 
			this.label3.ForeColor = System.Drawing.Color.Green; 
			this.label3.Location = new System.Drawing.Point(8, 32); 
			this.label3.Name = "label3"; 
			this.label3.Size = new System.Drawing.Size(40, 23); 
			this.label3.TabIndex = 12; 
			this.label3.Text = "密码"; 
			//  
			// textBox1 
			//  
			this.textBox1.Location = new System.Drawing.Point(64, 0); 
			this.textBox1.Name = "textBox1"; 
			this.textBox1.Size = new System.Drawing.Size(176, 21); 
			this.textBox1.TabIndex = 1; 
			this.textBox1.Text = ""; 
			//  
			// l1 
			//  
			this.l1.BackColor = System.Drawing.Color.Transparent; 
			this.l1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); 
			this.l1.ForeColor = System.Drawing.Color.Green; 
			this.l1.Location = new System.Drawing.Point(0, 0); 
			this.l1.Name = "l1"; 
			this.l1.Size = new System.Drawing.Size(56, 23); 
			this.l1.TabIndex = 10; 
			this.l1.Text = "用户名"; 
			//  
			// label1 
			//  
			this.label1.BackColor = System.Drawing.Color.Transparent; 
			this.label1.Font = new System.Drawing.Font("楷体_GB2312", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); 
			this.label1.ForeColor = System.Drawing.Color.ForestGreen; 
			this.label1.Location = new System.Drawing.Point(80, 0); 
			this.label1.Name = "label1"; 
			this.label1.Size = new System.Drawing.Size(112, 24); 
			this.label1.TabIndex = 9; 
			this.label1.Text = "CRMS登录"; 
			//  
			// textBox2 
			//  
			this.textBox2.Location = new System.Drawing.Point(64, 32); 
			this.textBox2.Name = "textBox2"; 
			this.textBox2.PasswordChar = '*'; 
			this.textBox2.Size = new System.Drawing.Size(176, 21); 
			this.textBox2.TabIndex = 2; 
			this.textBox2.Text = ""; 
			//  
			// panel1 
			//  
			this.panel1.BackColor = System.Drawing.Color.Transparent; 
			this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 
			this.panel1.Controls.Add(this.label3); 
			this.panel1.Controls.Add(this.l1); 
			this.panel1.Controls.Add(this.textBox2); 
			this.panel1.Controls.Add(this.textBox1); 
			this.panel1.ForeColor = System.Drawing.Color.DarkViolet; 
			this.panel1.Location = new System.Drawing.Point(8, 24); 
			this.panel1.Name = "panel1"; 
			this.panel1.Size = new System.Drawing.Size(248, 64); 
			this.panel1.TabIndex = 18; 
			//  
			// button3 
			//  
			this.button3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button3.BackgroundImage"))); 
			this.button3.DialogResult = System.Windows.Forms.DialogResult.Cancel; 
			this.button3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); 
			this.button3.Location = new System.Drawing.Point(192, 88); 
			this.button3.Name = "button3"; 
			this.button3.Size = new System.Drawing.Size(56, 24); 
			this.button3.TabIndex = 19; 
			this.button3.Text = "Service"; 
			this.button3.Click += new System.EventHandler(this.button3_Click); 
			//  
			// logon 
			//  
			this.AcceptButton = this.button1; 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); 
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage"))); 
			this.CancelButton = this.button2; 
			this.ClientSize = new System.Drawing.Size(264, 126); 
			this.ControlBox = false; 
			this.Controls.Add(this.button3); 
			this.Controls.Add(this.panel1); 
			this.Controls.Add(this.label2); 
			this.Controls.Add(this.button2); 
			this.Controls.Add(this.button1); 
			this.Controls.Add(this.label1); 
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 
			this.KeyPreview = true; 
			this.Name = "logon"; 
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 
			this.Text = "格瑞特展览"; 
			this.Load += new System.EventHandler(this.logon_Load); 
			this.panel1.ResumeLayout(false); 
			this.ResumeLayout(false); 
 
		} 
		#endregion 
 
		///  
		/// 应用程序的主入口点。 
		///  
		[STAThread] 
		static void Main()  
		{ 
//			SkinStart("GtClassic.urf",0,"",1,0,0); 
Application.Run(new logon()); 
//			SkinRemove(); 
	//Application.Run(new Form1()); 
	//Application.Run(new main("ln","0")); 
		//Application.Run(new Form2()); 
		} 
 
		private void button1_Click(object sender, System.EventArgs e) 
		{ 
			DateTime tim; 
			tim=DateTime.Parse("2006-10-19"); 
			if(DateTime.Today>tim) 
			{MessageBox.Show("program died \r please connection with the developer! \r email:mmbhs@126.com","提示"); 
			return;}											 
				 
			try 
			{ 
				if (this.textBox1.Text=="" || this.textBox2.Text=="") 
				{ 
					MessageBox.Show(this,"用户名或者密码不能为空"); 
					return; 
				} 
				string[] result; 
				dbaccess access; 
				access=new dbaccess(); 
				result=access.usercheck(this.textBox1.Text.Trim(),this.textBox2.Text.Trim()); 
				MessageBox.Show(result[1].ToString()); 
				if(result[1].ToString()=="成功登陆!") 
				{ 
					main_win kk= new main_win(result[2],this.textBox1.Text.ToString()); 
					kk.Show(); 
					this.Visible=false;	 
 
				} 
			} 
			catch(Exception e2) 
			{MessageBox.Show(e2.Message,"连接失败");} 
			    																		 
		} 
 
		private void button2_Click(object sender, System.EventArgs e) 
		{ 
		Application.Exit(); 
		} 
 
		private void logon_Load(object sender, System.EventArgs e) 
		{ 
			 
		} 
 
		private void button3_Click(object sender, System.EventArgs e) 
		{ 
			service jj =new service(); 
			jj.Show(); 
		} 
	} 
}