Пример #1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (!IsValidInputData())
            {
                return;
            }
            var dr = MMessageBox.Show(this, "Lưu hóa đơn?", "Thông báo"
                                      , MMessageBoxButtons.YesNo, MMessageBoxIcon.Warning);

            if (DialogResult.No == dr)
            {
                Dispose();
                return;
            }
            string tableNumber   = cboBanSo.Text;
            string billingNumber = txtHoaDonSo.Text;

            _billNumber = tableNumber + "_" + billingNumber;
            var billDto = new BillDto();

            billDto.Id = _billId;
            var tableId = MControlUtil.GetValueFromCombobox(cboBanSo);

            billDto.TableId       = long.Parse(tableId);
            billDto.BillingNumber = int.Parse(billingNumber);
            billDto.EmployeeId    = MControlUtil.GetValueFromCombobox(cboEmployee);
            billDto.EmployeeName  = cboEmployee.Text.Trim();
            string currentUserName = _danhSachUser.GetCurrentUserName();

            billDto.CreatedBy = currentUserName;
            billDto.UpdatedBy = currentUserName;
            _billingDao.SaveBill(billDto);
            _isChange = true;
            Dispose();
        }
Пример #2
0
        private void btnThemMonAn_Click(object sender, EventArgs e)
        {
            if (!IsValidInputData())
            {
                return;
            }
            var resOrderDto = new ResOrderDto();

            resOrderDto.MenuId = long.Parse(MControlUtil.GetValueFromCombobox(cboMonAn));
            resOrderDto.BillId = GetSelectedBillId();
            resOrderDto.Amount = long.Parse(txtSoLuong.Text);
            var disCount = 0.0f;

            if (!"".Equals(txtChietKhau.Text))
            {
                disCount = long.Parse(txtChietKhau.Text) / 100.0f;
            }
            resOrderDto.Discount = disCount;
            string currentUserName = _danhSachUser.GetCurrentUserName();

            resOrderDto.CreatedBy = currentUserName;
            resOrderDto.UpdatedBy = currentUserName;
            _billingDao.AddNewResOrder(resOrderDto);
            dgvHoaDon_SelectionChanged(null, null);
        }
Пример #3
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            if (!IsValidInputData())
            {
                return;
            }
            var dr = MMessageBox.Show(this, "Lưu thực đơn?", "Thông báo"
                                      , MMessageBoxButtons.YesNo, MMessageBoxIcon.Warning);

            if (DialogResult.No == dr)
            {
                Dispose();
                return;
            }
            var menuCode    = txtMenuCode.Text.Trim();
            var menuName    = txtMenuName.Text.Trim();
            var unitId      = MControlUtil.GetValueFromCombobox(cboUnit);
            var price       = txtPrice.Text.Trim();
            var description = txtDescription.Text.Trim();
            var dto         = new MenuDto()
            {
                Id          = _menuId,
                Code        = menuCode,
                Name        = menuName,
                CategoryId  = _categoryId,
                UnitId      = long.Parse(unitId),
                Price       = float.Parse(price),
                Description = description
            };

            _billingDao.SaveMenu(dto);
            _isChange = true;
            Dispose();
        }
        private void btnThucHien_Click(object sender, EventArgs e)
        {
            if (!IsValidInputData())
            {
                return;
            }
            var tuNgay        = txtFromDate.Text.Trim();
            var denNgay       = txtToDate.Text.Trim();
            var billingNumber = txtBillingNumber.Text.Trim();
            var tableId       = MControlUtil.GetValueFromCombobox(tableComboBox);
            var billStatus    = MControlUtil.GetValueFromCombobox(billStatusComboBox);
            var allBillDto    = _billingDao.GetAllBillBy(tuNgay, denNgay, billingNumber, tableId, billStatus);

            FillBill2Grid(allBillDto);
        }
Пример #5
0
        private bool IsValidInputData()
        {
            if ("".Equals(txtCategory.Text.Trim()))
            {
                MMessageBox.Show(this, "Nhóm thực đơn không tồn tại", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtCategory.Focus();
                return(false);
            }
            string menuCode = txtMenuCode.Text.Trim();

            if ("".Equals(menuCode))
            {
                MMessageBox.Show(this, "Bạn chưa nhập mã thực đơn", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtMenuCode.Focus();
                return(false);
            }
            if ("".Equals(txtMenuName.Text.Trim()))
            {
                MMessageBox.Show(this, "Bạn chưa nhập tên thực đơn", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtMenuName.Focus();
                return(false);
            }
            var unitId = MControlUtil.GetValueFromCombobox(cboUnit);

            if ("".Equals(unitId))
            {
                MMessageBox.Show(this, "Bạn chưa chọn đơn vị", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                cboUnit.Focus();
                return(false);
            }
            if ("".Equals(txtPrice.Text.Trim()))
            {
                MMessageBox.Show(this, "Bạn chưa nhập giá", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtPrice.Focus();
                return(false);
            }
            return(true);
        }