Beispiel #1
0
        private string TaoCauTruyVan()
        {
            string strTruyVan = string.Empty;

            strTruyVan += string.Format("NgayLap >= #{0}# and NgayLap <= #{1}#", TienIch.LayNgayThangQuocTe(dtpNgayDau.Value), TienIch.LayNgayThangQuocTe(dtpNgayCuoi.Value));

            return(strTruyVan);
        }
Beispiel #2
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (dgvChiTietBH.Rows.Count == 0 || txtTenKH.Text == "")
            {
                FormMessage.Show("Vui lòng nhập đầy đủ thông tin!", "Nhắc nhở", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (bThemKH)
            {
                clsKhachHang_DTO khachHang = new clsKhachHang_DTO();
                khachHang.TenKhachHang = txtTenKH.Text;
                khachHang.SoDT         = txtSoDT.Text;
                khachHang.DiaChi       = txtDiaChi.Text;

                strMaKH = _KhachHangBUS.ThemKhachHang(khachHang);
            }
            clsBaoHanh_DTO baoHanh = new clsBaoHanh_DTO();

            baoHanh.MaKhachHang = strMaKH;
            baoHanh.MaNhanVien  = Program.MA_NV;
            baoHanh.NgayBaoHanh = TienIch.LayNgayThangHienTaiQuocTe();
            string strMaBH = _BaoHanhBUS.ThemBaoHanh(baoHanh);

            List <clsChiTietBaoHanh_DTO> dsChiTiet = new List <clsChiTietBaoHanh_DTO>();

            foreach (DataGridViewRow dgvRow in dgvChiTietBH.Rows)
            {
                clsChiTietBaoHanh_DTO chiTiet = new clsChiTietBaoHanh_DTO();
                chiTiet.MaBaoHanh  = strMaBH;
                chiTiet.MaSerial   = _SerialBUS.LayMaSerial(dgvRow.Cells[1].Value.ToString());
                chiTiet.NgayHenTra = TienIch.LayNgayThangQuocTe(Convert.ToDateTime(dgvRow.Cells[3].Value.ToString()));
                int iTinhTrang = dgvRow.Cells[5].Value.ToString() == "Chưa trả hàng" ? 0 : dgvRow.Cells[5].Value.ToString() == "Đổi hàng" ? 2 : 3;
                chiTiet.TinhTrang = Convert.ToInt16(dgvRow.Cells[5].Value);
                chiTiet.MotaLoi   = dgvRow.Cells[2].Value.ToString();
                chiTiet.GhiChu    = dgvRow.Cells[4].Value.ToString();

                dsChiTiet.Add(chiTiet);
            }
            _ChiTietBaoHanhBUS.ThemChiTietBaoHanh(dsChiTiet, strMaBH);
            FormMessage.Show("Lưu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            LamSach();
        }
        private string TaoCauTruyVan()
        {
            string strTruyVan = string.Empty;

            if (chkNgayGui.Checked)
            {
                strTruyVan += string.Format("NgayBaoHanh >= #{0}# and NgayBaoHanh <= #{1}#", TienIch.LayNgayThangQuocTe(dtpNgayDau.Value), TienIch.LayNgayThangQuocTe(dtpNgayCuoi.Value));
            }
            if (chkLoai.Checked)
            {
                if (strTruyVan != "")
                {
                    strTruyVan += " and ";
                }

                if (cboLoai.SelectedIndex == 0)
                {
                    strTruyVan += "TRUE";
                }
                else if (cboLoai.SelectedIndex == 1)
                {
                    strTruyVan += "TinhTrang=0";
                }
                else if (cboLoai.SelectedIndex == 2)
                {
                    strTruyVan += "TinhTrang=2";
                }
                else if (cboLoai.SelectedIndex == 3)
                {
                    strTruyVan += "TinhTrang=3";
                }
            }
            if (chkMaNCC.Checked)
            {
                if (strTruyVan != "")
                {
                    strTruyVan += " and ";
                }

                strTruyVan += string.Format("MaNhaCungCap='{0}'", txtMaNCC.Text);
            }
            return(strTruyVan);
        }
Beispiel #4
0
        private string TaoCauTruyVan()
        {
            string strTruyVan = string.Empty;

            if (chkNgay.Checked)
            {
                strTruyVan += string.Format("NgayBaoHanh >= #{0}# and NgayBaoHanh <= #{1}#", TienIch.LayNgayThangQuocTe(dtpNgayDau.Value), TienIch.LayNgayThangQuocTe(dtpNgayCuoi.Value));
            }
            if (chkNV.Checked)
            {
                if (strTruyVan != "")
                {
                    strTruyVan += " and ";
                }
                strTruyVan += string.Format("MaNhanVien = '{0}'", cboNV.SelectedValue);
            }
            if (chkMaKH.Checked)
            {
                if (strTruyVan != "")
                {
                    strTruyVan += " and ";
                }
                strTruyVan += string.Format("MaKhachHang = '{0}'", txtMaKH.Text);
            }
            return(strTruyVan);
        }