Esempio n. 1
0
        private void 显示占用ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            tabControl2.TabPages.Clear();
            //房间类型加载Room类型
            DataTable dt = RommBLL.getTable();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                //创建子页
                TabPage tp = new TabPage();
                tp.Text = dt.Rows[i]["房间类型"].ToString();
                //创建ListView
                ListView lv = new ListView();
                lv.Dock = DockStyle.Fill;
                DataTable dt2 = RommBLL.getTableDT(dt.Rows[i]["房间类型"].ToString(), 1);
                for (int j = 0; j < dt2.Rows.Count; j++)
                {
                    if (dt2.Rows[j]["餐台状态"].ToString() == "占用")
                    {
                        lv.LargeImageList = imageList1;
                        ListViewItem lvi = new ListViewItem(dt2.Rows[j]["餐台名称"].ToString());
                        if (dt2.Rows[j]["餐台状态"].ToString() == "可用")
                        {
                            lvi.ImageIndex = 8;
                        }
                        else if (dt2.Rows[j]["餐台状态"].ToString() == "占用")
                        {
                            lvi.ImageIndex = 9;
                        }
                        else if (dt2.Rows[j]["餐台状态"].ToString() == "预订")
                        {
                            lvi.ImageIndex = 10;
                        }
                        else if (dt2.Rows[j]["餐台状态"].ToString() == "停用")
                        {
                            lvi.ImageIndex = 11;
                        }
                        if (dt2.Rows[j]["餐台状态"].ToString() == "占用")
                        {
                            this.顾客开单ToolStripMenuItem.Enabled = false;
                            this.宾客结账ToolStripMenuItem.Enabled = true;
                            this.增加消费ToolStripMenuItem.Enabled = true;
                            this.顾客预订ToolStripMenuItem.Enabled = true;
                        }
                        lv.Items.Add(lvi);
                    }
                }
                lv.ContextMenuStrip = this.contextMenuStrip1;
                tp.Controls.Add(lv);
                tabControl2.TabPages.Add(tp);
            }
        }
Esempio n. 2
0
        private void BillingForm_Load(object sender, EventArgs e)
        {
            //标题
            this.Text = "顾客开单";
            TablesModel tables2 = new TablesModel();

            tables2.TableName1 = tables.TableName1;
            DataTable dt = RommBLL.getTableKD(tables2);

            lblType.Text     = tables.TableName1;
            lblRoomType.Text = dt.Rows[0]["RTName"].ToString();
            lblMinMoney.Text = dt.Rows[0]["RTConsume"].ToString();
        }
Esempio n. 3
0
        private void 顾客开单ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataTable dt = RommBLL.getTableMeal(name);

            if (dt.Rows[0]["餐台状态"].ToString() == "可用")
            {
                TablesModel tables = new TablesModel();
                tables.TableName1 = name;
                tables.TableID1   = id;
                BillingForm bf = new BillingForm(tables, 6);
                bf.Show();
            }
        }
Esempio n. 4
0
        private void TheTableEditorForm_Load(object sender, EventArgs e)
        {
            //标题
            this.Text = "餐桌编辑";
            //加载下拉框
            DataTable dt2 = RommBLL.getTable();

            for (int i = 0; i < dt2.Rows.Count; i++)
            {
                cmdType.Items.Add(dt2.Rows[i]["房间类型"].ToString());
            }
            txtName.Text          = tables.TableName1;
            txtAdrees.Text        = tables.TableArea1;
            cmdType.SelectedIndex = tables.RTID1;
        }
Esempio n. 5
0
 private void timer2_Tick(object sender, EventArgs e)
 {
     //总状态
     lblCount.Text = RommBLL.getObjectZTS().ToString();
     //占用
     lblZY.Text = RommBLL.getObjectZY().ToString();
     //可用
     lblKG.Text = RommBLL.getObjectKY().ToString();
     //预定
     lblYD.Text = RommBLL.getObjectYD().ToString();
     //停用
     lblTY.Text = RommBLL.getObjectTY().ToString();
     //上座率
     lblSZL.Text = RommBLL.getObjectSZL().ToString() + "%";
 }
Esempio n. 6
0
        void lv_DoubleClick(object sender, EventArgs e)
        {
            ListView  listV = sender as ListView;
            string    name  = listV.SelectedItems[0].Tag.ToString();
            DataTable dt    = RommBLL.getTableMeal(name);

            if (dt.Rows[0]["餐台状态"].ToString() == "可用")
            {
                TablesModel tables = new TablesModel();
                tables.TableName1 = name;
                tables.TableID1   = id;
                BillingForm bf = new BillingForm(tables, 6);
                bf.Show();
            }
        }
Esempio n. 7
0
        //删除餐桌
        private void btnDeleteMeal_Click(object sender, EventArgs e)
        {
            int         index  = Convert.ToInt32(dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[0].Value);
            TablesModel tables = new TablesModel();

            tables.TableID1 = index;
            int result = RommBLL.getDeleteMeal(tables);

            if (result > 0)
            {
                MessageBox.Show("OK");
            }
            else
            {
                MessageBox.Show("NO");
            }
        }
Esempio n. 8
0
        //删除房间
        private void btnDeleteRoom_Click(object sender, EventArgs e)
        {
            int           index = Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value);
            RoomTypeModel room  = new RoomTypeModel();

            room.RTID1 = index;
            int result = RommBLL.getDelete(room);

            if (result > 0)
            {
                MessageBox.Show("OK");
            }
            else
            {
                MessageBox.Show("NO");
            }
        }
Esempio n. 9
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (tables.RTID1 == -1)
     {
         //增加
         string      name    = txtName.Text.Trim();
         int         type    = cmdType.SelectedIndex + 1;
         string      area    = txtAdrees.Text.Trim();
         int         start   = 0;
         TablesModel tables2 = new TablesModel(name, type, area, start);
         int         result  = RommBLL.getAddMeal(tables2);
         if (result > 0)
         {
             MessageBox.Show("OK");
         }
         else
         {
             MessageBox.Show("NO");
         }
     }
     else
     {
         //修改
         string      name    = txtName.Text.Trim();
         int         type    = cmdType.SelectedIndex + 1;
         string      area    = txtAdrees.Text.Trim();
         int         start   = 0;
         TablesModel tables2 = new TablesModel(tables.TableID1, name, type, area, start);
         int         result  = RommBLL.getUpdateMeal(tables2);
         if (result > 0)
         {
             MessageBox.Show("OK");
         }
         else
         {
             MessageBox.Show("NO");
         }
     }
 }
Esempio n. 10
0
        private void brnOK_Click(object sender, EventArgs e)
        {
            TablesModel tables2 = new TablesModel();

            tables2.TableName1  = tables.TableName1;
            tables2.TableState1 = 1;
            int    result = RommBLL.getUpdateZT(tables2);
            string count  = txtCount.Text.Trim();

            if (result > 0)
            {
                MessageBox.Show("OK");
                if (cb.Checked)
                {
                    string            no   = "ZD" + DateTime.Now.ToString("yyyyMMddhhmm");
                    string            time = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                    ConsumerBillModel cbm  = new ConsumerBillModel(no, tables.TableID1, count, "-1", "1", time, "", admin, Convert.ToDouble("0"), 0);
                    ConsumerBillBLL.getInsert(cbm);
                    AddForm af = new AddForm(tables, cbm);
                    af.Show();
                }
                else
                {
                    string            no   = "ZD" + DateTime.Now.ToString("yyyyMMddhhmm");
                    string            time = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                    ConsumerBillModel cbm  = new ConsumerBillModel(no, tables.TableID1, count, "-1", "1", time, "", admin, Convert.ToDouble("0"), 0);
                    ConsumerBillBLL.getInsert(cbm);
                }

                FunctionForm ff = new FunctionForm();
                ff.FunctionForm_Load(null, null);
                this.Close();
            }
            else
            {
                MessageBox.Show("NO");
            }
        }
Esempio n. 11
0
        private void EditingRoomForm_Load(object sender, EventArgs e)
        {
            //房间类型编辑
            this.Text = "房间类型编辑";
            //修改
            if (room.RTName1 != "" && room.RTID1 != -1)
            {
                DataTable dt = RommBLL.getTableEditor(room);
                txtName.Text = dt.Rows[0]["房间类型"].ToString();
                txtMin.Text  = dt.Rows[0]["最低消费"].ToString();

                string flag = dt.Rows[0]["是否开启折扣"].ToString();
                txtCount.Text = dt.Rows[0]["容纳人数"].ToString();
                if (flag == "True")
                {
                    cb.Checked = true;
                }
                else
                {
                    cb.Checked = false;
                }
            }
        }
Esempio n. 12
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string name     = txtName.Text.Trim();
            int    minMoney = Convert.ToInt32(txtMin.Text.Trim());
            int    flag     = cb.Checked ? 1 : 0;
            int    count    = Convert.ToInt32(txtCount.Text.Trim());

            if (room.RTID1 == -1)
            {
                //添加
                RoomTypeModel room2  = new RoomTypeModel(name, minMoney, flag, count);
                int           result = RommBLL.getAdd(room2);
                if (result > 0)
                {
                    MessageBox.Show("OK");
                }
                else
                {
                    MessageBox.Show("NO");
                }
            }
            else
            {
                //修改
                RoomTypeModel room2  = new RoomTypeModel(room.RTID1, name, minMoney, flag, count);
                int           result = RommBLL.getUpdate(room2);
                if (result > 0)
                {
                    MessageBox.Show("OK");
                }
                else
                {
                    MessageBox.Show("NO");
                }
            }
        }
Esempio n. 13
0
        //结账
        private void button1_Click(object sender, EventArgs e)
        {
            //读取XML文件
            //创建XML文件流
            XmlDocument doc = new XmlDocument();

            //加载xml
            doc.Load(@"setup.xml");
            //获得根节点
            XmlElement root = doc.DocumentElement;
            //获得子节点
            XmlNodeList xnl = root.ChildNodes;
            //标题
            string name = xnl[0].InnerText;

            //创建文件
            MessageBox.Show(string.Format("{0}.txt", lblNo.Text.Trim()));
            File.Create(@"" + lblNo.Text.Trim() + ".txt").Close();
            //创建文本
            string text = "---------" + name + "-----------\n";

            text += string.Format("账单编号:{0}", lblNo.Text);
            text += string.Format("\n餐桌编号:{0}", lblTableName.Text);
            text += string.Format("\n打印时间:{0}", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
            text += string.Format("\n--------------------------------------");
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                text += string.Format("\n消费项目@单价@数量@应收金额@优惠额度");
                text += string.Format("\n{0}@{1}@{2}@{3}@{4}", dataGridView1.Rows[i].Cells[1].Value.ToString(), dataGridView1.Rows[i].Cells[2].Value.ToString(), dataGridView1.Rows[i].Cells[6].Value.ToString(), dataGridView1.Rows[i].Cells[7].Value.ToString(), dataGridView1.Rows[i].Cells[5].Value.ToString());
            }
            text += string.Format("\n--------------------------------------");
            text += string.Format("\n消费总额{0}", lblMoney.Text.Trim());
            text += string.Format("\n优惠总额{0}", lblYMoney.Text.Trim());
            MessageBox.Show(text);
            //创建文件流
            FileStream fs = new FileStream(@"" + lblNo.Text.Trim() + ".txt", FileMode.Open);
            //创建读取对象,调用读取方法
            StreamWriter sw = new StreamWriter(fs);

            sw.WriteLine(text);
            //关闭资源
            sw.Close();
            fs.Close();

            //修改消费金额和优惠额度
            for (int j = 0; j < dataGridView1.Rows.Count; j++)
            {
                MessageBox.Show(dataGridView1.Rows[j].Cells[5].Value.ToString());
                ConsumerDetailsModel cdm = new ConsumerDetailsModel();
                cdm.CBID1    = lblNo.Text.Trim();
                cdm.CDSale1  = Convert.ToDouble(dataGridView1.Rows[j].Cells[5].Value.ToString());
                cdm.CDMoney1 = Convert.ToDouble(dataGridView1.Rows[j].Cells[7].Value.ToString());
                ProductsModel pm = new ProductsModel();
                pm.ProductName1 = dataGridView1.Rows[j].Cells[1].Value.ToString();
                DataTable dt = ProductsBLL.getTableID(pm);
                pm.ProductID1 = Convert.ToInt32(dt.Rows[0]["ProductID"].ToString());
                ConsumerDetailsBLL.getUpdateXF(cdm, pm);
            }

            //修改餐桌状态以及
            string            endTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            string            money   = lblMoney2.Text.Trim();
            string            no      = lblNo.Text.Trim();
            ConsumerBillModel cbm     = new ConsumerBillModel();

            cbm.CBID1      = no;
            cbm.CBEndDate1 = endTime;
            cbm.CBSale1    = Convert.ToDouble(money);
            MessageBox.Show(cbm.CBSale1.ToString());
            ConsumerBillBLL.getUpdateJZ(cbm);

            //餐桌状态
            TablesModel tables = new TablesModel();

            tables.TableName1  = lblTableName.Text.Trim();
            tables.TableState1 = 0;
            int result = RommBLL.getUpdateZT(tables);

            if (result > 0)
            {
                //new FunctionForm().FunctionForm_Load(null,null);
            }
        }
Esempio n. 14
0
        public void FunctionForm_Load(object sender, EventArgs e)
        {
            //最大化
            this.WindowState = FormWindowState.Maximized;
            //禁止放大缩小
            this.MaximizeBox = false;
            #region 属性栏
            billing.Image        = imageList1.Images[4];
            Insert.Image         = imageList1.Images[0];
            settleAccounts.Image = imageList1.Images[7];
            vip.Image            = imageList1.Images[5];
            inquire.Image        = imageList1.Images[3];
            room.Image           = imageList1.Images[2];
            commodity.Image      = imageList1.Images[1];
            system.Image         = imageList1.Images[6];
            tabControl2.Dock     = DockStyle.Fill;
            #endregion
            //读取XML文件
            //创建XML文件流
            XmlDocument doc = new XmlDocument();
            //加载xml
            doc.Load(@"setup.xml");
            //获得根节点
            XmlElement root = doc.DocumentElement;
            //获得子节点
            XmlNodeList xnl = root.ChildNodes;
            //标题
            this.Text = xnl[0].InnerText;
            //下标题
            this.tslName.Text = xnl[0].InnerText;
            //登录人
            this.tslDL.Text     = "当前登录";
            this.tslDLName.Text = "";

            //启动总状态,5分钟一次
            timer2.Start();
            //总状态
            lblCount.Text = RommBLL.getObjectZTS().ToString();
            //占用
            lblZY.Text = RommBLL.getObjectZY().ToString();
            //可用
            lblKG.Text = RommBLL.getObjectKY().ToString();
            //预定
            lblYD.Text = RommBLL.getObjectYD().ToString();
            //停用
            lblTY.Text = RommBLL.getObjectTY().ToString();
            //上座率
            lblSZL.Text = RommBLL.getObjectSZL().ToString() + "%";

            //房间类型加载Room类型
            DataTable dt = RommBLL.getTable();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                //创建子页
                TabPage tp = new TabPage();
                tp.Text = dt.Rows[i]["房间类型"].ToString();
                //创建ListView
                ListView lv = new ListView();
                lv.Dock = DockStyle.Fill;
                DataTable dt2 = RommBLL.getTableDT(dt.Rows[i]["房间类型"].ToString());
                for (int j = 0; j < dt2.Rows.Count; j++)
                {
                    lv.LargeImageList = imageList1;
                    ListViewItem lvi = new ListViewItem(dt2.Rows[j]["餐台名称"].ToString());
                    if (dt2.Rows[j]["餐台状态"].ToString() == "可用")
                    {
                        lvi.ImageIndex = 8;
                    }
                    else if (dt2.Rows[j]["餐台状态"].ToString() == "占用")
                    {
                        lvi.ImageIndex = 9;
                    }
                    else if (dt2.Rows[j]["餐台状态"].ToString() == "预订")
                    {
                        lvi.ImageIndex = 10;
                    }
                    else if (dt2.Rows[j]["餐台状态"].ToString() == "停用")
                    {
                        lvi.ImageIndex = 11;
                    }
                    //if (dt2.Rows[j]["餐台状态"].ToString() == "可用")
                    //{
                    //    this.宾客结账ToolStripMenuItem.Enabled = false;
                    //    this.增加消费ToolStripMenuItem.Enabled = false;
                    //    this.顾客开单ToolStripMenuItem.Enabled = true;
                    //    this.顾客预订ToolStripMenuItem.Enabled = true;
                    //}
                    lvi.Name = dt2.Rows[j]["TableID"].ToString();
                    lvi.Tag  = dt2.Rows[j]["餐台名称"].ToString();
                    lv.Items.Add(lvi);
                }
                lv.DoubleClick     += lv_DoubleClick;
                lv.Click           += lv_Click;
                lv.ContextMenuStrip = this.contextMenuStrip1;
                tp.Controls.Add(lv);
                tabControl2.TabPages.Add(tp);

                //当前时间
                tslTime.Text = "当前时间";
                timer1.Start();
            }
        }