コード例 #1
0
        private void pictureBox2_DoubleClick(object sender, EventArgs e)
        {
            WelCome.HideInputPanel();
            WelCome.ShowInputPanel();
            bool   fl     = true;
            string result = null;

            while (fl)
            {
                result = Microsoft.VisualBasic.Interaction.InputBox("请输入餐桌号", "锁定餐桌", "", 0, this.Top);
                if (string.IsNullOrEmpty(result))
                {
                    var A = MessageBox.Show("请重新输入,不可为空值", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (DialogResult.No == A)
                    {
                        fl = false;
                    }
                }
                else
                {
                    var i = db.FoodTable.Where(m => m.TableName.Equals(result));
                    if (i.Count() > 0)
                    {
                        MessageBox.Show("更改成功");
                        WelCome.HideInputPanel();
                        fl = false;
                    }
                    else
                    {
                        CommonInfo.FrmMessageBox fm = new CommonInfo.FrmMessageBox("不存在该餐桌", "管理员提示:", MessageBoxStyle.question);
                        fm.ShowDialog();
                    }
                }
            }
            WriteStart(result);
        }
コード例 #2
0
 private void textBox1_Enter(object sender, EventArgs e)
 {
     WelCome.HideInputPanel();
     WelCome.ShowInputPanel();
 }
コード例 #3
0
 private void textBox1_Leave(object sender, EventArgs e)
 {
     WelCome.HideInputPanel();
 }
コード例 #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            CommonInfo.FrmMessageBox frm = new FrmMessageBox("是否选择共用模式", "模式选择", MessageBoxStyle.question);
            DialogResult             A   = frm.ShowDialog();

            if (A == DialogResult.Cancel)
            {
                buttonX1.Show();
                if (!File.Exists("Table.txt"))
                {
                    WelCome.HideInputPanel();
                    WelCome.ShowInputPanel();
                    string result;// = Microsoft.VisualBasic.Interaction.InputBox("请输入餐桌号", "锁定餐桌", "", this.Left, this.Top);
                    // WriteStart(result);
                    Boolean fl = true;
                    while (fl)
                    {
                        result = Microsoft.VisualBasic.Interaction.InputBox("请输入餐桌号", "锁定餐桌", "", this.Left, this.Top);
                        if (string.IsNullOrEmpty(result))
                        {
                            var B = MessageBox.Show("请重新输入,不可为空值", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                            if (DialogResult.No == B)
                            {
                                fl = false;
                            }
                        }
                        else
                        {
                            var i = mDF.FoodTable.Where(m => m.TableName.Equals(result));
                            if (i.Count() > 0)
                            {
                                CommonInfo.FrmMessageBox fm = new CommonInfo.FrmMessageBox("添加成功", "管理员提示:", MessageBoxStyle.right);
                                fm.ShowDialog();
                                WriteStart(result);
                                WelCome.HideInputPanel();
                                fl = false;
                            }
                            else
                            {
                                CommonInfo.FrmMessageBox fm = new CommonInfo.FrmMessageBox("不存在该餐桌", "管理员提示:", MessageBoxStyle.question);
                                fm.ShowDialog();
                            }
                        }
                    }
                }
                List <String> Ro = new List <string>(File.ReadAllLines("Table.txt", Encoding.UTF8));
                tablenum = Ro[0];
                if (string.IsNullOrEmpty(tablenum))
                {
                    CommonInfo.FrmMessageBox fm = new CommonInfo.FrmMessageBox("餐桌绑定失败", "管理员提示:", MessageBoxStyle.right);
                    fm.ShowDialog();
                }
            }
            else
            {
                buttonX1.Hide();
            }
            textBox2.Hide();
            button7.Hide();
            comboBox1.DataSource    = mDF.FoodType.ToList();
            comboBox1.DisplayMember = "FoodTypeName";
            //comboBox1.ValueMember = "FoodTypeID";
            shopCars.Add(shopCar1);
            shopCars.Add(shopCar2);
            shopCars.Add(shopCar3);
            shopCars.Add(shopCar4);
            shopCars.Add(shopCar5);
            shopCars.Add(shopCar6);
            shopCars.Add(shopCar7);
            shopCars.Add(shopCar8);
            Load_FoodList();
        }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.TopMost = false;
            if (Form1.listsorder.Count() == 0)
            {
                MessageBox.Show("当前数据为空");
                return;
            }
            WelCome.HideInputPanel();
            WelCome.ShowInputPanel();
            string result = Microsoft.VisualBasic.Interaction.InputBox("请输入手机号", "手机号", "", this.Left, this.Top);

            if (!IsPhone(result))
            {
                WelCome.HideInputPanel();
                FrmMessageBox frm = new FrmMessageBox("手机号错误", "请正确输入", MessageBoxStyle.error);
                frm.ShowDialog();
                this.TopMost = true;

                return;
            }
            WelCome.HideInputPanel();
            this.TopMost = true;
            Order order = new Order();

            order.Date  = DateTime.Now;
            order.ISOut = false;
            if (!String.IsNullOrEmpty(Form1.tablenum))
            {
                order.phone = result + "餐桌号:" + Form1.tablenum;
            }
            else
            {
                order.phone = result;
            }
            order.TotalParse = TotalPrice();
            db.Order.Add(order);
            db.SaveChanges();
            int orderid = order.OrderID;

            _ = new List <OrderList>();
            foreach (var i in Form1.listsorder)
            {
                OrderList ord = new OrderList();
                ord.OrderID  = orderid;
                ord.foodname = i.foodname;
                ord.num      = i.num;
                ord.price    = i.price;
                db.OrderList.Add(ord);
                db.SaveChanges();
            }
            dataGridView1.DataSource = null;
            Form1.listsorder.Clear();
            FrmMessageBox frm1; this.TopMost = false;

            if (!String.IsNullOrEmpty(Form1.tablenum))
            {
                frm1 = new FrmMessageBox("请熟记订单编号" + ":" + orderid, "提示", MessageBoxStyle.right);
            }
            else
            {
                frm1 = new FrmMessageBox("请熟记订单编号" + ":" + orderid + ";请到前台申请座位", "提示", MessageBoxStyle.right);;
            }
            frm1.ShowDialog();
            this.TopMost             = true;
            dataGridView1.DataSource = Form1.listsorder.ToList();
            textBoxLabel1.Text       = "总计:" + TotalPrice().ToString() + "元";
        }