Ejemplo n.º 1
0
        public ActionResult UpsertCensus(CensusModel model)
        {
            var id         = model.id;
            var update     = true;
            var census     = context.Census.Find(id);
            var costCentre = context.CostCentres.Find(Settings.Default.RootCostCentre);

            if (census == null)
            {
                update             = false;
                census             = context.Census.Create();
                census.CompanyName = costCentre.Name;
                census.CostCentres = new[] { costCentre };
            }
            census.DisplayName      = model.displayName;
            census.StartDate        = model.startDate;
            census.EndDate          = model.endDate;
            census.EmployeesCovered = model.employeesCovered;
            census.TotalEmployees   = model.totalEmployees;
            census.SquareMeters     = model.squareMeters;
            census.ScopeBoundries   = model.scopeBoundries;

            if (!update)
            {
                census = context.Census.Add(census);
            }

            context.SaveChanges();

            return(Json(new { id = census.Id, sucess = true }, JsonRequestBehavior.DenyGet));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mrNumber"></param>
        /// <returns></returns>
        private GenServiceModel RetrieveDataFromGenServices(string mrNumber, string vunetId)
        {
            GenServiceModel gsm = new GenServiceModel();
            RetrieveCoverageAndInsurance coverageinfo = new RetrieveCoverageAndInsurance();
            RetrievePatientInformation   patientinfo  = new RetrievePatientInformation();
            RetrieveCensusInformation    censusinfo   = new RetrieveCensusInformation();
            CoverageInfo         coverages            = coverageinfo.GetCoverageAndInsurance(mrNumber, vunetId).Where(c => c.IsActive == true).FirstOrDefault();
            InsuranceInformation insurances           = coverageinfo.GetInsurances(mrNumber, vunetId).Where(i => i.EffectiveDate <= DateTime.Today && (i.TerminationDate >= DateTime.Today || i.TerminationDate == null)).FirstOrDefault();
            Patient     patient = patientinfo.GetPatient(mrNumber, vunetId);
            CensusModel census  = censusinfo.GetCensusRecords(mrNumber, vunetId).FirstOrDefault();

            gsm.PatientDemographics = patient;
            gsm.Coverages           = coverages;
            gsm.Insurances          = insurances;
            gsm.Census = census;

            return(gsm);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="census"></param>
        /// <returns></returns>
        private int CensusEntry(CensusModel census, string mrNumber)
        {
            int         censusId;
            tblMbrCensu tcensus;

            if (census != null)
            {
                tcensus = new tblMbrCensu()
                {
                    Bed           = census.Bed,
                    MrNumber      = mrNumber,
                    PavillionCode = census.PavillionCode,
                    Unit          = census.Unit,
                    CreatedDate   = DateTime.Now,
                    CreatedBy     = User.Identity.Name
                };
            }
            else
            {
                tcensus = new tblMbrCensu()
                {
                    Bed           = "N/A",
                    MrNumber      = mrNumber,
                    PavillionCode = "N/A",
                    Unit          = "N/A",
                    CreatedDate   = DateTime.Now,
                    CreatedBy     = User.Identity.Name
                };
            }

            using (var context = new lifeflightapps())
            {
                context.tblMbrCensus.Add(tcensus);
                context.SaveChanges();
                censusId = tcensus.MbrCensusID;
            }
            return(censusId);
        }