⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmlogin.cs

📁 c#编写的汽车销售公司erp进销存系统
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using CallCenter.BusinessLayer;
using CallCenter.DALFactory;
using CallCenter.IDAL;
using CallCenter.Modules;
using CallCenter.OracleDAL;
using System.Data;
using CallCenter.BusinessInterfaces.MainForms;

namespace CallCenter.BusinessInterfaces.MainForms
{
	/// <summary>
	/// frmLogIn 的摘要说明。
	/// </summary>
	public class frmLogIn : System.Windows.Forms.Form
	{
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.ComboBox cbo_Operator;
		private System.Windows.Forms.TextBox txt_PassWord;
		private System.Windows.Forms.Button cmd_OK;
		private System.Windows.Forms.Button cmd_Cancel;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.DateTimePicker dtp_LogInDate;
		private System.Windows.Forms.Label lblSplit;
		private int i=0;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmLogIn()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmLogIn));
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.cbo_Operator = new System.Windows.Forms.ComboBox();
			this.txt_PassWord = new System.Windows.Forms.TextBox();
			this.dtp_LogInDate = new System.Windows.Forms.DateTimePicker();
			this.cmd_OK = new System.Windows.Forms.Button();
			this.cmd_Cancel = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.lblSplit = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// 
			// pictureBox1
			// 
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(6, 14);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(78, 80);
			this.pictureBox1.TabIndex = 0;
			this.pictureBox1.TabStop = false;
			// 
			// cbo_Operator
			// 
			this.cbo_Operator.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
			this.cbo_Operator.Location = new System.Drawing.Point(164, 40);
			this.cbo_Operator.Name = "cbo_Operator";
			this.cbo_Operator.Size = new System.Drawing.Size(108, 20);
			this.cbo_Operator.TabIndex = 1;
			// 
			// txt_PassWord
			// 
			this.txt_PassWord.Location = new System.Drawing.Point(164, 64);
			this.txt_PassWord.Name = "txt_PassWord";
			this.txt_PassWord.PasswordChar = '*';
			this.txt_PassWord.Size = new System.Drawing.Size(108, 21);
			this.txt_PassWord.TabIndex = 2;
			this.txt_PassWord.Text = "";
			// 
			// dtp_LogInDate
			// 
			this.dtp_LogInDate.CustomFormat = "yyyy-MM-dd";
			this.dtp_LogInDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
			this.dtp_LogInDate.Location = new System.Drawing.Point(164, 12);
			this.dtp_LogInDate.Name = "dtp_LogInDate";
			this.dtp_LogInDate.Size = new System.Drawing.Size(108, 21);
			this.dtp_LogInDate.TabIndex = 3;
			this.dtp_LogInDate.Value = new System.DateTime(2004, 11, 1, 0, 0, 0, 0);
			// 
			// cmd_OK
			// 
			this.cmd_OK.Location = new System.Drawing.Point(136, 96);
			this.cmd_OK.Name = "cmd_OK";
			this.cmd_OK.Size = new System.Drawing.Size(58, 24);
			this.cmd_OK.TabIndex = 4;
			this.cmd_OK.Text = "确定(&O)";
			this.cmd_OK.Click += new System.EventHandler(this.cmd_OK_Click);
			// 
			// cmd_Cancel
			// 
			this.cmd_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cmd_Cancel.Location = new System.Drawing.Point(210, 96);
			this.cmd_Cancel.Name = "cmd_Cancel";
			this.cmd_Cancel.Size = new System.Drawing.Size(58, 24);
			this.cmd_Cancel.TabIndex = 5;
			this.cmd_Cancel.Text = "取消(&C)";
			this.cmd_Cancel.Click += new System.EventHandler(this.cmd_Cancel_Click);
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(106, 14);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(54, 17);
			this.label1.TabIndex = 6;
			this.label1.Text = "日  期:";
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(108, 42);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(54, 17);
			this.label2.TabIndex = 7;
			this.label2.Text = "操作员:";
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.BackColor = System.Drawing.SystemColors.Menu;
			this.label3.Location = new System.Drawing.Point(108, 68);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(54, 17);
			this.label3.TabIndex = 8;
			this.label3.Text = "密  码:";
			// 
			// lblSplit
			// 
			this.lblSplit.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.lblSplit.ForeColor = System.Drawing.SystemColors.ControlLightLight;
			this.lblSplit.Location = new System.Drawing.Point(-64, 124);
			this.lblSplit.Name = "lblSplit";
			this.lblSplit.Size = new System.Drawing.Size(436, 3);
			this.lblSplit.TabIndex = 9;
			this.lblSplit.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// frmLogIn
			// 
			this.AcceptButton = this.cmd_OK;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.SystemColors.Menu;
			this.CancelButton = this.cmd_Cancel;
			this.ClientSize = new System.Drawing.Size(296, 146);
			this.ControlBox = false;
			this.Controls.Add(this.lblSplit);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.txt_PassWord);
			this.Controls.Add(this.cmd_Cancel);
			this.Controls.Add(this.cmd_OK);
			this.Controls.Add(this.dtp_LogInDate);
			this.Controls.Add(this.cbo_Operator);
			this.Controls.Add(this.pictureBox1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Name = "frmLogIn";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "登录";
			this.TopMost = true;
			this.Load += new System.EventHandler(this.frmLogIn_Load);
			this.ResumeLayout(false);

		}
		#endregion
		private void frmLogIn_Load(object sender, System.EventArgs e)
		{
			dtp_LogInDate.Text=DateTime.Today.ToString() ;
			
		}
	
		private void ReadIniFile()
		{
			SysoperatorBLL sysbll=new SysoperatorBLL();
			SysoperatorInfo sysinfo=new SysoperatorInfo();
			sysinfo=sysbll.getSysoperatorByLname(cbo_Operator.Text );

			ShareClass.Operator =cbo_Operator.Text;
			ShareClass.OperatorChinese=sysinfo.oname;
			ShareClass.LoginDate=dtp_LogInDate.Text ;
		}


		private void cmd_OK_Click(object sender, System.EventArgs e)
		{
			if (RightCheck(cbo_Operator.Text,txt_PassWord.Text)==false)
			{
				i++;
				if(i==3)
				{
					DialogResult=DialogResult.Cancel;
//					ShareClass.loginfail="exit";
				}
//				else
//				{
//					ShareClass.loginfail="fail";
//					
//					txt_PassWord.Focus(); 
//					return ;
//				}
			}
			else
			{
				
				ReadIniFile();
				DialogResult=DialogResult.OK;			
				this.Close();
				
			}
		}
	

		private void cmd_Cancel_Click(object sender, System.EventArgs e)
		{
			this.Close();
			Application.Exit();
		}
           /// <summary>
           /// 操作员登录验证
           /// </summary>
           /// <param name="p_Operator"></param>
           /// <param name="p_Pws"></param>
           /// <returns></returns>
		private bool RightCheck(string p_Operator,string p_Pws)
		{
			try
			{
				SysoperatorBLL sysbll=new SysoperatorBLL();
				SysoperatorInfo sysinfo=new SysoperatorInfo();
				sysinfo=sysbll.login(p_Operator,p_Pws);
				if(sysinfo.lname!=cbo_Operator.Text || cbo_Operator.Text=="")
				{
					MessageBox.Show("用户名输入错误,请重新输入!","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
					cbo_Operator.Focus();
					return false;
				}
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
			return true;
			
		}





	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -