예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            取款       f  = new 取款();
            用户账户     g  = new 用户账户();
            DateTime dt = new DateTime();

            dt = DateTime.Now;
            DataSet ds;

            try
            {
                if (!(int.Parse(textBox_取款金额.Text.Trim()) > 0))
                {
                    MessageBox.Show("请输入正确金额");
                }
                else
                {
                    ds = g.user_get(sq, id);
                    if ((int.Parse(ds.Tables[0].Rows[0]["活期存款"].ToString()) - int.Parse(textBox_取款金额.Text.Trim().ToString())) > 0)
                    {
                        f.money_add(sq, id, textBox_取款金额.Text.Trim().ToString(), dt);
                        g.user_update_less(sq, id, "活期存款", textBox_取款金额.Text.Trim());
                        MessageBox.Show("您取出了" + textBox_取款金额.Text.Trim() + "元");
                    }
                    else
                    {
                        MessageBox.Show("你的存款没这么多,请重新输入");
                    }
                }
            }
            catch (Exception exx)
            {
                MessageBox.Show(exx.Message);
            }
        }
예제 #2
0
        private void button_登陆_Click(object sender, EventArgs e)
        {
            user s  = new user();
            用户账户 gg = new 用户账户();

            user_name = textBox_用户名.Text.Trim();
            user_mima = textBox_密码.Text.Trim();
            try
            {
                if (textBox_用户名.TextLength < 1)
                {
                    MessageBox.Show("用户名不能为空,请输入用户名");
                }
                else
                if (textBox_密码.TextLength < 1)
                {
                    MessageBox.Show("密码不能为空,请输入密码");
                }
                else
                if (!s.user_save(sq, textBox_用户名.Text.Trim()))
                {
                    MessageBox.Show("用户名错误,请输入正确的用户名");
                }
                else
                {
                    this.Visible     = false;
                    textBox_用户名.Text = "";
                    textBox_密码.Text  = "";
                    if (s.user_land(sq, user_name, user_mima))
                    {
                        id = sq.sql_select("select * from 用户 where 用户名=" + user_name + "", "id");
                        if (!gg.user_save(sq, id))
                        {
                            gg.user_add(sq, id, id);
                        }
                        主界面 f = new 主界面(sq, id, this);
                        f.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("密码错误");
                        this.Visible = true;
                    }
                }
            }
            catch (Exception exx)
            {
                MessageBox.Show(exx.Message);
            }
        }
예제 #3
0
        private void 主界面_Load(object sender, EventArgs e)
        {
            用户账户    f  = new 用户账户();
            DataSet ds = new DataSet();

            try
            {
                ds              = f.user_get(sq, id);
                label_名称.Text   = ds.Tables[0].Rows[0]["名称"].ToString();
                label_活期存款.Text = ds.Tables[0].Rows[0]["活期存款"].ToString();
                label_定期存款.Text = ds.Tables[0].Rows[0]["定期存款"].ToString();
            }
            catch (Exception eg)
            {
                MessageBox.Show(eg.Message);
            }
        }
예제 #4
0
        private void button_确定存款_Click(object sender, EventArgs e)
        {
            存款       c  = new 存款();
            用户账户     f  = new 用户账户();
            DateTime dt = new DateTime();

            dt = DateTime.Now;
            string g;

            if (comboBox_存款项目.Text.Trim().Equals("活期存款"))
            {
                g = "活期存款";
            }
            else
            {
                g = "定期存款";
            }
            try
            {
                if (comboBox_存款项目.Text.Length <= 0)
                {
                    MessageBox.Show("请选择您要存款的类型");
                }
                else
                if (textBox_金额.Text.Length <= 0)
                {
                    MessageBox.Show("输入您要存款的金额");
                }
                else
                if (!(int.Parse(textBox_金额.Text) > 0))
                {
                    MessageBox.Show("存款只能输入数字");
                }
                else
                {
                    c.money_add(sq, id, textBox_金额.Text.Trim().ToString(), comboBox_存款项目.Text.Trim(), dt);
                    f.user_update_add(sq, id, g, textBox_金额.Text.Trim());
                    MessageBox.Show("您存取了" + comboBox_存款项目.Text + "" + textBox_金额.Text.Trim() + "元");
                }
            }
            catch (Exception eeee)
            {
                MessageBox.Show(eeee.Message);
            }
        }