Ejemplo n.º 1
0
        private void btndelete_Click(object sender, EventArgs e)
        {
            //判断是否选中
            if (dgvmember.SelectedRows.Count <= 0)
            {
                mds.MsgDivShow("请选中要注销的会员", 1);
                return;
            }
            if (MessageBox.Show("真的要注销吗", "注销会员", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
            {
                //在哪里删除的会员
                int index = cmbmember.SelectedIndex == 0 ? 1 : 2;

                MemberInfoBl memBll = new MemberInfoBl();
                int memId = ((MemberInfo)dgvmember.SelectedRows[0].DataBoundItem).MemberId;
                string msg = memBll.SoftDeleteMemberByMemberId(memId, index) ? "操作成功" : "操作失败";

                mds.MsgDivShow(msg, 1);//显示消息
                //刷新
                int delFlag = index == 1 ? 0 : 1;
                LoadMemberInfoByDelFlag(delFlag);//刷新操作
                return;

            }
            mds.MsgDivShow("你已经取消了注销");
        }
Ejemplo n.º 2
0
        //结账
        private void btnAccounts_Click(object sender, EventArgs e)
        {
            //餐桌状态发生改变
            DeskInfoBLL dkbll = new DeskInfoBLL();
            bool dkResult = dkbll.UpdateDeskInfoStateByDeskId(Convert.ToInt32(labdkId.Text), 0);
            //订单状态发生改变
            OrderInfoBll orderBll = new OrderInfoBll();
            OrderInfo order = new OrderInfo();
            order.EndTime = System.DateTime.Now;//当前的时间
            order.OrderMoney = Convert.ToDouble(lblMoney.Text);//结账后的金额
            order.OrderState = 2;//状态
            order.OrderId = Convert.ToInt32(labOrderId.Text);
            if (cmbMember.SelectedIndex != 0)
            {
                //获取选中的会员对象
                MemberInfo mem = (MemberInfo)cmbMember.SelectedItem;
                order.OrderMemberId = mem.MemberId;//会员的id
                order.DisCount = mem.MemDiscount;//折扣

                //根据会员的id更新该会员的金额
                MemberInfoBl memBll = new MemberInfoBl();
                //得到会员的金额
                double money = Convert.ToDouble(labyuMoney.Text) - Convert.ToDouble(lblMoney.Text);
                //更新会员余额
                memBll.UpdateMemberMoneyById(mem.MemberId, money);//==不接收了
            }

            //更新订单中的金额
            bool orderResult = orderBll.UpdateOrderInfo(order);
            //会员结账----更改会员余额
            //改变订单对应的订单和菜单的中间表中的菜的状态
            R_Order_ProductBll ropBll = new R_Order_ProductBll();
            bool ropResult = ropBll.UpdateR_Order_ProductDelFlagByOrderId(Convert.ToInt32(labOrderId.Text));
            if (dkResult && orderResult & ropResult)
            {
                md.MsgDivShow("顾客结账成功", 1);
            }
            else
            {
                md.MsgDivShow("结账失败了", 1);
            }
        }
Ejemplo n.º 3
0
        private void btnRead_Click(object sender, EventArgs e)
        {
            //弹出对话框  让用户选择xlsx文件
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Title = "Execl文件操作";
            ofd.Filter="Excel文件(*.xlsx;*xls)|*.xlsx;*.xls";
            if (ofd.ShowDialog()==System.Windows.Forms.DialogResult.OK)
            {
                //获取文件
                //读取excel文件
                MemberInfoBl mblll = new MemberInfoBl();
                mblll.ReadExcel(ofd.FileName);
                mds.MsgDivShow("成功");
                //刷新
                LoadMemberInfoByDelFlag(0);
            }
            //读取Excel文件

            //把Excel文件的数据插入到数据库中
        }
Ejemplo n.º 4
0
 private void LoadMemberInfoByDelFlag(int p)
 {
     //查询会员
     MemberInfoBl memBll = new MemberInfoBl();
     dgvmember.AutoGenerateColumns = false;//禁止自动生成列
     dgvmember.DataSource = memBll.GetAllMemberInfoByDelFlag(p);
     dgvmember.ClearSelection();
 }
Ejemplo n.º 5
0
 //导出操作
 private void btnWrite_Click(object sender, EventArgs e)
 {
     SaveFileDialog sfd = new SaveFileDialog();//new一个对话框
     sfd.Filter = "Excel文件(*.xlsx)|*.xlsx";
     sfd.Title = "Excel文件操作";
     if (sfd.ShowDialog()==System.Windows.Forms.DialogResult.OK)
     {
         //文件名=========sfd.FileName
         //NPOI操作Excel文件
         MemberInfoBl bll = new MemberInfoBl();
         bll.WriteExcel(sfd.FileName);
         mds.MsgDivShow("成功了", 1);
     }
 }
Ejemplo n.º 6
0
 //模糊查询
 private void btnsearch_Click(object sender, EventArgs e)
 {
     //if (string.IsNullOrEmpty(txtsearch.Text))
     //{
     //    mds.MsgDivShow("姓名为空,不能查询", 1);
     //    return;
     //}
     //按照用户输入的名字模糊查询
     MemberInfoBl memBll = new MemberInfoBl();
     dgvmember.AutoGenerateColumns = false;
     dgvmember.DataSource = memBll.GetMenmberInfoByLikeMemName(txtsearch.Text);
     dgvmember.ClearSelection();//清除选中内容,
 }
Ejemplo n.º 7
0
        //结账窗体加载的时候
        private void FrmGuestPay_Load(object sender, EventArgs e)
        {
            MemberInfoBl memBll = new MemberInfoBl();
            //获取所有没被删除的会员
            List<MemberInfo> list = memBll.GetAllMemberInfoByDelFlag(0);
            list.Insert(0, new MemberInfo() { MemName = "请选择", MemberId = -1 });
            cmbMember.DataSource = list;
            cmbMember.DisplayMember = "MemName";
            cmbMember.ValueMember = "MemberId";

            //显示该订单的菜
            Load_Order_ProductByOrdrtId(Convert.ToInt32(labOrderId.Text));
        }
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            //判断所有的数据不能为空
            if (CheckEmpty())
            {
                MemberInfo member = new MemberInfo();
                member.MemAddress = txtAddress.Text;
                member.MemBirthday = txtBirstday.Value;//生日
                member.MemDiscount = Convert.ToDouble(txtDiscount.Text);//折扣
                member.MemEndTime = txtEndTime.Value;//结束时间
                //性别:member.MemGender==坑
                member.MemGender = CheckGender();//性别
                member.MemIntegral = Convert.ToInt32(txtIntegral.Text);//积分
                member.MemMobilePhone = txtPhone.Text;//电话
                member.MemMoney = Convert.ToDouble(txtMoney.Text);//金额
                member.MemName = txtName.Text;//会员的名字
                member.MemNum = txtNum.Text;//编号
                member.MemType = Convert.ToInt32(cmbType.SelectedValue);//会员的类型
                member.SubTime = System.DateTime.Now;
                if (Temp == 1)//新增
                {
                    member.DelFlag = 0;
                }
                else if (Temp == 2)//修改
                {
                    member.MemberId = Convert.ToInt32(labId.Text);//会员的id
                }
                MemberInfoBl memBll = new MemberInfoBl();
                string msg = memBll.AddOrUpdateMemberInfo(member, Temp) ? "操作成功" : "操作失败";
                md.MsgDivShow(msg, 1, Bind);

            }
        }