private void button1_Click(object sender, EventArgs e)//确认修改 { Login.username = name; if (txtpassold.Text != passs) { MessageBox.Show("原密码输入错误!"); return; } else if (txtpassnew.Text != txtpassneww.Text) { MessageBox.Show("两次密码输入不正确!"); return; } user.Lname1 = txtuser1.Text; user.Lpass1 = txtpassnew.Text.ToString().Trim(); int i = SQLOperation.UpdatePwd(user); if (i > 0) { MessageBox.Show("成功修改密码!"); this.Hide(); Login FM = new Login(); FM.Show(); } else { MessageBox.Show("修改失败!"); } }
private void btn_login_Click(object sender, EventArgs e)//登录按钮 { tb_UserInfo User = new tb_UserInfo(); User.Lname1 = txtuser.Text.ToString().Trim(); User.Lpass1 = txtpass.Text.ToString().Trim(); if (txtuser.Text == "" || txtpass.Text == "") { MessageBox.Show("用户名或密码不能为空!"); if (txtuser.Text == "") { txtuser.Focus(); } else if (txtpass.Text == "") { txtpass.Focus(); } return; } else if (txtyzm.Text == "") { MessageBox.Show("验证码不能为空"); txtyzm.Focus(); return; } else if (txtyzm.Text != label4.Text) { MessageBox.Show("验证码输入有误"); txtyzm.Focus(); txtyzm.Clear(); label4.Text = YanZM(); return; } // string sql = "select * from Wm_Login where Lname=@userId and Lpass=@userpassword"; //DataRow row = Methods.GetRow(sql, new SqlParameter("@userId", txtuser.Text), new SqlParameter("@userpassword", txtpass.Text)); int flag = SQLOperation.ExistCount(User); if (flag > 0) { // MessageBox.Show("登录成功!\t"+flag.ToString()); Parameter_Query.username = this.txtuser.Text; Parameter_Query.userflag = flag; PassEdit.passs = this.txtpass.Text; Parameter_Query PQ = new Parameter_Query(); PQ.Show(); this.Hide(); return; } else { MessageBox.Show("不存在此用户!请重新登录!"); txtuser.Text = ""; txtpass.Text = ""; txtyzm.Text = ""; label4.Text = this.YanZM(); txtuser.Focus(); return; } }
private void Refreshing() { DataTable temptable1 = SQLOperation.QuerySensorInfo(""); bing.DataSource = temptable1; bing.Filter = ""; dataGridView1.DataSource = bing; }
private void button3_Click(object sender, EventArgs e)//删除 { string Iname = dataGridView1.CurrentRow.Cells[1].Value.ToString(); if (MessageBox.Show("确定删除该条信息吗?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) == DialogResult.Yes) { int i = SQLOperation.Delete_Info(Iname); MessageBox.Show("成功删除" + i + "条信息!"); Refreshing(); } }
private void ActorInfo_Load(object sender, EventArgs e) { DataTable temptable1 = SQLOperation.QueryActorInfo(""); bing.DataSource = temptable1; bing.Filter = ""; dataGridView1.DataSource = bing; // dataGridView1.RowHeadersVisible = false; dataGridView1.AllowUserToAddRows = false; change_name(); }
private void NodeInfoQuery_Load(object sender, EventArgs e) { DataTable temptable1 = SQLOperation.QuerySensorInfo(""); bing.DataSource = temptable1; bing.Filter = ""; dataGridView1.DataSource = bing; DataTable temptable2 = SQLOperation.QuerySensorInfo("NodeId"); txtnodeid.DataSource = temptable2; txtnodeid.DisplayMember = "NodeId"; txtnodeid.ValueMember = "NodeId"; // dataGridView1.RowHeadersVisible = false; dataGridView1.AllowUserToAddRows = false; //dataGridView1.Columns[0].Visible = false; change_name(); }
private void timer3_Tick(object sender, EventArgs e) { toolStripTextBox4.Text = DateTime.Now.ToString(); if (caiji) { reminder++; } if (reminder == 2) { info1.Iname = Infoid() + "1"; int i = SQLOperation.insert_Info(info1, 0); if (i <= 0) { MessageBox.Show("添加记录失败!"); } } if (reminder == 3) { info2.Iname = Infoid() + "2"; int k = SQLOperation.insert_Info(info2, 0); if (k <= 0) { MessageBox.Show("添加记录失败!"); } } if (reminder == 5) { reminder = 0; info3.Iname = Infoid() + "3"; int j = SQLOperation.insert_Info(info3, 0); if (j <= 0) { MessageBox.Show("添加记录失败!"); } } }