private void button1_Click(object sender, EventArgs e) { try { SysHandleInfo syshandleInfo = new SysHandleInfo(); bool b = false; int jibie_Id = 0; string sql = "select * from login_user"; DataTable dt = data.Query(sql); foreach (DataRow dr in dt.Rows) { if (this.comboBox1.Text == dr["_name"].ToString() && this.textBox1.Text == dr["_pass"].ToString()) { b = true; _UserName = dr["_name"].ToString(); _Pass = dr["_pass"].ToString(); jibie_Id = Convert.ToInt32(dr["_jibieid"]); string sql_id = "select * from jibie where id = '" + jibie_Id + "'"; DataTable dt1 = data.Query(sql_id); foreach (DataRow dr1 in dt1.Rows) { _RCGL = Convert.ToBoolean(dr1["_richang"]); _FYGL = Convert.ToBoolean(dr1["_fangyuan"]); _KHGL = Convert.ToBoolean(dr1["_kehu"]); _NBTJ = Convert.ToBoolean(dr1["_neibu"]); _XTSZ = Convert.ToBoolean(dr1["_xitong"]); } } } if (b == true) { syshandleInfo.HandlePerson = this.comboBox1.Text; syshandleInfo.HandleContent = "操作员登陆"; syshandleInfo.HandleRemark = this.comboBox1.Text + "登陆系统"; dl.InsertHandle(syshandleInfo); if (t != true)//第一次登陆 { mainform main = new mainform(); main.Show(); this.Visible = false; } else//登陆后切换用户 { this.Visible = false; } } else { MessageBox.Show("用户名或密码错误!", "提示信息", MessageBoxButtons.OK); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public int InsertHandle(SysHandleInfo syshandleInfo) { string date = DateTime.Now.ToString(); SqlParameter[] para = { data.MakeInParam("@HandlePerson", SqlDbType.VarChar, syshandleInfo.HandlePerson), data.MakeInParam("@HandleContent", SqlDbType.VarChar, syshandleInfo.HandleContent), data.MakeInParam("@HandleRemark", SqlDbType.VarChar, syshandleInfo.HandleRemark), data.MakeInParam("@date", SqlDbType.DateTime, date), }; string strsql = "insert into rizhi(time,person,concent,remark) values(@date,@HandlePerson,@HandleContent,@HandleRemark)"; return(data.RunSql(strsql, para)); }