예제 #1
0
        private void UC_BanHang_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            RestaurantServicesSoapClient serv = new RestaurantServicesSoapClient();
            var dtBanAn          = serv.Lay_BanAn(-1, -1);
            var dtKhuVuc         = serv.Lay_KhuVuc();
            var dtTrangThaiBanAn = serv.Lay_TrangThaiBanAn();
            var dtLoaiMonAn      = serv.Lay_LoaiMonAn();

            LoadBanAn(dtBanAn);
            LoadKhuVuc(dtKhuVuc);
            LoadTrangThaiBanAn(dtTrangThaiBanAn);
            LoadLoaiMonAn(dtLoaiMonAn);
            this.cboKhuVuc.SelectedIndexChanged         += new System.EventHandler(this.cboKhuVuc_cboTrangThaiBanAn_SelectedIndexChanged);
            this.cboTrangThaiBanAn.SelectedIndexChanged += new System.EventHandler(this.cboKhuVuc_cboTrangThaiBanAn_SelectedIndexChanged);
            this.cboLoaiMonAn.SelectedIndexChanged      += new System.EventHandler(this.cboLoaiMonAn_SelectedIndexChanged);

            // Load grdMonAn
            var dtMonAn = serv.Lay_MonAn(-1);

            grdMonAn.AutoGenerateColumns = false;
            grdMonAn.DataSource          = dtMonAn;
            foreach (DataRow dr in dtMonAn.Rows)
            {
                _lstMonAn.Add(new MonAn(dr));
            }

            this.Cursor = Cursors.Default;
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (_SelectedBanAn == null)
            {
                MessageBox.Show("Chưa chọn bàn!");
                return;
            }
            if (_SelectedMonAn == null)
            {
                MessageBox.Show("Chưa chọn món ăn!");
                return;
            }
            RestaurantServicesSoapClient serv = new RestaurantServicesSoapClient();
            var dt = serv.GoiMon(_SelectedBanAn.BanAnID, _SelectedMonAn.MonAnID, (int)numSoLuong.Value);

            if (dt.Rows[0].Field <int>(0) == -1)
            {
                MessageBox.Show(dt.Rows[0].Field <string>(1), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("Gọi món thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadBanAn(serv.Lay_BanAn((int)cboKhuVuc.SelectedValue, (int)cboTrangThaiBanAn.SelectedValue));
                listViewBanAn.SelectedIndices.Clear();
                var x = listViewBanAn.Items.Find(_SelectedBanAn.BanAnID.ToString(), false);
                listViewBanAn.Items[x[0].Index].Selected = true;
            }
        }
예제 #3
0
        private void cboKhuVuc_cboTrangThaiBanAn_SelectedIndexChanged(object sender, EventArgs e)
        {
            RestaurantServicesSoapClient serv = new RestaurantServicesSoapClient();
            var dtBanAn = serv.Lay_BanAn((int)cboKhuVuc.SelectedValue, (int)cboTrangThaiBanAn.SelectedValue);

            LoadBanAn(dtBanAn);
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (_CurrDatBan == null)
            {
                MessageBox.Show("Chưa chọn bàn hoặc bàn trống!");
                return;
            }
            RestaurantServicesSoapClient serv = new RestaurantServicesSoapClient();
            var dt = serv.ThanhToan(_CurrDatBan.DatBanID, NhanVienID, null);

            if (dt.Rows[0].Field <int>(0) == -1)
            {
                MessageBox.Show(dt.Rows[0].Field <string>(1), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("Thanh toán thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadBanAn(serv.Lay_BanAn((int)cboKhuVuc.SelectedValue, (int)cboTrangThaiBanAn.SelectedValue));
                listViewBanAn.SelectedIndices.Clear();
                var x = listViewBanAn.Items.Find(_SelectedBanAn.BanAnID.ToString(), false);
                listViewBanAn.Items[x[0].Index].Selected = true;
            }
        }