Beispiel #1
0
        private void Button2_Click(object sender, EventArgs e)
        {
            ClassBidaMap map       = new ClassBidaMap();
            int          TableID   = Convert.ToInt32(labelSoBan.Text);
            int          customer  = Convert.ToInt32(comboBoxHoTen.SelectedValue.ToString());
            DateTime     begintime = dateTimePicker1.Value;
            DateTime     endtime   = dateTimePicker2.Value;

            if (map.check(TableID, begintime, endtime) == true)
            {
                if (map.insert(TableID, 1, customer, begintime, endtime) == true)
                {
                    MessageBox.Show("dat ban thanh cong");
                    loaddatabidamap();
                }
                else
                {
                    MessageBox.Show("dat ban that bai");
                }
            }
            else
            {
                MessageBox.Show("Thoi gian nay co nguoi dat roi . vui long dat gio khac");
            }
        }
        public void buttonThanhToan_Click(object sender, EventArgs e)
        {
            ClassBidaMap bidamap      = new ClassBidaMap();
            Bill         bill         = new Bill();
            int          idtablemap   = Convert.ToInt32(labelMaBan.Text);
            int          idtable      = Convert.ToInt32(labelSoBan.Text);
            int          status       = Convert.ToInt32(labelStatusTable.Text);
            DateTime     thoigianchoi = Convert.ToDateTime(DateTime.Now.ToString());

            if (status == 2)
            {
                float total = 0;
                total = bill.gettotal(idtablemap, idtable, total);
                MessageBox.Show("Thanh toan thanh cong, tong chi phi choi cau quy khach la :" + total.ToString());
                if (bidamap.UpdateStatus(3, idtablemap) && bill.insert(thoigianchoi, 1, idtablemap, total))
                {
                    MessageBox.Show("update database billdb thanh cong");
                    loaddatabidamap();
                }
            }
            else
            {
                if (status == 1)
                {
                    MessageBox.Show("ban chua duoc choi");
                }
                else
                {
                    MessageBox.Show("da thanh toan");
                }
            }
        }
        private void button2_Click_1(object sender, EventArgs e)
        {
            DataTable table = new DataTable();
            int       id;

            loadid(table);
            id = Convert.ToInt32(table.Rows[0][0]);
            ClassBidaMap map       = new ClassBidaMap();
            int          TableID   = Convert.ToInt32(label4.Text);
            int          customer  = id;
            DateTime     begintime = dateTimePicker1.Value;
            DateTime     endtime   = dateTimePicker2.Value;

            if (map.check(TableID, begintime, endtime) == true)
            {
                if (map.insert(TableID, 1, customer, begintime, endtime) == true)
                {
                    MessageBox.Show("dat ban thanh cong");
                    loaddatabidamap();
                }
                else
                {
                    MessageBox.Show("dat ban that bai");
                }
            }
            else
            {
                MessageBox.Show("Thoi gian nay co nguoi dat roi . vui long dat gio khac");
            }
        }
        public void buttonPlay_Click(object sender, EventArgs e)
        {
            ClassBidaMap bidamap = new ClassBidaMap();
            DateTime     timestart, timeend;
            int          id = Convert.ToInt32(labelMaBan.Text);

            if (Convert.ToInt32(labelStatusTable.Text) == 1)
            {
                if (DateTime.Now < dateTimePicker1.Value || DateTime.Now > dateTimePicker2.Value)
                {
                    MessageBox.Show("Nằm ngoài thời gian đặt");
                }
                else
                {
                    if (bidamap.UpdateStatus(2, id))
                    {
                        MessageBox.Show("nhan ban choi thanh cong");
                        loaddatabidamap();
                    }
                    else
                    {
                        MessageBox.Show("nhan ban choi that bai");
                    }
                }
            }
            else
            {
                if (Convert.ToInt32(labelStatusTable.Text) == 2)
                {
                    MessageBox.Show("ban choi da co nguoi choi");
                }
                else
                {
                    MessageBox.Show("ban choi da duoc thanh toan");
                }
            }
        }