示例#1
0
        //[HttpPost]
        //public ActionResult DestinationList(string SearchDestination)
        //{
        //    List<Destination> destinations = new List<Destination>();
        //    DestinationViewModel viewModel = new DestinationViewModel();


        //    if (string.IsNullOrWhiteSpace(SearchDestination))
        //    {
        //        destinations = viewModel.RetrieveDestinations();
        //    }
        //    else
        //    {
        //        //destinations = viewModel.retrieveDestinations();
        //        try
        //        {
        //            string[] splitTaskName = SearchDestination.Split(',');
        //            string destinationName = splitTaskName[0].ToString();
        //            string statecode = splitTaskName[2].ToString();
        //            Union_Facilities facilities = new Union_Facilities();
        //            using (var context = new lifeflightapps())
        //            {
        //                facilities = context.Union_Facilities.Where(d => d.NAME == destinationName && d.STATE == statecode).FirstOrDefault();
        //                Destination destination = new Destination()
        //                {
        //                    DestinationName = facilities.NAME,
        //                    Address = facilities.ADDRESS,
        //                    City = facilities.CITY,
        //                    County = facilities.COUNTY,
        //                    State = facilities.STATE,
        //                    Zip = facilities.ZIP,
        //                    Phone = facilities.PHONE
        //                };
        //                destinations.Add(destination);
        //            }
        //            //destinations = viewModel.RetrieveDesiredDestinations(SearchDestination);
        //        }
        //        catch (Exception ex)
        //        {

        //            throw ex;
        //        }

        //    }

        //    return View(destinations);
        //}


        public ActionResult AddDestination(Destination destination)
        {
            if (string.IsNullOrEmpty(destination.DestinationName))
            {
                Destination  model        = new Destination();
                RequestModel requestModel = new RequestModel();
                model.StatesList = requestModel.GetStatesList().ToList();
                return(View(model));
            }
            else
            {
                using (var context = new lifeflightapps())
                {
                    tblNursingHome nursingHome = new tblNursingHome()
                    {
                        Name    = destination.DestinationName,
                        Address = destination.Address,
                        City    = destination.City,
                        County  = destination.County,
                        State   = destination.State,
                        Zip     = Convert.ToDouble(destination.Zip),
                        Phone   = destination.Phone
                    };

                    context.tblNursingHomes.Add(nursingHome);
                    context.SaveChanges();
                    int id = nursingHome.NursingHomeID;
                    return(RedirectToAction("GetDestinationDetails", new { DestinationId = id }));
                }
            }
        }
示例#2
0
        /// <summary>
        /// Add the insurance xref EMS reference
        /// </summary>
        /// <param name="InsuranceId"></param>
        /// <param name="Agencies"></param>
        /// <returns></returns>
        public JsonResult AddInsAgencies(int InsuranceId, string Agencies)
        {
            string[] selectedAgencies = Agencies.Split(',');
            //var insagencies = db.tblInsuranceEmsXrefs.Where(x => x.InsuranceProviderID == InsuranceId).Select(x => x.AgencyId);
            //if (insagencies.Any())
            //{

            //}
            //else
            //{
            foreach (var item in selectedAgencies)
            {
                tblInsuranceEmsXref xref = new tblInsuranceEmsXref()
                {
                    Active              = true,
                    AgencyId            = Convert.ToInt32(item),
                    InsuranceProviderID = InsuranceId
                };

                using (var context = new lifeflightapps())
                {
                    context.tblInsuranceEmsXrefs.Add(xref);
                    context.SaveChanges();
                }
            }
            //}
            return(Json(JsonRequestBehavior.AllowGet));
        }
示例#3
0
        /// <summary>
        /// Gets all the insurance agencies and displays them 10 per page
        /// and also has an ability to search
        /// </summary>
        /// <param name="page"></param>
        /// <param name="InsAgencyName"></param>
        /// <returns></returns>
        public ActionResult InsuranceAgencies(int?page, string InsAgencyName)
        {
            List <InsuranceModel> models = new List <InsuranceModel>();

            using (var context = new lifeflightapps())
            {
                if (!string.IsNullOrEmpty(InsAgencyName))
                {
                    var insAgencyQueried =
                        context.tblInsuranceAgencies.FirstOrDefault(c => c.INSAGENCYNAME == InsAgencyName);

                    if (insAgencyQueried != null)
                    {
                        return(RedirectToAction("GetInsuranceAgencyDetails", new { insAgencyId = insAgencyQueried.INSURANCEID }));
                    }
                }

                var insAgencies = context.tblInsuranceAgencies.ToList();
                models = ConvertToInsModel(insAgencies);
            }
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            return(View(models.OrderBy(x => x.InsuranceName).ToPagedList(pageNumber, pageSize)));
        }
示例#4
0
        /// <summary>
        /// Retruns only the Vanderbilt destination for request type ALT Funding
        /// </summary>
        /// <returns></returns>
        private List <Destination> RetrieveVanderbiltDestinations()
        {
            List <Destination> destinationList = new List <Destination>();

            using (var context = new lifeflightapps())
            {
                var destinationsView = context.Union_Facilities.Select(n => new { n.id2, n.NAME, n.ADDRESS, n.CITY, n.STATE, n.ZIP, n.COUNTY, n.PHONE }).Where(nu => nu.NAME.Contains("vanderbilt") && nu.STATE == "TN").AsEnumerable();
                foreach (var destination in destinationsView)
                {
                    Destination hospitalDestination = new Destination()
                    {
                        Address         = destination.ADDRESS,
                        City            = destination.CITY,
                        County          = destination.COUNTY,
                        DestinationId   = destination.id2,
                        DestinationName = destination.NAME,
                        Phone           = destination.PHONE ?? string.Empty,
                        State           = destination.STATE,
                        Zip             = destination.ZIP
                    };
                    destinationList.Add(hospitalDestination);
                }
            }
            return(destinationList);
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="patientDemographics"></param>
        /// <returns></returns>
        private int PatientEntry(Patient patient)
        {
            int        patientId;
            tblPatient tPatient = new tblPatient()
            {
                FirstName   = patient.FirstName,
                LastName    = patient.LastName,
                Address     = patient.Address ?? "N/A",
                Age         = patient.Age ?? 0,
                City        = patient.City ?? "N/A",
                DateOfBirth = (!string.IsNullOrEmpty(patient.DOB)) ? Convert.ToDateTime(patient.DOB) : Convert.ToDateTime("01/01/1900"),
                Phone       = patient.Phone ?? "N/A",
                Social      = patient.Social ?? "N/A",
                State       = patient.State ?? "N/A",
                Weight      = Convert.ToInt32(patient.Weight),
                WeightUnit  = patient.WeightUnit,
                MrNumber    = patient.MRN,
                Zip         = patient.Zip ?? "N/A",
                CreatedBy   = User.Identity.Name,
                CreatedDate = DateTime.Now
            };

            using (var context = new lifeflightapps())
            {
                context.tblPatients.Add(tPatient);
                context.SaveChanges();
                patientId = tPatient.PatientID;
            }
            return(patientId);
        }
示例#6
0
        /// <summary>
        /// Get the agency details
        /// </summary>
        /// <param name="agencyId"></param>
        /// <returns></returns>
        public ActionResult GetAgencyDetails(int agencyId)
        {
            tblEmsAgencyLocal agency = new tblEmsAgencyLocal();

            using (var context = new lifeflightapps())
            {
                agency = context.tblEmsAgencyLocals.Find(agencyId);
            }
            AgencyModel agencyModel = new AgencyModel()
            {
                AgencyId    = agency.EMSID,
                AddressLn1  = agency.Address,
                AddressLn2  = agency.Address2,
                City        = agency.City,
                StateCode   = agency.State,
                AgencyName  = agency.Name,
                LocalUse    = agency.LocalUse,
                AgencyType  = agency.Type,
                Zip         = agency.Zip,
                County      = agency.County,
                Phone       = agency.Phones,
                BaseRate    = agency.BaseRate,
                MileageRate = agency.MileageRate,
                Notes       = agency.Notes,
                TaxId       = Convert.ToInt32(agency.taxID)
            };

            return(View(agencyModel));
        }
示例#7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="callerName"></param>
        /// <returns></returns>
        private int GetCallerId(string callerName)
        {
            int callerid = 0;

            using (var context = new lifeflightapps())
            {
                callerid = context.tblCallers.Where(c => c.CallerLastName + " " + c.CallerFirstName == callerName).Select(i => i.ID).FirstOrDefault();

                //if (callerid == 0)
                //{
                //    string[] splitCallerName = callerName.Split(' ');
                //    string Ln = splitCallerName[0].ToString();
                //    string Fn = splitCallerName[1].ToString();
                //    tblCaller tcaller = new tblCaller()
                //    {
                //        Active = true,
                //        CallerFirstName = Fn,
                //        CallerLastName = Ln
                //    };
                //    context.tblCallers.Add(tcaller);
                //    context.SaveChanges();
                //    callerid = tcaller.ID;
                //}
            }
            return(callerid);
        }
示例#8
0
        public ActionResult AllComplaints(int?page)
        {
            List <DischargeComplaintModel> complaintList = new List <DischargeComplaintModel>();

            ///TODO: Need to fix the logic of retrieving the complaints
            using (var context = new lifeflightapps())
            {
                var complaints = context.tblDischargeComplaints.ToList().OrderByDescending(x => x.ComplaintEntereddatetime).Where(x => x.ComplaintEntereddatetime > DateTime.Now.AddMonths(-2));

                foreach (var complaint in complaints)
                {
                    var discharge = context.tblDischargeRequests1.Find(complaint.RequestID);
                    if (discharge != null)
                    {
                        DischargeComplaintModel model = new DischargeComplaintModel();
                        model = ConvertToModel(complaint);
                        complaintList.Add(model);
                    }
                }
            }
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            return(View(complaintList.ToPagedList(pageNumber, pageSize)));
        }
示例#9
0
        public ActionResult FullDetails(int RequestId)
        {
            DischargeViewModel         model            = new DischargeViewModel();
            DischargeDetailsController dischargeDetails = new DischargeDetailsController();

            model.RequestModel     = dischargeDetails.PopulateModel(RequestId, true);
            model.ComplaintModel   = new DischargeComplaintModel();
            model.DischargeActions = GetDischargeActions(model.RequestModel);
            model.AuditLogs        = GetRequestHistory(RequestId);
            List <tblDischargeComplaint> complaints = new List <tblDischargeComplaint>();
            DateTime dtmLive = Convert.ToDateTime("05/21/2018");

            using (var context = new lifeflightapps())
            {
                complaints = context.tblDischargeComplaints.Where(x => x.RequestID == RequestId && x.ComplaintEntereddatetime > dtmLive).ToList();
            }
            List <DischargeComplaintModel> cModels = new List <DischargeComplaintModel>();

            foreach (var entry in complaints)
            {
                DischargeComplaintModel complaintModel = new DischargeComplaintModel();

                complaintModel = ConvertToModel(entry);
                cModels.Add(complaintModel);
            }
            model.ComplaintModels = cModels;
            return(View(model));
        }
示例#10
0
        /// <summary>
        /// Converts the insurance entity to model
        /// </summary>
        /// <param name="ins"></param>
        /// <returns></returns>
        private InsuranceModel ConvertToInsuranceModel(tblInsuranceAgency ins)
        {
            InsuranceModel model = new InsuranceModel();

            using (var context = new lifeflightapps())
            {
                var contacts = context.tblInsuranceAgencyContacts.Where(x => x.InsuranceID == ins.INSURANCEID).ToList();
                List <InsuranceContactModel> contactModels = new List <InsuranceContactModel>();
                contactModels = ConvertToContactsModel(contacts);
                InsuranceModel insModel = new InsuranceModel()
                {
                    InsuranceId     = ins.INSURANCEID,
                    InsuranceName   = ins.INSAGENCYNAME,
                    Description     = ins.DESCRIPTION,
                    Instructions    = ins.INSTRUCTIONS,
                    InsurancePhone  = ins.INSURANCEPHONE,
                    InsuranceFax    = ins.INSURANCEFAX,
                    PreAuthRequired = ins.PREAUTHREQUIRED.HasValue ? ins.PREAUTHREQUIRED.Value : false,
                    HasOwnPaperWork = ins.HASOWNPAPEROWORK.HasValue ? ins.HASOWNPAPEROWORK.Value : false,
                    CreatedBy       = ins.CREATEDBY,
                    CreatedOn       = ins.CREATEDON,
                    contactModels   = contactModels
                };
                model = insModel;
            }
            return(model);
        }
示例#11
0
 public ActionResult LoadCallers()
 {
     using (var context = new lifeflightapps())
     {
         var data = context.tblCallers.OrderBy(c => c.CallerLastName).ThenBy(ca => ca.CallerFirstName).ToList();
         return(Json(data: new { data }, behavior: JsonRequestBehavior.AllowGet));
     }
 }
示例#12
0
        public ActionResult EditCaller(Caller callerModel)
        {
            if (ModelState.IsValid)
            {
                tblCaller caller = new tblCaller()
                {
                    Active          = callerModel.Active,
                    Assignment      = callerModel.Assignment,
                    CallerEmail     = callerModel.CallerEmail,
                    MobilePhone     = callerModel.MobilePhone,
                    CallerFirstName = callerModel.CallerFirstName,
                    CallerLastName  = callerModel.CallerLastName,
                    CallerPager     = callerModel.CallerPager,
                    OfficePhone     = callerModel.OfficePhone,
                    CallerTitle     = callerModel.CallerTitle,
                    ID = callerModel.CallerId
                };
                try
                {
                    using (var context = new lifeflightapps())
                    {
                        context.tblCallers.AddOrUpdate(caller);

                        //db.tblCallers.Attach(caller);
                        //var entry = db.Entry(caller);
                        //entry.State = System.Data.Entity.EntityState.Modified;
                        context.SaveChanges();
                        var    preferredNumber = context.tblCallerPreferredNumbers.Where(x => x.CallerId == callerModel.CallerId).FirstOrDefault();
                        string number          = GetPreferredNumber(callerModel, callerModel.PreferredNumberType);
                        if (preferredNumber != null)
                        {
                            preferredNumber.PreferredNumber = number;
                            preferredNumber.PreferredType   = callerModel.PreferredNumberType;
                            context.SaveChanges();
                        }
                        else
                        {
                            tblCallerPreferredNumber cpn = new tblCallerPreferredNumber()
                            {
                                CallerId        = callerModel.CallerId,
                                PreferredNumber = number,
                                PreferredType   = callerModel.PreferredNumberType
                            };

                            context.tblCallerPreferredNumbers.Add(cpn);
                            context.SaveChanges();
                        }
                        return(RedirectToAction("Index"));
                    }
                }
                catch (DataException dx)
                {
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
                    throw dx;
                }
            }
            return(View(callerModel));
        }
示例#13
0
        public JsonResult GetFilteredCallers(string term)
        {
            List <string> callers = new List <string>();

            using (var context = new lifeflightapps())
            {
                callers = context.tblCallers.Where(s => s.CallerLastName.StartsWith(term) || s.CallerFirstName.StartsWith(term)).Select(x => x.CallerLastName + " " + x.CallerFirstName).ToList();
            }
            return(Json(callers, JsonRequestBehavior.AllowGet));
        }
示例#14
0
        /// <summary>
        /// AutoComplete for the insurance agency names
        /// </summary>
        /// <param name="term"></param>
        /// <returns></returns>
        public JsonResult GetFilteredInsAgencies(string term)
        {
            List <string> InsuranceAgencies = new List <string>();

            using (var context = new lifeflightapps())
            {
                InsuranceAgencies = context.tblInsuranceAgencies.Where(s => s.INSAGENCYNAME.StartsWith(term)).Select(x => x.INSAGENCYNAME).ToList();
            }
            return(Json(InsuranceAgencies, JsonRequestBehavior.AllowGet));
        }
示例#15
0
        /// <summary>
        /// Autocomplete for the agency search
        /// </summary>
        /// <param name="term"></param>
        /// <returns></returns>
        public JsonResult GetFilteredAgencies(string term)
        {
            List <string> agencies = new List <string>();

            using (var context = new lifeflightapps())
            {
                agencies = context.tblEmsAgencyLocals.Where(s => s.Name.StartsWith(term)).Select(x => x.Name + " - " + x.City + " - " + x.State).ToList();
            }
            return(Json(agencies, JsonRequestBehavior.AllowGet));
        }
示例#16
0
        /// <summary>
        /// Autocomplete for the insurance descriptions
        /// </summary>
        /// <param name="term"></param>
        /// <returns></returns>
        public JsonResult GetInsDescriptions(string term)
        {
            List <string> InsDescriptions = new List <string>();

            using (var context = new lifeflightapps())
            {
                InsDescriptions = context.tblInsuranceAgencies.Select(x => x.DESCRIPTION).Distinct().ToList();
            }
            return(Json(InsDescriptions, JsonRequestBehavior.AllowGet));
        }
示例#17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="insurances"></param>
        /// <param name="mrNumber"></param>
        /// <returns></returns>
        private int InsuranceEntry(InsuranceInformation insurances, string mrNumber)
        {
            int             insuranceId;
            tblMbrInsurance tinsurance;

            if (insurances != null)
            {
                tinsurance = new tblMbrInsurance()
                {
                    FinancialName  = insurances.FinancialName,
                    PayorName      = insurances.Payorname,
                    PayorID        = Convert.ToInt32(insurances.PayorId),
                    PlanID         = Convert.ToInt32(insurances.PlanId),
                    PlanName       = insurances.PlanName,
                    PlanType       = insurances.PlanType,
                    SubscriberName = insurances.SubscriberName,
                    MrNumber       = mrNumber,
                    Effective      = insurances.EffectiveDate,
                    Termination    = insurances.TerminationDate,
                    FillingOrder   = insurances.FilingOrder,
                    InsuranceID    = insurances.InsuranceId,
                    MedipacPlanID  = insurances.MedipacPlanId,
                    CreatedBy      = User.Identity.Name,
                    CreatedDate    = DateTime.Now
                };
            }
            else
            {
                tinsurance = new tblMbrInsurance()
                {
                    FinancialName  = "N/A",
                    PayorName      = "N/A",
                    PayorID        = 999,
                    PlanID         = 999,
                    PlanName       = "N/A",
                    PlanType       = "N/A",
                    SubscriberName = "N/A",
                    MrNumber       = mrNumber,
                    Effective      = DateTime.Now,
                    Termination    = DateTime.Now,
                    FillingOrder   = 999,
                    InsuranceID    = 999,
                    MedipacPlanID  = "N/A",
                    CreatedBy      = User.Identity.Name,
                    CreatedDate    = DateTime.Now
                };
            }
            using (var context = new lifeflightapps())
            {
                context.tblMbrInsurances.Add(tinsurance);
                context.SaveChanges();
                insuranceId = tinsurance.MbrInsuranceID;
            }
            return(insuranceId);
        }
示例#18
0
 public IEnumerable <SelectListItem> GetCareLevels()
 {
     using (var context = new lifeflightapps())
     {
         return(context.tblCareLevels.Select(c => new SelectListItem()
         {
             Text = c.LevelOfCare,
             Value = c.carelevelID.ToString()
         }));
     }
 }
示例#19
0
        public ActionResult Create(Caller CallerModel)
        {
            int    CallerId        = 0;
            var    preferred       = CallerModel.PreferredNumberType;
            string preferredNumber = string.Empty;

            try
            {
                tblCaller tcaller = new tblCaller()
                {
                    Active          = true,
                    Assignment      = CallerModel.Assignment,
                    CallerEmail     = CallerModel.CallerEmail,
                    OfficePhone     = CallerModel.OfficePhone,
                    CallerFirstName = CallerModel.CallerFirstName,
                    CallerLastName  = CallerModel.CallerLastName,
                    CallerPager     = CallerModel.CallerPager,
                    MobilePhone     = CallerModel.MobilePhone,
                    CallerTitle     = CallerModel.CallerTitle
                };
                preferredNumber = GetPreferredNumber(CallerModel, preferred);
                tblCallerPreferredNumber callerPreferredNumber = new tblCallerPreferredNumber()
                {
                    PreferredNumber = preferredNumber,
                    PreferredType   = CallerModel.PreferredNumberType
                };
                using (var context = new lifeflightapps())
                {
                    try
                    {
                        context.tblCallers.Add(tcaller);
                        context.SaveChanges();
                        CallerId = tcaller.ID;
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }


                    callerPreferredNumber.CallerId = CallerId;

                    context.tblCallerPreferredNumbers.Add(callerPreferredNumber);
                    context.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#20
0
        /// <summary>
        /// Make a DB call to get the insurance details
        /// </summary>
        /// <param name="insAgencyId"></param>
        /// <returns></returns>
        public InsuranceModel GetInsuranceFromDB(int insAgencyId)
        {
            InsuranceModel     model           = new InsuranceModel();
            tblInsuranceAgency insuranceAgency = new tblInsuranceAgency();

            using (var context = new lifeflightapps())
            {
                insuranceAgency = context.tblInsuranceAgencies.Find(insAgencyId);
                model           = ConvertToInsuranceModel(insuranceAgency);
            }
            return(model);
        }
示例#21
0
        /// <summary>
        /// Returns all the destinations from the Union_Facilities
        /// </summary>
        /// <param name="searchDestination"></param>
        /// <param name="State"></param>
        /// <returns></returns>
        private List <Destination> RetrieveDesiredDestinations(string searchDestination, string State)
        {
            List <Destination> destinationList = new List <Destination>();

            if (!string.IsNullOrEmpty(State))
            {
                using (var context = new lifeflightapps())
                {
                    var retrievedDestinations = context.Union_Facilities.Select(n => new { n.id2, n.NAME, n.ADDRESS, n.CITY, n.STATE, n.ZIP, n.COUNTY, n.PHONE })
                                                .Where(nu => nu.NAME.Contains(searchDestination) && nu.STATE == State).Take(20).AsEnumerable().ToList();
                    foreach (var destination in retrievedDestinations)
                    {
                        Destination hospitalDestination = new Destination()
                        {
                            Address         = destination.ADDRESS,
                            City            = destination.CITY,
                            County          = destination.COUNTY,
                            DestinationId   = destination.id2,
                            DestinationName = destination.NAME,
                            Phone           = destination.PHONE ?? string.Empty,
                            State           = destination.STATE,
                            Zip             = destination.ZIP
                        };
                        destinationList.Add(hospitalDestination);
                    }
                }
            }
            else
            {
                using (var context = new lifeflightapps())
                {
                    var retrievedDestinations = context.Union_Facilities.Select(n => new { n.id2, n.NAME, n.ADDRESS, n.CITY, n.STATE, n.ZIP, n.COUNTY, n.PHONE })
                                                .Where(nu => nu.NAME.Contains(searchDestination)).Take(20).AsEnumerable();
                    foreach (var destination in retrievedDestinations)
                    {
                        Destination hospitalDestination = new Destination()
                        {
                            Address         = destination.ADDRESS,
                            City            = destination.CITY,
                            County          = destination.COUNTY,
                            DestinationId   = destination.id2,
                            DestinationName = destination.NAME,
                            Phone           = destination.PHONE ?? string.Empty,
                            State           = destination.STATE,
                            Zip             = destination.ZIP
                        };
                        destinationList.Add(hospitalDestination);
                    }
                }
            }
            return(destinationList);
        }
示例#22
0
        /// <summary>
        /// Shows the callers names from the tblCallers table
        /// </summary>
        /// <param name="term"></param>
        /// <returns></returns>
        public JsonResult GetFilteredCallers(string term)
        {
            List <string>       callers = new List <string>();
            IQueryable <string> dbCallers;

            using (var context = new lifeflightapps())
            {
                dbCallers = context.tblCallers.Where(s => s.Active == true && (s.CallerLastName.Contains(term) || s.CallerFirstName.Contains(term))).Select(x => x.CallerLastName + " " + x.CallerFirstName);
                callers   = dbCallers.ToList();
            }

            return(Json(callers, JsonRequestBehavior.AllowGet));
        }
示例#23
0
        public IEnumerable <SelectListItem> GetSpecialNeeds()
        {
            IList <SelectListItem> SpecialNeeds = new List <SelectListItem>();

            using (lifeflightapps context = new lifeflightapps())
            {
                SpecialNeeds = context.tblSpecialNeeds.Select(s => new SelectListItem()
                {
                    Text  = s.SpecialNeed,
                    Value = s.SpecialNeedID.ToString()
                }).ToList();
            }
            return(SpecialNeeds);
        }
示例#24
0
        public IEnumerable <SelectListItem> GetStates()
        {
            string sst = (!string.IsNullOrEmpty(SelectedState)) ? SelectedState : "TN";

            using (var context = new lifeflightapps())
            {
                return(context.tblEmsAgencyLocals.Where(st => st.State != null).Select(s => new SelectListItem()
                {
                    Value = s.State,
                    Text = s.State,
                    Selected = (s.State == ((!string.IsNullOrEmpty(SelectedState)) ? SelectedState : "TN"))
                }).Distinct());
            }
        }
示例#25
0
        public ActionResult GetDestinationDetails(int DestinationId)
        {
            Destination destination = new Destination();

            using (var context = new lifeflightapps())
            {
                Union_Facilities facilities = new Union_Facilities();

                facilities = context.Union_Facilities.Find(DestinationId);

                destination = ConvertToDestination(facilities);
            }
            return(View(destination));
        }
示例#26
0
        // GET: Callers/Edit/5
        public ActionResult Edit(int id)
        {
            Caller    model    = new Caller();
            tblCaller dbcaller = new tblCaller();
            tblCallerPreferredNumber preferredNumber = new tblCallerPreferredNumber();

            using (var context = new lifeflightapps())
            {
                dbcaller        = context.tblCallers.Find(id);
                preferredNumber = context.tblCallerPreferredNumbers.Where(x => x.CallerId == id).OrderByDescending(x => x.CallerPreferredID).FirstOrDefault();
            }

            model = new Caller()
            {
                Active          = dbcaller.Active.HasValue?dbcaller.Active.Value:false,
                CallerFirstName = dbcaller.CallerFirstName,
                CallerLastName  = dbcaller.CallerLastName,
                CallerTitle     = dbcaller.CallerTitle,
                Assignment      = dbcaller.Assignment,
                OfficePhone     = dbcaller.OfficePhone,
                CallerPager     = dbcaller.CallerPager,
                MobilePhone     = dbcaller.MobilePhone,
                CallerEmail     = dbcaller.CallerEmail,
                CallerId        = dbcaller.ID
            };

            //    if (preferredNumber != null)
            //    {
            //        model.PreferredNumberType = preferredNumber.PreferredType;
            //        TempData["PreferredType"] = preferredNumber.PreferredType;
            //    }

            //    return View(model);
            //}
            model.PreferredNumberTypes = GetPreferredTypes();
            if (preferredNumber != null)
            {
                foreach (var item in model.PreferredNumberTypes)
                {
                    if (item.Value == preferredNumber.PreferredType)
                    {
                        item.Selected = true;
                        break;
                    }
                }
            }

            return(View(model));
        }
示例#27
0
        public IEnumerable <SelectListItem> GetStatuses()
        {
            IList <SelectListItem> statuses = new List <SelectListItem>();

            using (lifeflightapps context = new lifeflightapps())
            {
                var statusFromDb = context.tblRequestStatus.Select(e => new SelectListItem()
                {
                    Value = e.ReqStatusID.ToString(),
                    Text  = e.RequestStatus
                });
                statuses = statusFromDb.ToList();
            }
            return(statuses);
        }
示例#28
0
        public IEnumerable <SelectListItem> GetModesOfTransport()
        {
            IList <SelectListItem> modesOfTransport = new List <SelectListItem>();

            using (lifeflightapps context = new lifeflightapps())
            {
                var ems = context.tblTransportModes.Select(e => new SelectListItem()
                {
                    Value = e.TransportMode,
                    Text  = e.TransportMode
                });
                modesOfTransport = ems.ToList();
            }
            return(modesOfTransport);
        }
示例#29
0
        public IEnumerable <SelectListItem> GetDelayReasons()
        {
            IList <SelectListItem> delayReasons = new List <SelectListItem>();

            using (lifeflightapps context = new lifeflightapps())
            {
                var delayReasonsFromDb = context.tblDelayReasons.Select(e => new SelectListItem()
                {
                    Value = e.delayreasonID.ToString(),
                    Text  = e.delayreason
                });
                delayReasons = delayReasonsFromDb.ToList();
            }
            return(delayReasons);
        }
示例#30
0
        public IEnumerable <SelectListItem> GetComplaintTypes()
        {
            IList <SelectListItem> complaintTypes = new List <SelectListItem>();

            using (lifeflightapps context = new lifeflightapps())
            {
                var complaintTypesFromDb = context.tblDischargeComplaintTypes.Select(e => new SelectListItem()
                {
                    Value = e.ComplaintTypeID.ToString(),
                    Text  = e.ComplaintType
                });
                complaintTypes = complaintTypesFromDb.ToList();
            }
            return(complaintTypes);
        }