private void b1_Click(object sender, EventArgs e) { client = new RedisClient("127.0.0.1", 6379); s1 = username.Text; s2 = pwd.Text; if (s1 == "") { MessageBox.Show("用户名不能为空!"); } else { if (s2 == "") { MessageBox.Show("密码不能为空!"); } else if (client.Get <string>(s1) == s2 && client.Exists(s1) == 1) { this.Visible = false; Login_in f = new Login_in(); url = username.Text; f.user = url; f.ShowDialog(); } else { MessageBox.Show("登录失败!"); } } }
private void t_exit_Click(object sender, EventArgs e) { DialogResult s; s = MessageBox.Show("是否退出", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);//消息框有返回值 if (s == DialogResult.OK) { Login_in f = new Login_in(); f.Close(); } }
private void b_buy_Click(object sender, EventArgs e) { if (Convert.ToInt32(b_nu) < Convert.ToInt32(buy_book_num)) //库存量不够,无法购买 { MessageBox.Show("当前库存不足"); } else { if (Convert.ToDouble(price) < Convert.ToDouble(un) * Convert.ToInt32(b_nu))//获取余额,金额不足充值 { MessageBox.Show("您的余额不足,无法购买,请先充值"); } else { MessageBox.Show("购买成功");//提示购买成功,(做三件事)在My_account里显示购买记录,在Login_in里修改库存,在My_account里修改我的余额 My_accont f = new My_accont(); f.history_of_buy = t_1.Text; Login_in f1 = new Login_in(); } } }