示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txt_Count.Text.Trim().Length <= 0)
            {
                new Warning("人数不能为空", 图标.Erro).Show();
                return;
            }
            try
            {
                #region 获取单号
                string MaxCB = ConsumerBillBLL.GetMaxDT();
                if (MaxCB == "")
                {
                    MaxCB = "ZD" + DateTime.Now.ToString("yyyyMMdd") + "0000";
                }
                int day = int.Parse(MaxCB.Substring(MaxCB.Length - 4, 4)) + 1;

                string dayCB = "ZD" + DateTime.Now.ToString("yyyyMMdd") + day.ToString().PadLeft(4, '0');
                #endregion

                #region 开单消费
                ConsumerBills c = new ConsumerBills();
                c.CBID        = dayCB;
                c.TableID     = int.Parse(TableID);
                c.CBAmount    = txt_Count.Text;
                c.CBStartDate = DateTime.Now.ToString();
                c.CBClose     = 0;

                //添加餐桌插入单号
                if (ConsumerBillBLL.AddCB(c) > 0)
                {
                    CBState.isTrue = true;
                    //开单成功修改桌子状态
                    TablesBLL.UpdateTables(Convert.ToInt32(TableID), 1);

                    if (checkBox1.Checked)
                    {
                        CBState.isCheknd = true;
                    }
                    this.Close();
                }
                #endregion
            }
            catch (Exception)
            {
                MessageBox.Show("发生未只的异常,请联系开发者", "未知异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void AddYD_Load(object sender, EventArgs e)
        {
            string MaxCB = ConsumerBillBLL.GetMaxDT();

            if (MaxCB == "")
            {
                MaxCB = "ZD" + DateTime.Now.ToString("yyyyMMdd") + "0000";
            }
            int day = int.Parse(MaxCB.Substring(MaxCB.Length - 4, 4)) + 1;

            string dayCB = "YD" + DateTime.Now.ToString("yyyyMMdd") + day.ToString().PadLeft(4, '0');

            label9.Text = dayCB;


            List <RoomTypeMDL> list_rt = RoomTypeBLL.selectRoom();

            foreach (RoomTypeMDL item in list_rt)
            {
                TreeNode tr_r = new TreeNode();
                tr_r.Text = item.RTName;
                tr_r.Tag  = item.RTID;
                List <TablesMDL> list_tb = TablesBLL.selectTable(item.RTID);
                foreach (TablesMDL item_tb in list_tb)
                {
                    //只添加可用桌子
                    if (item_tb.TableState == 0)
                    {
                        TreeNode tr_t = new TreeNode();
                        tr_t.Text = item_tb.TableName;
                        tr_t.Tag  = item_tb.TableID;
                        tr_r.Nodes.Add(tr_t);
                    }
                }


                treeView1.Nodes.Add(tr_r);
            }
        }