private void PopulateData() { DateTime? _dateFrom = null; DateTime? _dateTo = null; List <Prescription> orders = new List <Prescription>(); //if (null == base.Session[SessionKey.LabClient]) //{ if (ckbTodaysOrders.Checked) { _dateFrom = DateTime.Today; _dateTo = DateTime.Today.AddDays(1).AddMilliseconds(-1); } string orderStatus = rbtlst_findOrder.SelectedValue == "Pending" ? "1" : "3"; PrescriptionFilter filter = new PrescriptionFilter() { LocationId = this.LocationId, DeleteFlag = false, DateFrom = _dateFrom, DateTo = _dateTo, OrderStatus = orderStatus }; IPharmacyRepo repoMgr = (IPharmacyRepo)ObjectFactory.CreateInstance("BusinessProcess.Pharmacy.BPharmacyRequest, BusinessProcess.Pharmacy"); orders = repoMgr.GetAll(filter); //} //else //{ // List<KeyValuePair<string, Object>> param = base.Session[SessionKey.LabClient] as List<KeyValuePair<string, Object>>; // int patientId = (int)param.Find(l => l.Key == "PatientID").Value; // int location = (int)param.Find(l => l.Key == "LocationID").Value; // lblname.Text = string.Format("{0} {1} {2}", (string)(param.Find(l => l.Key == "FirstName").Value.ToString()) // , (string)(param.Find(l => l.Key == "MiddleName").Value.ToString()) // , (string)(param.Find(l => l.Key == "LastName").Value.ToString())); // lbldob.Text = Convert.ToDateTime(param.Find(l => l.Key == "DOB").Value.ToString()).ToString("dd-MMM-yyyy"); // lblFacilityID.Text = param.Find(l => l.Key == "FacilityID").Value.ToString(); // lblsex.Text = param.Find(l => l.Key == "Gender").Value.ToString(); // LabOrderFilter filter = new LabOrderFilter() // { // LocationId = location, // DeleteFlag = false, // DateFrom = null, // DateTo = null, // PatientId = patientId // }; // ILabRepo repoMgr = (ILabRepo)ObjectFactory.CreateInstance("BusinessProcess.Laboratory.BLabRequest, BusinessProcess.Laboratory"); // orders = repoMgr.GetAll(filter); //} grdPatienOrder.DataSource = orders; grdPatienOrder.DataBind(); }
/// <summary> /// Gets all filterd. /// </summary> /// <param name="filter">The filter.</param> /// <returns></returns> public override List <Prescription> GetAllFilterd(Entities.Common.IFilter filter) { var prescriptions = Filter(o => o.LocationId == filter.LocationId); PrescriptionFilter _filter = (PrescriptionFilter)filter; if (_filter.PatientId.HasValue) { prescriptions = prescriptions.Where(o => o.Client.Id == _filter.PatientId.Value); } if (!string.IsNullOrEmpty(_filter.ReferenceNumber)) { prescriptions = prescriptions.Where(o => o.PrescriptionNumber == _filter.ReferenceNumber); } if (_filter.DateFrom.HasValue && _filter.DateTo.HasValue) { prescriptions = prescriptions.Where(o => o.PrescriptionDate >= _filter.DateFrom.Value && o.PrescriptionDate <= _filter.DateTo.Value); } //if (!string.IsNullOrEmpty(_filter.OrderStatus)) //{ // prescriptions = prescriptions.Where(o => o.OrderStatus == _filter.OrderStatus); //} return(prescriptions.ToList <Prescription>()); }