public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ViewBag.Title = "Edit Contract";
            facility_contract facility_contract = _facilityContractService.GetDetails(id.Value);

            ViewBag.ServiceTypes = _uCLService.GetUclData(UclTypes.ServiceType)
                                   .Select(m => new { Key = m.ucd_key, Value = m.ucd_title })
                                   .ToDictionary(m => m.Key.ToString(), m => m.Value);
            ViewBag.CoverageTypes = _uCLService.GetUclData(UclTypes.CoverageType)
                                    .Select(m => new { Key = m.ucd_key, Value = m.ucd_title })
                                    .ToDictionary(m => m.Key.ToString(), m => m.Value);
            if (facility_contract == null)
            {
                var contractType = _uCLService.GetDefault(UclTypes.ContractType);
                var serviceType  = _uCLService.GetDefault(UclTypes.ServiceType);
                var coverageType = _uCLService.GetDefault(UclTypes.CoverageType);
                return(PartialView(new facility_contract
                {
                    fct_is_active = true,
                    fct_key = id.Value,
                    fct_cvr_key = coverageType != null ? coverageType.ucd_key : 0,
                    fct_selected_services = string.Join(",", facility_contract.facility_contract_service.Select(m => m.fcs_srv_key))
                }));
            }
            else
            {
                facility_contract.fct_selected_services = string.Join(",", facility_contract.facility_contract_service.Select(m => m.fcs_srv_key));
            }
            return(PartialView("_Form", facility_contract));
        }
예제 #2
0
        public ActionResult GenerateDoc(PreLiveVM model)
        {
            _facilityQuestionnaireService.SaveChanges(model, loggedInUser.Id, loggedInUser.FullName);

            var path     = Server.MapPath("~/Documents");
            var fileName = Guid.NewGuid() + ".docx";

            path = path + "\\" + fileName;
            model.contactList = _facilityQuestionnaireService.GetContacts(model.FacilityKey);

            model.facilityModel = _facilityService.GetDetails(model.FacilityKey);
            if (model.facilityModel.fac_stt_key.HasValue)
            {
                model.facilityState = _uclService.GetDetails(model.facilityModel.fac_stt_key.Value);
            }

            if (model.facilityModel.fac_ucd_key_system.HasValue)
            {
                model.facilityHealthSystem = _uclService.GetDetails(model.facilityModel.fac_ucd_key_system.Value);
            }

            if (model.facilityModel.fac_ucd_bed_size.HasValue)
            {
                model.bedSizeUCL = _uclService.GetDetails(model.facilityModel.fac_ucd_bed_size.Value);
            }

            model.faclityContract = _facilityContractService.GetDetails(model.FacilityKey);
            var html = RenderPartialViewToString("_PrevLivePreview", model);

            BLL.Helpers.Functions.GenerateDocument(html, path);
            return(Json(new { fileName = fileName }, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        private facility_contract GetFacilityContract(string fac_key = "")
        {
            ViewBag.ServiceTypes = _uCLService.GetUclData(UclTypes.ServiceType)
                                   .Select(m => new { Key = m.ucd_key, Value = m.ucd_title })
                                   .ToDictionary(m => m.Key.ToString(), m => m.Value);
            ViewBag.CoverageTypes = _uCLService.GetUclData(UclTypes.CoverageType)
                                    .Select(m => new { Key = m.ucd_key, Value = m.ucd_title })
                                    .ToDictionary(m => m.Key.ToString(), m => m.Value);

            facility_contract facilityContract = null;

            if (!string.IsNullOrEmpty(fac_key))
            {
                facilityContract = _facilityContractService.GetDetails(new Guid(fac_key));
            }

            if (facilityContract != null)
            {
                facilityContract.fct_selected_services = string.Join(",", facilityContract.facility_contract_service.Select(m => m.fcs_srv_key));
            }
            else
            {
                facilityContract = new facility_contract {
                    fct_is_active = true
                };

                var serviceType  = _uCLService.GetDefault(UclTypes.ServiceType);
                var coverageType = _uCLService.GetDefault(UclTypes.CoverageType);
                if (coverageType != null)
                {
                    facilityContract.fct_cvr_key = coverageType.ucd_key;
                }

                //This is for default selection of servicetype checkbox
                facilityContract.fct_selected_services = serviceType.ucd_key.ToString();
            }


            return(facilityContract);
        }