public JsonResult Details(SampleReceivingModel sampleReceivingModel) { IEnumerable<SampleReceive> lstSampleReceive = null; sampleReceivingModel.ToDate = new DateTime(sampleReceivingModel.ToDate.Year, sampleReceivingModel.ToDate.Month, sampleReceivingModel.ToDate.Day, 23, 59, 59); if (sampleReceivingModel.ToDate.Year >= 1900 && sampleReceivingModel.FromDate.Year >= 1900) { lstSampleReceive = SampleReceivingService.FindBy(p => p.CreatedDate >= sampleReceivingModel.FromDate && p.CreatedDate <= sampleReceivingModel.ToDate); } else if (sampleReceivingModel.ToDate.Year >= 1900 && sampleReceivingModel.FromDate.Year <= 1900) { lstSampleReceive = SampleReceivingService.FindBy(p => p.CreatedDate >= DateTime.MinValue && p.CreatedDate <= sampleReceivingModel.ToDate); } else if (sampleReceivingModel.ToDate.Year <= 1900 && sampleReceivingModel.FromDate.Year >= 1900) { lstSampleReceive = SampleReceivingService.FindBy(p => p.CreatedDate >= sampleReceivingModel.FromDate && p.CreatedDate <= DateTime.MaxValue); } else { lstSampleReceive = SampleReceivingService.FindBy(p => p.CreatedDate >= DateTime.MinValue && p.CreatedDate <= DateTime.MaxValue); } ViewBag.ResultMessage = lstSampleReceive.Count() == 0 ? "No Record Found" : ""; return Json(lstSampleReceive.Select(x => new { SRID = x.SRID }), JsonRequestBehavior.AllowGet); }
public ActionResult Details(SampleReceivingModel sampleReceivingModel) { IEnumerable<SampleReceive> lstSampleReceive = null; if (!string.IsNullOrEmpty(sampleReceivingModel.SRID)) { lstSampleReceive = SampleReceivingService.FindBy(p => p.SRID == sampleReceivingModel.SRID); } else { sampleReceivingModel.ToDate = new DateTime(sampleReceivingModel.ToDate.Year, sampleReceivingModel.ToDate.Month, sampleReceivingModel.ToDate.Day, 23, 59, 59); if (sampleReceivingModel.ToDate.Year >= 1900 && sampleReceivingModel.FromDate.Year >= 1900) { lstSampleReceive = SampleReceivingService.FindBy(p => p.CreatedDate >= sampleReceivingModel.FromDate && p.CreatedDate <= sampleReceivingModel.ToDate); } else if (sampleReceivingModel.ToDate.Year >= 1900 && sampleReceivingModel.FromDate.Year <= 1900) { lstSampleReceive = SampleReceivingService.FindBy(p => p.CreatedDate >= DateTime.MinValue && p.CreatedDate <= sampleReceivingModel.ToDate); } else if (sampleReceivingModel.ToDate.Year <= 1900 && sampleReceivingModel.FromDate.Year >= 1900) { lstSampleReceive = SampleReceivingService.FindBy(p => p.CreatedDate >= sampleReceivingModel.FromDate && p.CreatedDate <= DateTime.MaxValue); } else { lstSampleReceive = SampleReceivingService.FindBy(p => p.CreatedDate >= DateTime.MinValue && p.CreatedDate <= DateTime.MaxValue); } } sampleReceivingModel.lstSampleReceiving = lstSampleReceive; ViewBag.ResultMessage = sampleReceivingModel.lstSampleReceiving.Count() == 0 ? "No Record Found" : ""; return View(sampleReceivingModel); }