예제 #1
0
        private void btnThucHien_Click(object sender, EventArgs e)
        {
            if (!IsValidInputData())
            {
                return;
            }
            var fromDate = txtFromDate.Text.Trim();
            var toDate   = txtToDate.Text.Trim();

            List <StatisticStoreDto> listDto = _storeDao.GetStatisticStores(fromDate, toDate);
            var selectedIndex = GetSelectedStoreIndex();

            if (selectedIndex > listDto.Count - 1)
            {
                selectedIndex = listDto.Count - 1;
            }

            inventoryDataGridView.Rows.Clear();

            foreach (StatisticStoreDto dto in listDto)
            {
                AddOneRow(dto);
            }
            MControlUtil.SetSelectedIndex(inventoryDataGridView, selectedIndex, "material");
        }
        private void btnThucHien_Click(object sender, EventArgs e)
        {
            if (!IsValidInputData())
            {
                return;
            }
            var searchDto      = CreateSearchDto();
            var allResOrderDto = _billingDao.GetAllResOrderDto(searchDto);

            var selectedIndex = GetSelectedSellIndex();

            if (selectedIndex > allResOrderDto.Count - 1)
            {
                selectedIndex = allResOrderDto.Count - 1;
            }
            sellDataGridView.Rows.Clear();
            float tongSo = 0;

            foreach (var dto in allResOrderDto)
            {
                AddOneSellRow(dto);
                tongSo += dto.Total;
            }
            txtTongSo.Text = tongSo.ToString("#,###,###") + " VNĐ";
            MControlUtil.SetSelectedIndex(sellDataGridView, selectedIndex, "menu");
        }
예제 #3
0
        private void dgvHoaDon_SelectionChanged(object sender, EventArgs e)
        {
            var billId  = GetSelectedBillId();
            var billDto = _billingDao.getBillDto(billId);

            txtInHoaDon.Text = ConstUtil.YES.Equals(billDto.IsPrinted) ? "Đã in" : "Chưa in";
            string thanhToan = GetThanhToan(billDto.Payment);

            txtThanhToan.Text = thanhToan;
            var allResOrderDtos = _billingDao.GetAllResOrderBy(billId);
            var selectedIndex   = GetSelectedResOrderIndex();

            if (selectedIndex > allResOrderDtos.Count - 1)
            {
                selectedIndex = allResOrderDtos.Count - 1;
            }
            dgvThucDon.Rows.Clear();
            float tongTien = 0;
            float oneTotal;

            foreach (var dto in allResOrderDtos)
            {
                AddOneResOrderRow(dto, out oneTotal);
                tongTien += oneTotal;
            }
            MControlUtil.SetSelectedIndex(dgvThucDon, selectedIndex, "MON_AN");
            string tongVal = tongTien.ToString("#,###,###");

            txtTongTien.Text = string.IsNullOrEmpty(tongVal) ? string.Empty : tongVal + " VNĐ";
        }
        private void FillBill2Grid(List <BillDto> allBillDto)
        {
            var selectedIndex = GetSelectedBillIndex();

            if (selectedIndex > allBillDto.Count - 1)
            {
                selectedIndex = allBillDto.Count - 1;
            }
            dgvBilling.Rows.Clear();
            foreach (var billDto in allBillDto)
            {
                AddOneBillRow(billDto);
            }
            MControlUtil.SetSelectedIndex(dgvBilling, selectedIndex, "billNumber");
        }
예제 #5
0
        private void FillData2Grid(List <UserDto> allUserDto)
        {
            var selectedIndex = GetSelectedUserIndex();

            if (selectedIndex > allUserDto.Count - 1)
            {
                selectedIndex = allUserDto.Count - 1;
            }
            dgvUser.Rows.Clear();
            foreach (var dto in allUserDto)
            {
                AddOneUserRow(dto);
            }
            MControlUtil.SetSelectedIndex(dgvUser, selectedIndex, "UserName");
        }
예제 #6
0
        private void FillData2CategoryGrid()
        {
            var allCategoryDto = _billingDao.GetAllCategory();
            var selectedIndex  = GetSelectedCategoryIndex();

            if (selectedIndex > allCategoryDto.Count - 1)
            {
                selectedIndex = allCategoryDto.Count - 1;
            }
            dgvCategory.Rows.Clear();
            foreach (var dto in allCategoryDto)
            {
                AddOneCategoryRow(dto);
            }
            MControlUtil.SetSelectedIndex(dgvCategory, selectedIndex, "code");
            dgvCategory_SelectionChanged(null, null);
        }
예제 #7
0
        private void FillBill2Grid()
        {
            var allBillDto    = _billingDao.GetAllNotCompletedBill();
            var selectedIndex = GetSelectedBillIndex();

            if (selectedIndex > allBillDto.Count - 1)
            {
                selectedIndex = allBillDto.Count - 1;
            }
            dgvHoaDon.Rows.Clear();
            foreach (var billDto in allBillDto)
            {
                AddOneBillRow(billDto);
            }
            MControlUtil.SetSelectedIndex(dgvHoaDon, selectedIndex, "billNumber");
            dgvHoaDon_SelectionChanged(null, null);
        }
예제 #8
0
        private void InitDataGridView(List <DanhMucDto> allDto)
        {
            int selectedIndex = dgvLov.CurrentRow == null ? 0 : dgvLov.CurrentRow.Index;

            dgvLov.Rows.Clear();
            foreach (var dto in allDto)
            {
                OnAddOneRow(dgvLov.Rows, dto);
            }
            if (selectedIndex >= allDto.Count)
            {
                selectedIndex = allDto.Count - 1;
            }
            if (selectedIndex >= 0)
            {
                MControlUtil.SetSelectedIndex(dgvLov, selectedIndex, "MA");
            }
        }
예제 #9
0
        private void dgvCategory_SelectionChanged(object sender, EventArgs e)
        {
            var categoryId = GetSelectedCategoryId();

            if (categoryId == -1)
            {
                return;
            }
            var allMenuDto    = _billingDao.GetAllMenuBy(categoryId);
            var selectedIndex = GetSelectedMenuIndex();

            if (selectedIndex > allMenuDto.Count - 1)
            {
                selectedIndex = allMenuDto.Count - 1;
            }
            dgvMenu.Rows.Clear();
            foreach (var dto in allMenuDto)
            {
                AddOneMenuRow(dto);
            }
            MControlUtil.SetSelectedIndex(dgvMenu, selectedIndex, "menuCode");
        }