Beispiel #1
0
        private void BindGridNhapVatTu()
        {
            var listNhapVatTu = dts.Sp_Qlvt_PhieuNhap_Select(0, null, null, null, null, null, null, null, null, null, null, "", " NgayTao DESC").Take(5).ToList();

            colPageNhapVatTu.DataSource    = listNhapVatTu;
            colPageNhapVatTu.BindToControl = rptDanhMucNhapVatTu;
            rptDanhMucNhapVatTu.DataSource = colPageNhapVatTu.DataSourcePaged;
        }
Beispiel #2
0
        private void BindGrid()
        {
            var dts    = new xRPDataContext();
            var status = int.Parse(ddlTinhTrang.SelectedValue);

            if (searchbox.Value.Trim() == "")
            {
                DateTime dateFrom = DateTime.MinValue, dateTo = DateTime.Now;
                if (!DateTime.TryParseExact(datepicker.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateFrom))
                {
                    dateFrom = DateTime.Now.AddMonths(-1);
                }
                if (!DateTime.TryParseExact(datepicker1.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTo))
                {
                    dateTo = DateTime.Now;
                }

                var x = dts.Sp_Qlvt_PhieuNhap_Select((int)EnumPhieuNhap.SelectTypes.All,
                                                     (int?)null, 0, (int?)null, (int?)null, null, (int?)null,
                                                     (int)(int)EnumPhieuNhap.KieuVatTu.NhapThanhPham, status < 0 || status > 2 ? (int?)null : status, dateFrom.AddDays(-1), dateTo.AddDays(1), null, " NgayTao DESC").ToList();
                colPage.DataSource             = x;
                colPage.BindToControl          = rptDanhMucLoaiVatTu;
                rptDanhMucLoaiVatTu.DataSource = colPage.DataSourcePaged;
                Sp_Qlvt_PhieuNhap_SelectResult ru = new Sp_Qlvt_PhieuNhap_SelectResult();
            }
            else
            {
                DateTime dateFrom = DateTime.MinValue, dateTo = DateTime.Now;
                if (!DateTime.TryParseExact(datepicker.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateFrom))
                {
                    dateFrom = DateTime.Now.AddMonths(-1);
                }
                if (!DateTime.TryParseExact(datepicker1.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTo))
                {
                    dateTo = DateTime.Now;
                }

                var type = string.IsNullOrEmpty(searchbox.Value) == true ? (int)EnumPhieuNhap.SelectTypes.All : (int)EnumPhieuNhap.SelectTypes.Seach;
                var x    = dts.Sp_Qlvt_PhieuNhap_Select(type,
                                                        (int?)null, 0, (int?)null, (int?)null, null, (int?)null,
                                                        (int)(int)EnumPhieuNhap.KieuVatTu.NhapThanhPham, status < 0 || status > 2 ? (int?)null : status, dateFrom.AddDays(-1), dateTo.AddDays(1), searchbox.Value.Trim(), " NgayTao DESC").ToList();
                colPage.DataSource             = x;
                colPage.BindToControl          = rptDanhMucLoaiVatTu;
                rptDanhMucLoaiVatTu.DataSource = colPage.DataSourcePaged;
            }
        }
Beispiel #3
0
        private void BindGrid()
        {
            var dts = new xRPDataContext();

            if (searchbox.Value.Trim() == "")
            {
                DateTime dt1 = DateTime.MinValue, dt2 = DateTime.Now;
                if (!DateTime.TryParseExact(datepicker.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt1))
                {
                    datepicker.Value = DateTime.Now.AddMonths(-1).ToString("dd/MM/yyyy");
                }
                if (!DateTime.TryParseExact(datepicker1.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt2))
                {
                    dt2 = DateTime.Now;
                }
                DateTime temp1 = dt1.AddDays(-1);
                DateTime temp2 = dt2.AddDays(1);

                var x = dts.Sp_Qlvt_PhieuNhap_Select((int)EnumPhieuNhap.SelectTypes.All, (int?)null, 0, (int?)null, (int?)null, null, (int?)null, 1, status < 0 || status > 2 ? (int?)null : status, temp1, temp2, null, " NgayTao DESC").ToList();
                colPage.DataSource             = x;
                colPage.BindToControl          = rptDanhMucLoaiVatTu;
                rptDanhMucLoaiVatTu.DataSource = colPage.DataSourcePaged;
                Sp_Qlvt_PhieuNhap_SelectResult ru = new Sp_Qlvt_PhieuNhap_SelectResult();
            }
            else
            {
                DateTime dt1 = DateTime.MinValue, dt2 = DateTime.Now;
                if (!DateTime.TryParseExact(datepicker.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt1))
                {
                    datepicker.Value = DateTime.Now.AddMonths(-1).ToString("dd/MM/yyyy");
                }
                if (!DateTime.TryParseExact(datepicker1.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt2))
                {
                    dt2 = DateTime.Now;
                }
                DateTime temp1 = dt1.AddDays(-1);
                DateTime temp2 = dt2.AddDays(1);
                var      x     = dts.Sp_Qlvt_PhieuNhap_Select((int)EnumPhieuNhap.SelectTypes.Seach, (int?)null, 0, (int?)null, (int?)null, null, (int?)null, 1, status < 0 || status > 2 ? (int?)null : status, temp1, temp2, searchbox.Value.Trim(), " NgayTao DESC").ToList();
                colPage.DataSource             = x;
                colPage.BindToControl          = rptDanhMucLoaiVatTu;
                rptDanhMucLoaiVatTu.DataSource = colPage.DataSourcePaged;
            }
        }