Exemple #1
0
        public JsonResult jsonDeletePatients(string ids)
        {
            string[] split = ids.Split(new char[] { ',' });

            DataSubmissions.DeletePatients(db, split);
            //for (int i = 0; i < ids.Length; i++)
            //{
            //    int id = Convert.ToInt32(split[i]);
            //    PatientLog patient = db.PatientLogs.Find(id);
            //    //PatientLogTmp pt = DataSubmissions.CreateTmpPatient(patient);
            //    //db.PatientLogTmps.Add(pt);
            //    //db.PatientLogs.Remove(patient);
            //    DataSubmissions.DeletePatients()
            //}
            //db.SaveChanges();
            return(Json("Success", JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult Index(PatientAssignmentIndexViewModel viewM)
        {
            //Value will always be null unless CopyButton caused post
            if (viewM.CopyButton != null)
            {
                DataSubmissions.CopyPatients(db, viewM.hidSelectedIDs);
            }
            //Value will always be null unless DeleteButton caused post
            if (viewM.DeleteButton != null)
            {
                DataSubmissions.DeletePatients(db, viewM.hidSelectedIDs);
            }

            var           fromD      = new DateTime();
            var           toD        = new DateTime();
            List <string> physicians = new List <string>();
            //List<string> hospitals = new List<string>();
            string        hospitals = viewM.SelectedHospitals;
            List <string> services  = new List <string>();

            string[] splitList;

            //Manages physician input and builds a List<string> to be used in the query
            if (viewM.hidPhysicians != null && viewM.hidPhysicians != "")
            {
                splitList  = viewM.hidPhysicians.Split(new char[] { ',' });
                physicians = splitList.ToList <string>();
            }

            //Manages physician input and builds a List<string> to be used in the query
            //if (viewM.hidHospitals != null && viewM.hidHospitals != "")
            //{
            //    //splitList = viewM.hidHospitals.Split(new char[] { ',' });
            //    //hospitals = splitList.ToList<string>();
            //    hospitals = viewM.hidHospitals;
            //}
            if (viewM.hidServices != null && viewM.hidServices != "")
            {
                splitList = viewM.hidServices.Split(new char[] { ',' });
                services  = splitList.ToList <string>();
            }


            fromD = getValidDate(viewM.FromDate, true);
            toD   = getValidDate(viewM.ToDate, false);

            PatientAssignmentIndexViewModel returnM = new PatientAssignmentIndexViewModel();

            returnM.FromDate           = fromD.ToShortDateString();
            returnM.ToDate             = toD.ToShortDateString();
            returnM.PhysicianList      = DataCollections.getAIMSPhy(db);
            returnM.HospitalList       = DataCollections.getHospital(db);
            returnM.ServiceList        = DataCollections.getServiceType(db);
            returnM.ImportColumns      = DataCollections.getImportColumns(db);
            returnM.SelectedPhysicians = physicians;
            returnM.SelectedHospitals  = hospitals;
            returnM.SelectedServices   = services;
            returnM.SortColumn         = viewM.SortColumn;
            returnM.SortDirection      = viewM.SortDirection;

            Session["patientAssignmentFromDate"]      = fromD;
            Session["patientAssignmentToDate"]        = toD;
            Session["patientAssignmentSortColumn"]    = returnM.SortColumn;
            Session["patientAssignmentSortDirection"] = returnM.SortDirection;
            //Session["patientAssignmentPhysicians"] = physicians;
            //Session["patientAssignmentHospitals"] = hospitals;
            //Session["patientAssignmentServices"] = services;

            IQueryable <PatientLog> query = patientAssignmentQueryGenerator(fromD, toD, physicians, hospitals, services, returnM.SortDirection, returnM.SortColumn);

            returnM.Patients      = query.AsEnumerable <PatientLog>();
            returnM.ToLookupTally = query.ToLookup(p => p.Physician, p => p.ServiceType).ToDictionary(p => p.Key, p => p.ToArray());
            if (returnM.ToLookupTally.Count == 0)
            {
                returnM.ToLookupTally.Add("No data", new string[] { "" });
            }
            return(View(returnM));
        }