示例#1
0
        //点击注册按钮,返回一张注册记录表
        private void btnRegist_Click(object sender, EventArgs e)
        {
            Facade.Consumers cs = new Facade.Consumers();
            DataTable        dt = cs.ReturnRegister();

            dataGridView1.DataSource = dt;
        }
示例#2
0
        //点击充值按钮,返回一张充值记录表
        private void button4_Click(object sender, EventArgs e)
        {
            Facade.Consumers cs = new Facade.Consumers();
            DataTable        dt = cs.ReturnRecharge();

            dataGridView3.DataSource = dt;
        }
示例#3
0
        private void UpdaeTable()
        {
            Facade.Consumers csinfo = new Facade.Consumers();
            DataTable        dt     = csinfo.CheckConsumers();

            dataGridView1.DataSource = dt;
        }
示例#4
0
        //点击退款按钮,从数据库中读取退款时收的钱
        private void button2_Click(object sender, EventArgs e)
        {
            Facade.Consumers cs = new Facade.Consumers();
            DataTable        dt = cs.ReturnBackInfo();

            dataGridView2.DataSource = dt;
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)  //点击查看用户余额按钮
        {
            string cardno = txtCardNo.Text.Trim();

            Facade.Consumers consumer = new Facade.Consumers();
            txtMoney.Text = consumer.LookMoney(cardno);
        }
        private void frmCheckConsumeStation_Load(object sender, EventArgs e) //窗体加载情况
        {
            //将ConsumeForm中的消费记录绑定到DataGrideView中
            string cardno = Entity.GoAnyWhere.id;

            Facade.Consumers consumeinfo = new Facade.Consumers();
            DataTable        dt          = consumeinfo.CheckConsumeInfo(cardno);

            dataGridView1.DataSource = dt;
        }
示例#7
0
        private void btnOk_Click(object sender, EventArgs e) //点击确定修改按钮
        {
            string cardno = Entity.GoAnyWhere.cardno;        //从全局变量获取cardno值
            string status = cboStatus.Text.Trim();           //获取状态信息

            Facade.Consumers cs = new Facade.Consumers();
            int result          = cs.UpdateStatus(cardno, status);

            if (result > 0)
            {
                MessageBox.Show("修改用户状态成功!", "温馨提示");
            }
        }
示例#8
0
        private void btnOK_Click(object sender, EventArgs e) //确定充值按钮
        {
            string cardno = txtCardno.Text.Trim();
            int    money  = Convert.ToInt32(txtMoney.Text.Trim());

            Facade.Consumers cs = new Facade.Consumers();
            int result          = cs.Recharge(cardno, money);

            if (result > 0)
            {
                MessageBox.Show("充值成功!", "温馨提示");
            }
        }
示例#9
0
        private void frmModifyCsInfo_Load(object sender, EventArgs e)  //窗体加载事件
        {
            string cardno = Entity.GoAnyWhere.cardno;

            Facade.Consumers cs = new Facade.Consumers();
            DataTable        dt = cs.ReturnConsumeinfo(cardno);

            //将查询到的数据显示到界面上
            txtCardno.Text   = Convert.ToString(dt.Rows[0][0]);
            txtName.Text     = Convert.ToString(dt.Rows[0][1]);
            txtAge.Text      = Convert.ToString(dt.Rows[0][2]);
            cboGender.Text   = Convert.ToString(dt.Rows[0][3]);
            txtAddMoney.Text = Convert.ToString(dt.Rows[0][4]);
            cboStatus.Text   = Convert.ToString(dt.Rows[0][5]);
        }
示例#10
0
        private void button1_Click(object sender, EventArgs e)  //退出系统按钮
        {
            //获取上机时间
            DateTime dts       = Convert.ToDateTime(lblLoginTime.Text);
            string   logintime = dts.GetDateTimeFormats('g')[0].ToString();
            //获取下机时间
            DateTime dtr     = DateTime.Now;
            string   rq      = dtr.ToShortDateString().ToString();
            DateTime dts2    = Convert.ToDateTime(rq + " " + n1.Value + ":" + n2.Value);
            string   offtime = dts2.GetDateTimeFormats('g')[0].ToString();
            //得出时间间隔
            TimeSpan dt = Convert.ToDateTime(offtime) - Convert.ToDateTime(logintime);
            int      jg = Convert.ToInt32(Convert.ToString(dt.TotalMinutes));
            //获得单位时间金额设置值

            int i, j;
            int k = 1;

            for (int num = 0; num < 100; num++)
            {
                i = 5 * num;
                j = 5 * (num + 1);
                if (i < jg && j >= jg)
                {
                    k = 1 + num;
                }
            }
            //计算剩余金额
            int sy = Convert.ToInt32(lblLoginMoney.Text.Trim()) - k;
            //更新数据库余额
            string id = lblLoginId.Text.Trim();

            Facade.Consumers cs = new Facade.Consumers();
            cs.UpdateMoney(id, sy);
            //在消费记录表中插入一条新的消费信息
            Entity.Money consumeinfo = new Entity.Money();
            consumeinfo.cardno         = lblLoginId.Text.Trim();
            consumeinfo.logintime      = Convert.ToDateTime(lblLoginTime.Text.Trim());
            consumeinfo.offtime        = Convert.ToDateTime(offtime);
            consumeinfo.consumetime    = jg;
            consumeinfo.consume        = k;
            consumeinfo.remaindermoney = sy;
            cs.InsertConsumeInfo(consumeinfo);

            //退出系统
            MessageBox.Show("上机时间为:" + jg + "," + "消费金额为:" + k + "," + "剩余金额为:" + sy, "温馨提示");
        }
示例#11
0
        private void button1_Click(object sender, EventArgs e) //点击确定添加按钮
        {
            Facade.Consumers consumer = new Facade.Consumers();
            //判断卡号是否存在
            string    cardno = txtCardno.Text.Trim();
            DataTable dt     = consumer.ReturnConsumeinfo(cardno);

            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("此用户已存在,请确认后重新输入!", "温馨提示");
                txtCardno.SelectAll();
            }
            else
            {
                Entity.Consumers cs = new Entity.Consumers();
                cs.cardno  = txtCardno.Text.Trim();
                cs.name    = txtName.Text.Trim();
                cs.age     = txtAge.Text.Trim();
                cs.gender  = cboGender.Text.Trim();
                cs.money   = txtAddMoney.Text.Trim();
                cs.status  = cboStatus.Text.Trim();
                cs.sno     = Entity.GoAnyWhere.id;
                cs.addtime = DateTime.Now;
                //将界面获取的数据插入到数据库中

                int result = consumer.addconsumers(cs);   //插入到消费者信息表
                if (result > 0)
                {
                    MessageBox.Show("添加成功!", "温馨提示");
                    //将消费者信息插入到登录表中
                    Entity.Login user = new Entity.Login();
                    user.username = txtCardno.Text.Trim();
                    user.password = "******";
                    user.level    = "用户";
                    user.status   = cboStatus.Text.Trim();
                    Facade.LoginUsers fuser = new Facade.LoginUsers();
                    int result2             = fuser.addusers(user);
                }
                else
                {
                    MessageBox.Show("添加失败,请联系管理员", "温馨提示");
                }
            }
        }
示例#12
0
        private void frmMain_Load(object sender, EventArgs e) //窗体加载事件
        {
            if (Entity.GoAnyWhere.level.Trim() == "用户")
            {
                panel2.Hide();
                panel3.Hide();
                label3.Visible        = true;
                lblLoginTime.Visible  = true;
                label5.Visible        = true;
                lblLoginId.Visible    = true;
                label7.Visible        = true;
                lblLoginMoney.Visible = true;
                label9.Visible        = true;
                label10.Visible       = true;
                label11.Visible       = true;
                label12.Visible       = true;
                label13.Visible       = true;
                label14.Visible       = true;

                DateTime dt = DateTime.Now;
                lblLoginTime.Text = dt.GetDateTimeFormats('g')[0].ToString();
                lblLoginId.Text   = Entity.GoAnyWhere.id;
                //根据id获取用户余额
                Facade.Consumers cs = new Facade.Consumers();
                lblLoginMoney.Text = cs.CheckMoney(Entity.GoAnyWhere.id);

                label10.Text = "5";
                label12.Text = "1";
                label14.Text = Convert.ToString(Convert.ToInt32(lblLoginMoney.Text) - 1);
            }
            else if (Entity.GoAnyWhere.level.Trim() == "收银员")
            {
                panel1.Hide();
                panel3.Hide();
                panel4.Hide();
            }
            else
            {
                panel1.Hide();
                panel2.Hide();
                panel4.Hide();
            }
        }
示例#13
0
        private void btnBackMoney_Click(object sender, EventArgs e) //点击退款按钮
        {
            //根据id清空其余额
            string cardno = txtCardNo.Text.Trim();

            Facade.Consumers consumer = new Facade.Consumers();
            consumer.UpdateMoney(cardno, 0);
            //将一行退卡信息插入到数据库
            Entity.BackMoney backmoney = new Entity.BackMoney();
            backmoney.cardno   = cardno;
            backmoney.money    = txtMoney.Text.Trim();
            backmoney.operater = Entity.GoAnyWhere.id;
            backmoney.time     = DateTime.Now;
            int result = consumer.AddBackInfo(backmoney);

            if (result > 0)
            {
                MessageBox.Show("退卡成功!", "温馨提示");
            }
            else
            {
                MessageBox.Show("退卡失败,请联系管理员!", "温馨提示");
            }
        }
示例#14
0
 //点击充值金额总数按钮
 private void button8_Click(object sender, EventArgs e)
 {
     Facade.Consumers cs = new Facade.Consumers();
     txtRechargeSum.Text = Convert.ToString(cs.ReturnRechargeSum());
 }