コード例 #1
0
        private void cmbMemmber_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(cmbMemmber.SelectedIndex != 0)
            {
                MemberInfoBLL bll = new MemberInfoBLL();
                MemberInfo mem = cmbMemmber.SelectedItem as MemberInfo;
                //memberType
                labTp.Text = bll.GetMemberTypeByMemberId(mem.MemmberId);
                //member money
                labyeMoney.Text = mem.MemMoney.ToString();
                //discount
                lblDis.Text = mem.MemDiscount.ToString();

                //show the money after discount
                lblMoney.Text = (Convert.ToDecimal(labMoney.Text) * mem.MemDiscount / 10).ToString();
            }
            else
            {
                labTp.Text = "";
                labyeMoney.Text = "";
                lblDis.Text = "";
                //show the bill money for non-member (no discount)
                lblMoney.Text = labMoney.Text;
            }
        }
コード例 #2
0
 private void LoadMemberInfoDelFlag(int p)
 {
     MemberInfoBLL bll = new MemberInfoBLL();
     List<MemberInfo> list = bll.GetAllMemberInfoByDelFlag(p);
     list.Insert(0, new MemberInfo() { MemmberId = -1, MemName = "请选择" });
     cmbMemmber.DataSource = list;
     cmbMemmber.DisplayMember = "MemName";
     cmbMemmber.ValueMember = "MemmberId";
 }
コード例 #3
0
 //删除会员
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if(dgvMemmber.SelectedRows.Count>0)
     {
         int id = Convert.ToInt32(dgvMemmber.SelectedRows[0].Cells[0].Value.ToString());
         MemberInfoBLL bll = new MemberInfoBLL();
         string msg = bll.DeleteMemberInfoByMemberId(id) ? "操作成功" : "操作失败";
         MessageBox.Show(msg);
         LoadMemberInfoByDelFlag(0);
     }
 }
コード例 #4
0
 private void LoadMemberInfoByDelFlag(int p)
 {
     MemberInfoBLL bll = new MemberInfoBLL();
     //禁止自动生成列
     dgvMemmber.AutoGenerateColumns = false;
     dgvMemmber.DataSource = bll.GetAllMemberInfoByDelFlag(0);
     dgvMemmber.SelectedRows[0].Selected = false;
     //dataGridView1.AutoGenerateColumns = false;
     //.DataSource = bll.GetAllMemberInfoByDelFlag(0);
     //禁止默认第一行选中
     //dataGridView1.SelectedRows[0].Selected = false;
 }
コード例 #5
0
 //修改会员
 private void btnUpdateMember_Click(object sender, EventArgs e)
 {
     if(dgvMemmber.SelectedRows.Count > 0)
     {
         //获取选中行的id
         //根据id去数据库查询
         int id = Convert.ToInt32(dgvMemmber.SelectedRows[0].Cells[0].Value.ToString());
         //去查询数据库数据
         MemberInfoBLL bll = new MemberInfoBLL();
         mea.Obj = bll.GetMemmberInfoByMemmberId(id);
         ShowFrmUpdateMemberInfo(2);
     }
     else
     {
         MessageBox.Show("请选择要修改的行");
     }
     
 }
コード例 #6
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (CheckEmpty())
            {
                //获取每一个文本框的值
                MemberInfo mem = new MemberInfo();
                mem.MemBirthdaty = Convert.ToDateTime(txtBirs.Text);
                mem.MemDiscount = Convert.ToDecimal(txtMemDiscount.Text);
                mem.MemEndServerTime = Convert.ToDateTime(dtEndServerTime.Text);
                mem.MemGender = CheckGender();
                mem.MemIntegral = Convert.ToInt32(txtMemIntegral.Text);
                //mem.MemmberId = Convert.ToInt32(labId.Text);
                mem.MemMobilePhone = txtMemPhone.Text;
                mem.MemMoney = Convert.ToDecimal(txtmemMoney.Text);
                mem.MemNum = txtMemNum.Text;
                mem.MemNum = txtMemName.Text;
                mem.MemType = Convert.ToInt32(cmbMemType.SelectedValue);
                if (this.TP == 1)
                {
                    //Insert
                    mem.SubTime = System.DateTime.Now;
                    mem.DelFlag = 0;
                }
                else if (this.TP == 2)
                {
                    //Update
                    mem.MemmberId = Convert.ToInt32(labId.Text);
                }
                MemberInfoBLL bll = new MemberInfoBLL();
                string msg = bll.SaveMemberInfo(mem, this.TP)?"操作成功":"操作失败";
                MessageBox.Show(msg);
                this.Close();
            }

        }
コード例 #7
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            int n = 0;
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                LoadMemberInfoByDelFlag(0);
                return;
            }

            if (char.IsDigit(textBox1.Text[0]))
            {
                n = 2;
            }
            else
            {
                n = 1;
            }
            MemberInfoBLL bll = new MemberInfoBLL();
            dgvMemmber.AutoGenerateColumns = false;
            dgvMemmber.DataSource = bll.GetMemberInfoByNameOrNum(textBox1.Text, n);
            if (dgvMemmber.SelectedRows.Count > 0)
            {
                dgvMemmber.SelectedRows[0].Selected = false;
            }
        }
コード例 #8
0
 //Pay the bill
 private void btnAccounts_Click(object sender, EventArgs e)
 {
     MemberInfo mem = cmbMemmber.SelectedItem as MemberInfo;
     if(string.IsNullOrEmpty(txtMoney.Text))
     {
         MessageBox.Show("请输入钱");
         return;
     }
     if(Convert.ToDecimal(txtMoney.Text) < Convert.ToDecimal(lblMoney.Text))
     {
         MessageBox.Show("就这点钱? 搞笑呢");
         return;
     }
     OrderInfo order = new OrderInfo();
     //deskState in DeskInfo table
     DeskInfoBLL bll = new DeskInfoBLL();
     bool deskFlag = bll.UpdateDeskStateByDeskId(this.deskId, 0);
     //non-member
     if(cmbMemmber.SelectedIndex != 0)
     {
         order.OrderMemId = mem.MemmberId;
         order.DisCount = Convert.ToDecimal(mem.MemDiscount);
         //after pay in member money
         decimal money = mem.MemMoney - Convert.ToDecimal(lblMoney.Text);
         MemberInfoBLL mbll = new MemberInfoBLL();
         //if(money < 0)
         //{
         
         //}
         //Member money in MemmberInfo table
         bool memFlag = mbll.UpdateMoneyByMemId(mem.MemmberId, money);
     }
     order.EndTime = System.DateTime.Now;
     order.OrderId = Convert.ToInt32(labOrderId.Text);
     order.OrderMoney = Convert.ToDecimal(lblMoney.Text);
     OrderInfoBLL obll = new OrderInfoBLL();
     bool orderFlag = obll.UpdateOrderInfoMoney(order);
     lblSpareMoney.Text = (Convert.ToDecimal(txtMoney.Text) - Convert.ToDecimal(lblMoney.Text)).ToString();
     if(deskFlag && orderFlag)
     {
         MessageBox.Show("结账成功");
     }
     else
     {
         MessageBox.Show("失败");
     }
 }