新手求注释,要详细,本人初学者
新手求注释,要详细,本人菜鸟
RT 各位高手速度哈 急~~~~~~
RT 各位高手速度哈 急~~~~~~
- C# code
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace jinxiaocun { public partial class frmWindows_login : Form { int nCount = 0; public static string strLogin = ""; public static string strPwd = ""; public static int nXuanzhong = 0; string strSQL; public static int nsystem; public static int ncustormer; public static int nsupplie; public static int nstockmanage; public static int nsellmanage; public static int nreservemanage; public frmWindows_login() { InitializeComponent(); } private void frmWindows_login_Load(object sender, EventArgs e) { } private void btnDenglu_Click(object sender, EventArgs e) { strLogin = txtLogin.Text;//获取用户名的文本信息 strPwd = txtPwd.Text; //用户名和密码不能为空 if (strLogin == "" || strPwd == "") //||表示或者 { MessageBox.Show("用户名和密码不能为空"); return;//程序不再往后执行 } if (strLogin.IndexOf("'") >= 0) { MessageBox.Show("密码中不能含有'"); return; } if (rdbgly.Checked == true) { string strCountsql = "select count(*) from logintable where login='" + strLogin + "'"; int nCountresult = Convert.ToInt32(ConglyClass.returnStringSql(strCountsql)); if (nCountresult != 1){MessageBox.Show("你不是管理员/员工,无法登录!"); return;} nXuanzhong=1; } else if (rdbkehu.Checked == true) { string strCountsql = "select count(*) from custormer where Clogin='" + strLogin + "'"; int nCountresult = Convert.ToInt32(ConglyClass.returnStringSql(strCountsql)); if (nCountresult != 1){MessageBox.Show("你不是客户,无法登录!"); return;} nXuanzhong=2; } else { MessageBox.Show("请选择身份,再登录!"); return;} if(nXuanzhong==1){ strSQL = "select password from logintable where login='" + strLogin + "'"; }else{ strSQL = "select CPassword from custormer where CLogin='" + strLogin + "'"; } string strPwd2 = ConglyClass.returnStringSql(strSQL); if (strPwd == strPwd2)//判断密码是对的 { this.Hide(); if (nXuanzhong == 1) { string strsqlcount = "select COUNT(*) from limits_authority where [login]='" + strLogin + "'"; if (Convert.ToInt32(ConglyClass.returnStringSql(strsqlcount)) == 1) { string strsql = "SELECT system,custormer,supplie,stockmanage,sellmanage,reservemanage FROM limits_authority where [login]='"+strLogin+"'"; SqlDataReader sdrread = ConglyClass.getSqlDataReader(strsql); sdrread.Read(); nsystem = Convert.ToInt32(sdrread["system"]); ncustormer = Convert.ToInt32(sdrread["custormer"]); nsupplie=Convert.ToInt32(sdrread["supplie"]); nstockmanage=Convert.ToInt32(sdrread["stockmanage"]); nsellmanage=Convert.ToInt32(sdrread["sellmanage"]); nreservemanage=Convert.ToInt32(sdrread["reservemanage"]); } else { nsystem = 0; ncustormer = 0; nsupplie = 0; nstockmanage = 0; nsellmanage = 0; nreservemanage = 0; } frmSystem_interface frm = new frmSystem_interface(); frm.ShowDialog(); } if (frmChange_Password.nUpdate == 2) { this.Show(); txtPwd.Text = ""; frmChange_Password.nUpdate = 1; } else { this.Close(); } } else { //增加第一个功能:错误超过三次,则系统关闭,提示使用变量nCount nCount++;//值自动加1 MessageBox.Show("密码输入错误!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (nCount >= 3) this.Close(); } } private void btnRegister_Click(object sender, EventArgs e) { frmWindows_register frm2 = new frmWindows_register(); frm2.ShowDialog(); if (frmWindows_register.nRegister_status == 1) { txtLogin.Text = frmWindows_register.strLogin; txtPwd.Text = "";} } private void rdbkehu_CheckedChanged(object sender, EventArgs e) { } private void rdbgly_CheckedChanged(object sender, EventArgs e) { } } }//员工基本信息维护和客户资料管理