public ActionResult RpmPatientsList(RpmQueFilterViewModel obj) { ViewBag.AvalilabeDevices = _db.Device.Where(x => x.IsActive == (int)IsActiveStatus.Active && x.DeviceStatusId == (int)DeviceStatus.ReadyToMap).ToList(); var RpmEnrolledPatients = new List <RpmPatientsViewModel>(); if (obj == null) { int zero = Convert.ToInt32("0"); RpmEnrolledPatients = _db.Database.SqlQuery <RpmPatientsViewModel>("GetAllPatientForDeviceMapping @Devices_BrandId,@Device_BrandModelId,@VendorId,@RPMServiceId,@DeviceStatusId,@SerialNumber", new SqlParameter("@Devices_BrandId", zero), new SqlParameter("@Device_BrandModelId", zero), new SqlParameter("@VendorId", zero), new SqlParameter("@RPMServiceId", zero), new SqlParameter("@DeviceStatusId", zero), new SqlParameter("@SerialNumber", "")).ToList(); return(View(RpmEnrolledPatients)); } obj.BrandId = obj.BrandId != null ? obj.BrandId : 0; obj.DeviceCurrentStatus = obj.DeviceCurrentStatus != null ? obj.DeviceCurrentStatus : 0; obj.ModelId = obj.ModelId != null ? obj.ModelId : 0; obj.RpmServiceId = obj.RpmServiceId != null ? obj.RpmServiceId : 0; obj.SerialNumber = obj.SerialNumber != null ? obj.SerialNumber : string.Empty; obj.VendorId = obj.VendorId != null ? obj.VendorId : 0; RpmEnrolledPatients = _db.Database.SqlQuery <RpmPatientsViewModel>("GetAllPatientForDeviceMapping @Devices_BrandId,@Device_BrandModelId,@VendorId,@RPMServiceId,@DeviceStatusId,@SerialNumber", new SqlParameter("@Devices_BrandId", Convert.ToInt32(obj.BrandId.ToString())), new SqlParameter("@Device_BrandModelId", Convert.ToInt32(obj.ModelId.ToString())), new SqlParameter("@VendorId", Convert.ToInt32(obj.VendorId.ToString())), new SqlParameter("@RPMServiceId", Convert.ToInt32(obj.RpmServiceId.ToString())), new SqlParameter("@DeviceStatusId", Convert.ToInt32(obj.DeviceCurrentStatus.ToString())), new SqlParameter("@SerialNumber", obj.SerialNumber)).ToList(); //RpmEnrolledPatients = _db.Database.SqlQuery<RpmPatientsViewModel>("GetAllPatientForDeviceMapping @Devices_BrandId,@Device_BrandModelId,@VendorId,@RPMServiceId,@DeviceStatusId,@SerialNumber", // new SqlParameter("@Devices_BrandId", Convert.ToInt32(obj.BrandId.ToString())), new SqlParameter("@Device_BrandModelId", Convert.ToInt32(obj.ModelId.ToString())), new SqlParameter("@VendorId", Convert.ToInt32(obj.VendorId.ToString())), new SqlParameter("@RPMServiceId", Convert.ToInt32(obj.RpmServiceId.ToString())), new SqlParameter("@DeviceStatusId", Convert.ToInt32(obj.DeviceCurrentStatus).ToString()), new SqlParameter("@SerialNumber", obj.DeviceCurrentStatus.ToString())).ToList(); return(View(RpmEnrolledPatients)); }
//public ActionResult RpmPatientsList(RpmQueFilterViewModel obj) //{ // ViewBag.AvalilabeDevices = _db.Device.Where(x => x.IsActive == (int)IsActiveStatus.Active && x.DeviceStatusId == (int)DeviceStatus.ReadyToMap).ToList(); // var RpmEnrolledPatients = new List<Patient>(); // RpmEnrolledPatients = _db.Patients_BillingCategories.Where(p => p.Status == true && p.BillingCategoryId == BillingCodeHelper.RPMBillingCatagoryid).Select(p => p.Patients).Distinct().ToList(); // if (obj == null) // { // return View(RpmEnrolledPatients); // } // else // { // if (obj.BrandId != null) // { // foreach (var item in RpmEnrolledPatients) // { // item.Patients_Services.RemoveAll(x => x.Device.Devices_BrandId != obj.BrandId); // } // } // else if (obj.VendorId != null) // { // foreach (var item in RpmEnrolledPatients) // { // item.Patients_Services.RemoveAll(x => x.Device.VendorId != obj.VendorId); // } // } // else if (obj.ModelId != null) // { // foreach (var item in RpmEnrolledPatients) // { // item.Patients_Services.RemoveAll(x => x.Device.Device_BrandModelId != obj.ModelId); // } // } // else if (obj.SerialNumber != null) // { // foreach (var item in RpmEnrolledPatients) // { // item.Patients_Services.RemoveAll(x => !x.Device.SerialNumber.Contains(obj.SerialNumber)); // } // } // else if (obj.RpmServiceId != null) // { // foreach (var item in RpmEnrolledPatients) // { // item.Patients_Services.RemoveAll(x => x.Device.RPMServiceId!=obj.RpmServiceId); // } // } // else if (obj.DeviceCurrentStatus != null) // { // foreach (var item in RpmEnrolledPatients) // { // item.Patients_Services.RemoveAll(x => x.Device.DeviceStatusId != obj.DeviceCurrentStatus); // } // } // } // return View(RpmEnrolledPatients); //} public ActionResult Filters() { ViewBag.IsAvtiveStatus = Enum.GetValues(typeof(IsActiveStatus)).Cast <IsActiveStatus>().Select(y => new SelectListItem { Text = y.ToString(), Value = ((int)y).ToString() }).ToList(); ViewBag.DeviceStatus = Enum.GetValues(typeof(DeviceStatus)).Cast <DeviceStatus>().Select(y => new SelectListItem { Text = y.ToString(), Value = ((int)y).ToString() }).ToList(); ViewBag.ModelNumber = _db.Device_BrandModels.Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }).ToList(); ViewBag.Vendors = _db.Device_Vendors.Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }).ToList(); ViewBag.Device_brands = _db.Devices_Brands.Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Name }).ToList(); RpmQueFilterViewModel model = new RpmQueFilterViewModel(); return(View(model)); }