Esempio n. 1
0
 //退出程序
 public static void AllClose()
 {
     if (FMHelper.OpenYesNo("要退出程序吗"))
     {
         Application.Exit();
     }
 }
Esempio n. 2
0
File: Login.cs Progetto: YunoGit/eat
 //管理员登陆
 public void AdminLogin()
 {
     try
     {
         dbh.DBOpen();
         string     sql  = "select count(*) from [user] where id='" + this.textId.Text.Trim() + "' and pwd='" + this.textPwd.Text.Trim() + "'";
         SqlCommand comm = new SqlCommand(sql, dbh.Conn);
         if ((int)comm.ExecuteScalar() == 1)
         {
             FMHelper.OpenDeskMenu();
             this.Hide();
         }
         else
         {
             FMHelper.OpenOk("账号或密码错误");
         }
     }
     catch (Exception ex)
     {
         text = ex.Message;
         ShowMessage();
     }
     finally
     {
         dbh.DBClose();
     }
 }
Esempio n. 3
0
 //修改信息
 public void ChangeInfo()
 {
     try
     {
         dbh.DBOpen();
         string     sql  = "select id from food where danwei='" + this.txtFoodDanWei.Text.Trim() + "' and name='" + this.txtFoodName.Text.Trim() + "' and moeny='" + this.txtFoodPrice.Text.Trim() + "'";
         SqlCommand comm = new SqlCommand(sql, dbh.Conn);
         if (comm.ExecuteScalar() == null)
         {
             sql  = "insert food select '" + this.txtFoodDanWei.Text.Trim() + "','" + this.txtFoodName.Text.Trim() + "','" + this.txtFoodPrice.Text.Trim() + "',0 update food set zhuangtai=1 where id=" + foodId;
             comm = new SqlCommand(sql, dbh.Conn);
             comm.ExecuteNonQuery();
         }
         else
         {
             string id = comm.ExecuteScalar().ToString();
             sql  = "update food set zhuangtai=1 where id=" + foodId + " update food set zhuangtai=0 where id=" + id;
             comm = new SqlCommand(sql, dbh.Conn);
             comm.ExecuteNonQuery();
         }
         FMHelper.OpenOk("信息修改成功");
     }
     catch (Exception ex)
     {
         text = ex.Message;
         ShowMessage();
     }
     finally
     {
         dbh.DBClose();
     }
 }
Esempio n. 4
0
 //检查手机号
 public bool CheckPhone()
 {
     try
     {
         dbh.DBOpen();
         string     sql  = "select count(*) from vipcard where phone='" + this.textPhone.Text.Trim() + "'";
         SqlCommand comm = new SqlCommand(sql, dbh.Conn);
         if (Convert.ToInt32(comm.ExecuteScalar()) > 0)
         {
             FMHelper.OpenOk("该手机号已注册过会员");
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         text = ex.Message;
         ShowMessage();
         return(false);
     }
     finally
     {
         dbh.DBClose();
     }
 }
Esempio n. 5
0
 //营业验证
 public bool CheckUse()
 {
     try
     {
         dbh.DBOpen();
         string     sql  = "select count(*) from desk where zhuangtai=1";
         SqlCommand comm = new SqlCommand(sql, dbh.Conn);
         if ((int)comm.ExecuteScalar() > 0)
         {
             FMHelper.OpenOk("有未处理账单,无法操作");
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         text = ex.Message;
         ShowMessage();
         return(false);
     }
     finally
     {
         dbh.DBClose();
     }
 }
Esempio n. 6
0
        //表单验证
        public bool CheckInput()
        {
            string[] a = new string[3];
            a = this.txtFoodPrice.Text.Split('.');
            double price;

            if (this.txtFoodName.Text.Trim() == string.Empty)
            {
                FMHelper.OpenOk("请输入菜名");
            }
            else if (this.txtFoodDanWei.Text.Trim() == string.Empty)
            {
                FMHelper.OpenOk("请输入单位");
            }
            else if (this.txtFoodPrice.Text.Trim() == string.Empty)
            {
                FMHelper.OpenOk("请输入单价");
            }
            else if (!double.TryParse(this.txtFoodPrice.Text.Trim(), out price) || (a.Length > 1 && a[1].Length > 1))
            {
                FMHelper.OpenOk("请输入正确的价格");
            }
            else
            {
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
 //关于
 private void button4_Click(object sender, EventArgs e)
 {
     this.botAbout.BackColor = Color.Black;
     this.botAbout.FlatAppearance.BorderColor = Color.Black;
     FMHelper.OpenAbout();
     this.botAbout.BackColor = Color.Transparent;
     this.botAbout.FlatAppearance.BorderColor = Color.FromArgb(64, 64, 64);
 }
Esempio n. 8
0
 //一键清台
 private void botAdd_Click(object sender, EventArgs e)
 {
     if (FMHelper.OpenYesNo("要清空所有桌台吗"))
     {
         EndInfo();
         StartInfo();
         FMHelper.OpenOk("已清理所有桌台");
     }
 }
Esempio n. 9
0
 //取消订单按钮
 private void button7_Click(object sender, EventArgs e)
 {
     if (FMHelper.OpenYesNo("要取消订单吗"))
     {
         DeZhnagDan();
         FMHelper.OpenOk("取消订单成功");
         FMHelper.OpenDeskMenu();
         this.Close();
     }
 }
Esempio n. 10
0
 //日期验证
 public bool CheckDate()
 {
     if (this.time1.Value > this.time2.Value)
     {
         FMHelper.OpenOk("请选择正确的日期");
     }
     else
     {
         return(true);
     }
     return(false);
 }
Esempio n. 11
0
 //结账验证
 public bool JZCheck()
 {
     if (this.FoodList.Rows.Count == 0)
     {
         FMHelper.OpenOk("未点菜,无法进行结账操作");
     }
     else
     {
         return(true);
     }
     return(false);
 }
Esempio n. 12
0
 //付款验证
 public bool PayCheck()
 {
     if (zhaoLin < 0)
     {
         FMHelper.OpenOk("请输入正确的付款金额");
     }
     else
     {
         return(true);
     }
     return(false);
 }
Esempio n. 13
0
 //检查是否选择会员
 public bool CheckVIPId()
 {
     if (this.textID.Text == string.Empty)
     {
         FMHelper.OpenOk("未选择任何会员");
     }
     else
     {
         return(true);
     }
     return(false);
 }
Esempio n. 14
0
 //删除菜品
 private void button12_Click(object sender, EventArgs e)
 {
     if (CheckUse())
     {
         if (FMHelper.OpenYesNo("要删除该菜品吗"))
         {
             DeInfo();
             GetMenu(string.Empty);
             FoodInfo();
         }
     }
 }
Esempio n. 15
0
 //注销会员按钮
 private void botDe_Click(object sender, EventArgs e)
 {
     if (CheckVIPId())
     {
         if (FMHelper.OpenYesNo("要注销会员吗"))
         {
             DeVIPInfo();
             GetVIPList();
             GetVIPInfo();
         }
     }
 }
Esempio n. 16
0
 //确认修改按钮
 private void button1_Click(object sender, EventArgs e)
 {
     if (CheckVIPId())
     {
         if (CheckInput())
         {
             if (FMHelper.OpenYesNo("要保存修改吗"))
             {
                 ChangeVIPInfo();
             }
         }
     }
 }
Esempio n. 17
0
 //保存修改
 private void button13_Click(object sender, EventArgs e)
 {
     if (CheckUse())
     {
         if (CheckInput())
         {
             if (FMHelper.OpenYesNo("要保存修改吗"))
             {
                 ChangeInfo();
                 GetMenu(string.Empty);
                 FoodInfo();
             }
         }
     }
 }
Esempio n. 18
0
 //表单验证
 public bool CheckInput()
 {
     if (this.textName.Text.Trim() == string.Empty)
     {
         FMHelper.OpenOk("请输入姓名");
     }
     else if (this.textSex.Text.Trim() == string.Empty)
     {
         FMHelper.OpenOk("请输入性别");
     }
     else
     {
         return(true);
     }
     return(false);
 }
Esempio n. 19
0
File: Login.cs Progetto: YunoGit/eat
 //表单验证
 public bool CheckInput()
 {
     if (this.textId.Text.Trim() == string.Empty)
     {
         FMHelper.OpenOk("请输入用户名");
     }
     else if (this.textPwd.Text.Trim() == string.Empty)
     {
         FMHelper.OpenOk("请输入密码");
     }
     else
     {
         return(true);
     }
     return(false);
 }
Esempio n. 20
0
        //数量验证
        public bool CheckNum()
        {
            int a;

            if (this.txtBuyNum.Text.Trim() == string.Empty)
            {
                FMHelper.OpenOk("请输入数量");
            }
            else if (!int.TryParse(this.txtBuyNum.Text.Trim(), out a) || a < 1)
            {
                FMHelper.OpenOk("请输入正确的数量");
            }
            else
            {
                return(true);
            }
            return(false);
        }
Esempio n. 21
0
 //添加菜品
 public void AddFood()
 {
     try
     {
         dbh.DBOpen();
         string     sql  = "select count(*) from food where name='" + this.txtFoodName.Text.Trim() + "' and zhuangtai=0";
         SqlCommand comm = new SqlCommand(sql, dbh.Conn);
         if ((int)comm.ExecuteScalar() == 0)
         {
             sql  = "select id from food where danwei='" + this.txtFoodDanWei.Text.Trim() + "' and name='" + this.txtFoodName.Text.Trim() + "' and moeny='" + this.txtFoodPrice.Text.Trim() + "'";
             comm = new SqlCommand(sql, dbh.Conn);
             if (comm.ExecuteScalar() == null)
             {
                 sql  = "insert food select '" + this.txtFoodDanWei.Text.Trim() + "','" + this.txtFoodName.Text.Trim() + "','" + this.txtFoodPrice.Text.Trim() + "',0";
                 comm = new SqlCommand(sql, dbh.Conn);
                 comm.ExecuteNonQuery();
             }
             else
             {
                 string id = comm.ExecuteScalar().ToString();
                 sql  = "update food set zhuangtai=0 where id=" + id;
                 comm = new SqlCommand(sql, dbh.Conn);
                 comm.ExecuteNonQuery();
             }
             FMHelper.OpenOk("菜品添加成功");
             this.Close();
         }
         else
         {
             FMHelper.OpenOk("该菜品已存在");
         }
     }
     catch (Exception ex)
     {
         text = ex.Message;
         ShowMessage();
     }
     finally
     {
         dbh.DBClose();
     }
 }
Esempio n. 22
0
 //删除信息
 public void DeInfo()
 {
     try
     {
         dbh.DBOpen();
         string     sql  = "update food set zhuangtai=1 where id=" + this.foodId;
         SqlCommand comm = new SqlCommand(sql, dbh.Conn);
         comm.ExecuteNonQuery();
         FMHelper.OpenOk("菜品删除成功");
     }
     catch (Exception ex)
     {
         text = ex.Message;
         ShowMessage();
     }
     finally
     {
         dbh.DBClose();
     }
 }
Esempio n. 23
0
 //修改会员信息
 public void ChangeVIPInfo()
 {
     try
     {
         dbh.DBOpen();
         string     sql  = "update VIPCard set Name='" + this.textName.Text.Trim() + "',Sex='" + this.textSex.Text.Trim() + "',BeiZhu='" + this.textBeiZhu.Text.Trim() + "' where Phone='" + this.textID.Text + "'";
         SqlCommand comm = new SqlCommand(sql, dbh.Conn);
         comm.ExecuteNonQuery();
         FMHelper.OpenOk("修改成功");
     }
     catch (Exception ex)
     {
         text = ex.Message;
         ShowMessage();
     }
     finally
     {
         dbh.DBClose();
     }
 }
Esempio n. 24
0
 //删除会员信息
 public void DeVIPInfo()
 {
     try
     {
         dbh.DBOpen();
         string     sql  = "update vipcard set zhuangtai=1 where phone='" + this.textID.Text + "'";
         SqlCommand comm = new SqlCommand(sql, dbh.Conn);
         comm.ExecuteNonQuery();
         FMHelper.OpenOk("注销成功");
     }
     catch (Exception ex)
     {
         text = ex.Message;
         ShowMessage();
     }
     finally
     {
         dbh.DBClose();
     }
 }
Esempio n. 25
0
 //结账按钮
 private void button7_Click(object sender, EventArgs e)
 {
     if (PayCheck())
     {
         if (FMHelper.OpenYesNo("要确认结账吗"))
         {
             PayYes();
             PayOk frm = new PayOk();
             frm.zhangDanId = ZhangDanId;
             frm.money      = realMoney.ToString();
             if (this.textName.Text != string.Empty)
             {
                 frm.vip = this.textSelect.Text;
             }
             frm.jiFen = jiFen.ToString();
             frm.ShowDialog();
             FMHelper.OpenDeskMenu();
             this.Close();
         }
     }
 }
Esempio n. 26
0
        //表单验证
        public bool CheckInout()
        {
            long phone;

            if (this.textName.Text.Trim() == string.Empty)
            {
                FMHelper.OpenOk("请输入姓名");
            }
            else if (this.textPhone.Text.Trim() == string.Empty)
            {
                FMHelper.OpenOk("请输入电话");
            }
            else if (this.textPhone.Text.Trim().Length < 11 || !long.TryParse(this.textPhone.Text.Trim(), out phone))
            {
                FMHelper.OpenOk("请输入正确的手机号");
            }
            else
            {
                return(true);
            }
            return(false);
        }
Esempio n. 27
0
 //菜品
 private void button4_Click_1(object sender, EventArgs e)
 {
     FMHelper.OpenFoodMenu();
     this.Close();
 }
Esempio n. 28
0
 //账单按钮
 private void button6_Click(object sender, EventArgs e)
 {
     FMHelper.OpenZhngDan();
     this.Close();
 }
Esempio n. 29
0
 //店内按钮
 private void button3_Click(object sender, EventArgs e)
 {
     FMHelper.OpenDeskMenu();
     this.Close();
 }
Esempio n. 30
0
 //等级信息按钮
 private void botGift_Click(object sender, EventArgs e)
 {
     FMHelper.OpenVIPLv();
 }