Beispiel #1
0
        public void SetText(object sender, EventArgs e)
        {
            //第一:清空所有文本框
            foreach (Control ctr in this.Controls)
            {
                if (ctr is TextBox)
                {
                    TextBox tb = ctr as TextBox;
                    tb.Text = "";
                }
            }
            //获取传过来的值
            FrmEventArgs fea = e as FrmEventArgs;

            this.Tp = fea.Temp;//标识存起来
            if (fea.Temp == 2)
            {
                RoomInfo room = fea.obj as RoomInfo;//里式转换
                labId.Text        = room.RoomId.ToString();
                txtIsDeflaut.Text = room.IsDefault.ToString();
                txtRMinMoney.Text = room.RoomMinimunConsume.ToString();
                txtRName.Text     = room.RoomName;
                txtRPerNum.Text   = room.RoomMaxConsumer.ToString();
                txtRType.Text     = room.RoomType.ToString();
            }
            //要为每个文本框赋值
            //Id存起来
        }
Beispiel #2
0
        private int Tp;//标识
        public void SetText(object sender, EventArgs e)
        {
            FrmEventArgs fea = e as FrmEventArgs;

            this.Tp = fea.Temp;                     //把标识取出来存到TP中
            //循环遍历该窗体的所有的控件
            foreach (Control item in this.Controls) //窗体的所有控件
            {
                if (item is TextBox)                //判断该控件是不是文本框
                {
                    TextBox tb = item as TextBox;   //
                    tb.Text = "";                   //清空所有文本框的内容
                }
            }
            if (this.Tp == 2)//如果是2就是修改
            {
                //为每个文本框赋值
                RoomInfo r = fea.Obj as RoomInfo;
                txtIsDeflaut.Text = r.IsDefault.ToString();
                txtRMinMoney.Text = r.RoomMinimunConsume.ToString();
                txtRName.Text     = r.RoomName;
                txtRPerNum.Text   = r.RoomMaxConsumer.ToString();
                txtRType.Text     = r.RoomType.ToString();
                labId.Text        = r.RoomId.ToString();
            }
        }
Beispiel #3
0
        public void SetText(object sender, EventArgs e)
        {
            FrmEventArgs fea = e as FrmEventArgs;

            labDeskName.Text = fea.Name;
            this.ID          = fea.Temp;//把订单的id存起来
        }
Beispiel #4
0
        public void SetDeskText(object sender, EventArgs e)
        {
            //获取传过来的值
            //清空所有文本框
            FrmEventArgs feas = e as FrmEventArgs;

            this.Tp = feas.Temp;
            LoadRoomType();
            if (feas.Temp == 1)
            {
                foreach (Control item in this.Controls)
                {
                    if (item is TextBox)
                    {
                        TextBox tb = item as TextBox;
                        tb.Text = "";
                    }
                }
            }

            else if (this.Tp == 2)
            {
                DeskInfo desk = feas.obj as DeskInfo;
                labId.Text            = desk.DeskId.ToString();
                txtDeskName.Text      = desk.DeskName;
                txtDeskRegion.Text    = desk.DeskRegion;
                txtDeskRemark.Text    = desk.DeskRemark;
                cmdRoom.SelectedValue = desk.RoomId;
            }
        }
        //事件赋值
        public void SetTxt(object sender, EventArgs e)
        {
            LoadRoomNameAndRoomId(0);
            //清空当前窗体的所有的文本框内容
            foreach (Control item in this.Controls)
            {
                if (item is TextBox)
                {
                    TextBox tb = item as TextBox;
                    tb.Text = "";
                }
            }
            FrmEventArgs fea = e as FrmEventArgs;

            this.Tp = fea.Temp; //标识存起来
            if (this.Tp == 4)   //修改
            {
                DeskInfo dk = fea.Obj as DeskInfo;
                txtDeskName.Text      = dk.DeskName;
                txtDeskRegion.Text    = dk.DeskRegion;
                txtDeskRemark.Text    = dk.DeskRemark;
                labId.Text            = dk.DeskId.ToString(); //把id存起来
                cmdRoom.SelectedValue = dk.RoomId;            //把房间的id绑定到下拉框,下拉框就会显示对象的名字
            }
        }
Beispiel #6
0
        private int ordId;//订单的id
        //窗体传值
        public void SetTxt(object sender, EventArgs e)
        {
            FrmEventArgs fea = e as FrmEventArgs;

            labDeskName.Text = fea.Name; //获取餐桌的编号
            this.ordId       = fea.Temp; //获取该订单的id;
        }
Beispiel #7
0
        public void SetTxt(object sender, EventArgs e)
        {
            //加载所有商品类别的名字和id
            LoadCategory(0);

            //清空所有文本框
            foreach (Control item in this.Controls)
            {
                if (item is TextBox)
                {
                    TextBox tb = item as TextBox;
                    tb.Text = "";
                }
            }
            //设置标识
            FrmEventArgs fea = e as FrmEventArgs;

            this.Tp = fea.Temp;
            //判断是不是4--修改
            if (this.Tp == 4)
            {
                ProductInfo pro = fea.Obj as ProductInfo;
                //一个一个来
                cmbCategory.SelectedValue = pro.CatId;
                txtCost.Text   = pro.ProCost.ToString();
                txtName.Text   = pro.ProName;
                txtNum.Text    = pro.ProNum;
                txtPrice.Text  = pro.ProPrice.ToString();
                txtRemark.Text = pro.Remark;
                txtSpell.Text  = pro.ProSpell;
                txtStock.Text  = pro.ProStock.ToString();
                txtUnit.Text   = pro.ProUnit;
                labId.Text     = pro.ProId.ToString();
            }
        }
Beispiel #8
0
        public void SetText(object sender, EventArgs e)
        {
            //清空文本框的值
            foreach (Control item in this.Controls)
            {
                if (item is TextBox)
                {
                    TextBox tb = item as TextBox;
                    tb.Text = "";
                }
            }

            FrmEventArgs feas = e as FrmEventArgs;

            this.Tp = feas.Temp;
            LoadCategoryType();
            if (feas.Temp == 2)
            {
                ProductInfo pro = feas.obj as ProductInfo;
                txtName.Text              = pro.ProName;
                txtNum.Text               = pro.ProNum;
                txtCost.Text              = pro.ProCost.ToString();
                txtPrice.Text             = pro.ProPrice.ToString();
                txtSpell.Text             = pro.ProSpell;
                txtUnit.Text              = pro.ProUnit;
                txtStock.Text             = pro.ProStock.ToString();
                txtRemark.Text            = pro.Remark;
                labId.Text                = pro.ProId.ToString();
                cmbCategory.SelectedValue = pro.CatId;
            }
        }
Beispiel #9
0
        }                           //用来存储餐桌的id
        public void SetText(object sender, EventArgs e)
        {
            FrmEventArgs fea = e as FrmEventArgs;
            DeskInfo     dk  = fea.obj as DeskInfo;

            labDeskName.Text    = dk.DeskName;
            labRoomType.Text    = fea.Name;
            labLittleMoney.Text = fea.Money.ToString();
            this.ID             = dk.DeskId;//把餐桌的id存起来
        }
Beispiel #10
0
        //设置内容
        public void SetLab(object sender, EventArgs e)
        {
            FrmEventArgs fea = e as FrmEventArgs;
            DeskInfo     dk  = fea.Obj as DeskInfo;

            labDeskName.Text    = dk.DeskName;//餐桌的编号
            labRoomType.Text    = fea.Name;
            labLittleMoney.Text = fea.Money.ToString();
            this.Id             = dk.DeskId;//存餐桌的id
        }
Beispiel #11
0
        //增加消费
        private void button2_Click(object sender, EventArgs e)
        {
            TabPage tp = tcin.TabPages[tcin.SelectedIndex];
            //获取当前选中房间的名字
            RoomInfo     room = tp.Tag as RoomInfo;
            FrmEventArgs fea  = new FrmEventArgs();

            fea.Money = Convert.ToDecimal(room.RoomMinimunConsume);
            fea.Name  = room.RoomName;

            //string roomName = room.RoomName;
            //最低消费

            //获取当前选项卡中的listview控件
            ListView lv = tp.Controls[0] as ListView;

            //判断是否有选中的餐桌
            if (lv.SelectedItems.Count > 0)
            {
                //获取当前选中的餐桌
                DeskInfo dk = lv.SelectedItems[0].Tag as DeskInfo;
                if (dk.DeskState == 1)
                {
                    //fea.obj = dk;
                    fea.Name = dk.DeskName;//餐桌的编号
                    //订单的id,根据餐桌的id查找订单的id
                    OrderInfoBLL obll    = new OrderInfoBLL();
                    int          orderId = obll.GetOrderIdByDeskId(dk.DeskId);
                    fea.Temp = orderId;


                    FrmAddMoney fam = new FrmAddMoney();
                    this.evtAddMoney += new EventHandler(fam.SetText);//注册事件
                    if (this.evtAddMoney != null)
                    {
                        this.evtAddMoney(this, fea);
                    }

                    fam.FormClosed += new FormClosedEventHandler(fbi_FormClosed);

                    fam.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择开单的餐桌");
                }
            }
            else
            {
                MessageBox.Show("没选中");
            }
        }
Beispiel #12
0
        private int Id;//存餐桌的id
        public void SetTxt(object sender, EventArgs e)
        {
            FrmEventArgs fea = e as FrmEventArgs;

            this.Id          = fea.DkIdZ;           //获取餐桌的id
            labDeskName.Text = fea.Name;            //餐桌的编号
            labOrderId.Text  = fea.Temp.ToString(); //订单的id

            //根据订单的id查询这个订单消费了多少钱
            OrderInfoBLL bll = new OrderInfoBLL();

            labMoney.Text = bll.GetOrderMoney(fea.Temp).ToString();
            lblMoney.Text = labMoney.Text;//结账金额和消费金额一样------坑
        }
Beispiel #13
0
        //确定开单
        private void btnOK_Click(object sender, EventArgs e)
        {
            //餐桌的id,改变餐桌的状态
            DeskInfoBLL dkBll    = new DeskInfoBLL();
            bool        dkResult = dkBll.UpdateDeskStateByDeskId(this.Id, 1);//餐桌开单了
            //添加一个订单,需要备注,订单的状态,提交人,提交时间,删除标识
            OrderInfo order = new OrderInfo();

            order.Remark     = txtPersonCount.Text + txtDescription.Text;//人数和描述(备注)直接存到备注信息里
            order.SubBy      = 1;
            order.SubTime    = DateTime.Now;
            order.DelFlag    = 0;
            order.OrderState = 1;                                          //标识的是这个订单正在使用
            OrderInfoBLL odBll   = new OrderInfoBLL();
            int          orderId = odBll.GetOrderIdInsertOrderInfo(order); //插入一个订单的同时获取该订单的id
            //向中间表(订单和餐桌)插入 订单的id还有餐桌的id
            ROrderDeskBLL roddkBll = new ROrderDeskBLL();
            ROrderDesk    rod      = new ROrderDesk();

            rod.DeskId  = this.Id; //餐桌id
            rod.OrderId = orderId; //订单id
            bool RoDResult = roddkBll.AddROrderDesk(rod);

            if (dkResult && RoDResult)
            {
                MessageBox.Show("开单成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("开单失败");
            }

            if (ckbMeal.Checked)
            {
                FrmAddMoney fam = new FrmAddMoney();
                this.evt += new EventHandler(fam.SetTxt);
                FrmEventArgs fea = new FrmEventArgs();
                fea.Name = labDeskName.Text; //餐桌的编号
                fea.Temp = orderId;          //订单的id
                if (this.evt != null)
                {
                    this.evt(this, fea);
                }
                //增加消费的窗体关闭后,当前的开单窗体关闭
                fam.FormClosed += new FormClosedEventHandler(fam_FormClosed);
                fam.ShowDialog();
            }
        }
Beispiel #14
0
        public event EventHandler evtBill;//开单事件
        //顾客开单
        private void btnFrmBilling_Click(object sender, EventArgs e)
        {
            //方式一
            //TabPage tb= tcin.SelectedTab;
            //方式二 获取当前选中的选项卡
            TabPage tp = tcin.TabPages[tcin.SelectedIndex];
            //获取当前选中房间的名字
            RoomInfo     room = tp.Tag as RoomInfo;
            FrmEventArgs fea  = new FrmEventArgs();

            fea.Money = Convert.ToDecimal(room.RoomMinimunConsume);
            fea.Name  = room.RoomName;

            //string roomName = room.RoomName;
            //最低消费

            //获取当前选项卡中的listview控件
            ListView lv = tp.Controls[0] as ListView;

            //判断是否有选中的餐桌
            if (lv.SelectedItems.Count > 0)
            {
                //获取当前选中的餐桌
                DeskInfo dk = lv.SelectedItems[0].Tag as DeskInfo;
                if (dk.DeskState == 0)
                {
                    fea.obj = dk;
                    FrmBilling fbi = new FrmBilling();
                    this.evtBill += new EventHandler(fbi.SetText);//注册事件
                    if (this.evtBill != null)
                    {
                        this.evtBill(this, fea);
                    }

                    fbi.FormClosed += new FormClosedEventHandler(fbi_FormClosed);

                    fbi.ShowDialog();
                }
                else
                {
                    MessageBox.Show("当前餐桌在使用");
                }
            }
            else
            {
                MessageBox.Show("没选中");
            }
        }
Beispiel #15
0
        //结账按钮
        private void button3_Click(object sender, EventArgs e)
        {
            TabPage  tp = tcInFo.SelectedTab;         //获取当前餐桌所在的房间的选项卡
            RoomInfo r  = tp.Tag as RoomInfo;         //从tag中获取房间的对象==坑---名字,最低消费
            ListView lv = tp.Controls[0] as ListView; //获取listview

            if (lv.SelectedItems.Count > 0)
            {
                ListViewItem lvt = lv.SelectedItems[0]; //获取当前listview中选中的项
                DeskInfo     dk  = lvt.Tag as DeskInfo; //可以获取该选中的餐桌的编号还有id
                if (dk.DeskState == 1)
                {
                    FrmBalance fb = new FrmBalance();
                    this.evtBalance += new EventHandler(fb.SetTxt);//传值
                    //获取要传递的参数后  显示开单的窗体
                    FrmEventArgs fea = new FrmEventArgs();

                    fea.Name  = dk.DeskName; //餐桌的编号
                    fea.DkIdZ = dk.DeskId;   //餐桌的id
                    //这里必须要获取该餐桌的订单id===============坑
                    OrderInfoBLL obll    = new OrderInfoBLL();
                    int          orderId = obll.GetOrderIdByDeskId(dk.DeskId); //获取订单的id(当前餐桌)
                    fea.Temp = orderId;                                        //订单id传到消费窗体中
                    if (this.evtBalance != null)
                    {
                        this.evtBalance(this, fea);
                    }
                    //此窗体关闭后 一定要进行刷新.
                    fb.FormClosed += new FormClosedEventHandler(fbl_FormClosed);//调用上面的方法
                    fb.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择已经开单的餐桌");
                }
            }
            else
            {
                MessageBox.Show("请看好目标后再下手");
            }
        }
Beispiel #16
0
        //设置文本框的内容
        public void SetTxt(object sender, EventArgs e)
        {
            LoadMemmberType(0);
            //清空所有文本框
            foreach (Control item in this.Controls)
            {
                if (item is TextBox)
                {
                    TextBox tb = item as TextBox;
                    tb.Text = "";
                }
            }
            FrmEventArgs fea = e as FrmEventArgs;

            //设置标识
            this.Tp = fea.Temp;
            //判断是修改还是增加
            if (this.Tp == 2)
            {
                MemmberInfo mem = fea.Obj as MemmberInfo;
                //设置所有文本框的内容
                txtBirs.Text             = mem.MemBirthdaty.ToString();              //生日
                txtMemDiscount.Text      = mem.MemDiscount.ToString();               //折扣
                txtMemIntegral.Text      = mem.MemIntegral.ToString();               //积分
                txtmemMoney.Text         = mem.MemMoney.ToString();                  //余额
                txtMemName.Text          = mem.MemName;                              //会员名字
                txtMemNum.Text           = mem.MemNum;                               //会员编号
                txtMemPhone.Text         = mem.MemMobilePhone;                       //手机
                dtEndServerTime.Value    = Convert.ToDateTime(mem.MemEndServerTime); //有效时间
                rdoMan.Checked           = mem.MemGender == "男" ? true : false;
                rdoWomen.Checked         = mem.MemGender == "女" ? true : false;
                labId.Text               = mem.MemmberId.ToString();
                cmbMemType.SelectedValue = mem.MemType;
            }
            else if (this.Tp == 1)
            {
                txtMemIntegral.Text = "0";
            }
        }
Beispiel #17
0
        private int Tp;//标识
        //注册事件调用的方法
        public void SetTxt(object sender, EventArgs e)
        {
            foreach (Control item in this.Controls)
            {
                if (item is TextBox)
                {
                    TextBox tb = item as TextBox;
                    tb.Text = "";
                }
            }
            FrmEventArgs fea = e as FrmEventArgs;

            this.Tp = fea.Temp;
            if (this.Tp == 2)
            {
                CategoryInfo ct = fea.Obj as CategoryInfo;
                txtCName.Text   = ct.CatName;
                txtCNum.Text    = ct.CatNum;
                txtCRemark.Text = ct.Remark;
                labId.Text      = ct.CatId.ToString();//id存起来
            }
        }
Beispiel #18
0
        }                           //存标识

        //传值用
        public void SetText(object sender, EventArgs e)
        {
            LoadMemmberType();
            FrmEventArgs fea = e as FrmEventArgs;

            this.Tp = fea.Temp;
            //if (fea.Temp==1)
            //{
            foreach (Control item in this.Controls)
            {
                if (item is TextBox)
                {
                    TextBox tb = item as TextBox;    //把控件转成文本框
                    tb.Text = "";
                }
            }
            //}else if(fea.Temp==2)//修改
            if (fea.Temp == 2)
            {
                MemmberInfo mem = fea.obj as MemmberInfo;
                txtBirs.Text             = mem.MemBirthdaty.ToString();
                txtMemDiscount.Text      = mem.MemDiscount.ToString();
                txtMemIntegral.Text      = mem.MemIntegral.ToString();
                txtmemMoney.Text         = mem.MemMoney.ToString();
                txtMemName.Text          = mem.MemName;
                txtMemNum.Text           = mem.MemNum;
                txtAddress.Text          = mem.MemAddress;
                txtMemPhone.Text         = mem.MemMobilePhone;
                cmbMemType.SelectedIndex = mem.MemType;
                rdoMan.Checked           = mem.MemGender == "男" ? true : false;
                rdoWomen.Checked         = mem.MemGender == "女" ? true : false;
                labId.Text = mem.MemmberId.ToString();
            }
            else if (fea.Temp == 1)
            {
                txtMemIntegral.Text = "0";
            }
        }
Beispiel #19
0
        //顾客开单
        private void button1_Click(object sender, EventArgs e)
        {
            TabPage  tp = tcInFo.SelectedTab;         //获取当前餐桌所在的房间的选项卡
            RoomInfo r  = tp.Tag as RoomInfo;         //从tag中获取房间的对象==坑---名字,最低消费
            ListView lv = tp.Controls[0] as ListView; //获取listview

            if (lv.SelectedItems.Count > 0)
            {
                ListViewItem lvt = lv.SelectedItems[0]; //获取当前listview中选中的项
                DeskInfo     dk  = lvt.Tag as DeskInfo; //可以获取该选中的餐桌的编号还有id
                if (dk.DeskState == 0)
                {
                    FrmBilling fbl = new FrmBilling();
                    this.evtBill += new EventHandler(fbl.SetLab);
                    //获取要传递的参数后  显示开单的窗体
                    FrmEventArgs fea = new FrmEventArgs();
                    fea.Obj   = dk;         //餐桌的对象
                    fea.Name  = r.RoomName; //房间的名字,  //获取该餐桌所在的房间,这个房间的最低消费
                    fea.Money = Convert.ToDecimal(r.RoomMinimunConsume);
                    if (this.evtBill != null)
                    {
                        this.evtBill(this, fea);
                    }
                    //此窗体关闭后 一定要进行刷新.
                    fbl.FormClosed += new FormClosedEventHandler(fbl_FormClosed);
                    fbl.ShowDialog();//开单的窗体
                }
                else
                {
                    MessageBox.Show("请选择未开单的餐桌");
                }
            }
            else
            {
                MessageBox.Show("请看好目标后再下手");
            }
        }
Beispiel #20
0
        //注册事件的方法
        public void SetText(object sender, EventArgs e)
        {
            //清空文本框
            foreach (Control item in this.Controls)
            {
                if (item is TextBox)
                {
                    TextBox tb = item as TextBox;
                    tb.Text = "";
                }
            }

            FrmEventArgs fea = e as FrmEventArgs;

            this.Tp = fea.Temp;
            if (fea.Temp == 2)
            {
                CategoryInfo cat = fea.obj as CategoryInfo;
                txtCName.Text   = cat.Catname;
                txtCNum.Text    = cat.Catnum;
                txtCRemark.Text = cat.Remark;
                labId.Text      = cat.Catid.ToString();
            }
        }