예제 #1
0
 void TypeValidation(string typeName)
 {
     try
     {
         if (lv_desk.SelectedItems.Count == 1)
         {
             ClientServicesProxy proxys         = new ClientServicesProxy();
             tb_Desk             deskInfoResult = proxys.Find(new tb_Desk {
                 Id = lv_desk.SelectedItems[0].SubItems[0].Name.Trim()
             }).FirstOrDefault();
             if (deskInfoResult.IsNotNull())
             {
                 if (deskInfoResult.DeskStatus.IsEquals(StatusEnum.Using))
                 {
                     MessageBox.Show(string.Format("此桌台{0}!无法开台", StatusEnum.Using.ToEnumDescription()));
                 }
                 else if (deskInfoResult.DeskStatus.IsEquals(StatusEnum.Malfunction))
                 {
                     MessageBox.Show(string.Format("此桌台{0}!无法开台", StatusEnum.Malfunction.ToEnumDescription()));
                 }
                 else if (deskInfoResult.DeskStatus.IsEquals(StatusEnum.Clean))
                 {
                     MessageBox.Show(string.Format("此桌台{0}!无法开台", StatusEnum.Clean.ToEnumDescription()));
                 }
                 else
                 {
                     if (typeName.IsEquals("顾客开单"))
                     {
                         ///查询桌台类型
                         FrmOrder frmopen = new FrmOrder();
                         //frmopen = lv_desk.SelectedItems[0].SubItems[0].Name.Trim();
                         //deskInfoResult.TypeId = "GetDTType";
                         //deskInfoResult = proxys.Find(deskInfoResult).FirstOrDefault();
                         //frmopen.type = deskInfoResult.TypeId;
                         frmopen.ShowDialog();
                     }
                     else if (typeName.IsEquals("顾客点菜"))
                     {
                         if (frmxf == null || frmxf.IsDisposed)
                         {
                             frmxf       = new Frm_XF();
                             frmxf.Rname = lv_desk.SelectedItems[0].SubItems[0].Name.Trim();
                             frmxf.ShowDialog();
                         }
                         else
                         {
                             frmxf.ShowDialog();
                         }
                     }
                     else if (typeName.IsEquals("顾客结账"))
                     {
                         Frm_JZ frmjz = new Frm_JZ();
                         frmjz.Rname = lv_desk.SelectedItems[0].SubItems[0].Name.Trim();
                         frmjz.ShowDialog();
                     }
                 }
             }
         }
         else
         {
             Msg.ShowErrorMsg("请选择桌台");
         }
     }
     catch (Exception ex)
     {
         Msg.ShowErrorMsg(ex);
     }
 }
예제 #2
0
        private void but_OK_Click(object sender, EventArgs e)
        {
            try
            {
                bool pd = false;
                if (TB_money.Text.Trim() == "")
                {
                    MessageBox.Show("输入金钱");
                }
                else if (Convert.ToDouble(LB_ZL.Text.Trim().Remove(0, 1)) < 0)
                {
                    MessageBox.Show("您支付的金额不够");
                }
                else
                {
                    if (dataGridView1.Rows.Count > 0)
                    {
                        //插入消费明细信息
                        for (int i = 0; i < dataGridView1.Rows.Count; i++)
                        {
                            string  str_sql = "select Goods_type,Beizhu from  tb_goods where goods_Name='" + dataGridView1.Rows[i].Cells[0].Value.ToString().Trim() + "'";
                            DataSet ds      = db.GetDataFromSQL(str_sql);
                            str_sql = "insert into  tb_XFMX  values('" + LB_ZDH.Text.Trim() + "','" + dataGridView1.Rows[i].Cells[0].Value.ToString().Trim() + "',"
                                      + "'" + ds.Tables[0].Rows[0][0].ToString().Trim() + "','" + dataGridView1.Rows[i].Cells[1].Value.ToString().Trim() + "',"
                                      + "'" + dataGridView1.Rows[i].Cells[2].Value.ToString().Trim() + "','" + dataGridView1.Rows[i].Cells[3].Value.ToString().Trim() + "'"
                                      + ",'" + ds.Tables[0].Rows[0][1].ToString().Trim() + "')";
                            pd = db.ExecSQl(str_sql);
                        }
                        if (LB_Name.Text != "普通顾客")
                        {
                            //插入会员消费信息
                            string str_sql1 = "insert into tb_memberXF values('" + CB_ID.Text.Trim() + "','" + LB_Name.Text.Trim() + "','" + LB_ZDH.Text.Trim() + "','" + LB_ZTH.Text.Trim() + "',"
                                              + "'" + LB_Smoney.Text.Trim().Remove(0, 1) + "','" + dataGridView1.Rows[0].Cells[4].Value.ToString().Trim().Remove(10) + "','" + TB_BZ.Text.Trim() + "')";
                            pd = db.ExecSQl(str_sql1);

                            //修改会员积分
                            str_sql1 = "update tb_member set Member_JF=convert(int,Member_JF)+'" + Convert.ToInt32(Convert.ToDouble(LB_Smoney.Text.Trim().Remove(0, 1)) / 10) + "' where member_ID='" + CB_ID.Text.Trim() + "'";
                            db.ExecSQl(str_sql1);
                        }
                        //查询服务员
                        DataSet ds1 = db.GetDataFromSQL("select Open_Waiter from tb_Open where Open_Name='" + Rname + "'");
                        fwy = ds1.Tables[0].Rows[0][0].ToString().Trim();

                        //插入消费信息
                        string sql = "insert into tb_XF values('" + LB_ZDH.Text.Trim() + "','" + LB_ZTH.Text.Trim() + "','" + LB_Ymoney.Text.Trim().Remove(0, 1) + "','" + LB_ZK.Text.Trim() + "',"
                                     + "'" + LB_Smoney.Text.Trim().Remove(0, 1) + "','" + dataGridView1.SelectedRows[0].Cells[4].Value.ToString().Trim().Remove(10) + "','" + fwy + "','" + TB_BZ.Text.Trim() + "')";
                        pd = db.ExecSQl(sql);

                        //删除桌台销售信息
                        pd = db.ExecSQl("delete from tb_DeskXS where XS_DeskName='" + Rname + "'");
                        //删除桌台开台信息
                        pd = db.ExecSQl("delete from tb_Open where Open_Name='" + Rname + "'");
                        //更改桌台状态
                        pd = db.ExecSQl("update tb_Desk set TypeId='脏台' where Id='" + Rname + "'");

                        if (pd)
                        {
                            MessageBox.Show("结账成功");

                            this.Close();
                            this.printPreviewDialog1.Document = this.printDocument1;
                            this.printPreviewDialog1.ShowDialog();
                        }
                    }
                    else
                    {
                        if (MessageBox.Show("你还没有消费的!!确认要结账吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
                        {
                            //删除桌台开台信息
                            pd = db.ExecSQl("delete from tb_Open where Open_Name='" + Rname + "'");
                            //更改桌台状态
                            pd = db.ExecSQl("update tb_Desk set TypeId='可用' where Id='" + Rname + "'");
                            this.Close();
                        }
                        else
                        {
                            Frm_XF xf = new Frm_XF();
                            xf.ShowDialog();
                        }
                    }
                }
            }
            catch { }
        }