public IActionResult Index(BirthModel model) { var birth = model.birthday.Trim(); var year = birth.Substring(0, 4); var month = birth.Substring(4, 2); var day = birth.Substring(6, 2); var newtime = year + "-" + month + "-" + day; DateTime borntime = DateTime.MinValue; var borndate = DateTime.TryParse(newtime, out borntime); if (borndate) { var result = FgFuncAge.GetAge(birth, false); ViewData["result"] = result; } else { ViewData["result"] = "请传入正确的时间"; } return(View()); }
public void InitModel() { // initialize all the model components and update the status message in de modelinterface class for notification purposes if (modelDefinition != null) { modelInterface.StatusMessage = $"Initializing model components."; modelInterface.StatusMessage = $"Initializing blood compartments."; foreach (BloodCompartment bloodComp in modelDefinition.blood_compartments) { bloodComp.InitBloodCompartment(this); } modelInterface.StatusMessage = $"Initializing blood compartment connectors."; foreach (BloodConnector bloodCon in modelDefinition.blood_connectors) { bloodCon.InitBloodConnector(this); } modelInterface.StatusMessage = $"Initializing valves."; foreach (Valve valve in modelDefinition.valves) { valve.InitValve(this); } modelInterface.StatusMessage = $"Initializing shunts."; foreach (Shunt shunt in modelDefinition.shunts) { shunt.InitShunt(this); } modelInterface.StatusMessage = $"Initializing gas compartments."; foreach (GasCompartment gasComp in modelDefinition.gas_compartments) { gasComp.InitGasCompartment(this); } modelInterface.StatusMessage = $"Initializing gas compartment connectors."; foreach (GasConnector gasCon in modelDefinition.gas_connectors) { gasCon.InitGasConnector(this); } modelInterface.StatusMessage = $"Initializing gasexchangers."; foreach (GasExchanger gasExchanger in modelDefinition.exchangers) { gasExchanger.InitializeExchanger(this); } modelInterface.StatusMessage = $"Initializing diffusors."; foreach (Diffusor diffusor in modelDefinition.diffusors) { diffusor.InitializeDiffusor(this); } modelInterface.StatusMessage = $"Initializing containers."; foreach (Container container in modelDefinition.containers) { container.InitContainer(this); } modelInterface.StatusMessage = $"Initializing submodels."; // instantiate the ecg model ecg = new ECGModel(this); // instantiate the acidbase model acidbase = new AcidBaseModel(); // instantiate the oxygenation model oxy = new OxygenationModel(); // instantiate the autonomic nervous system model ans = new AutonomicNervousSystemModel(this); // instantiate the spontaneous breathing model breathing = new SpontaneousBreathingModel(this); // instantiate the contraction model of the heart contraction = new ContractionModel(this); // instantiate the mechanical ventilator model ventilator = new MechanicalVentilatorModel(this); // instantiate the av-interaction model avinteraction = new AVInteractionModel(this); // instantiate the global hypoxia model hypoxia = new GlobalHypoxiaModel(this); // instantiate the birth model birth = new BirthModel(this); // instantiate the brain model brain = new BrainModel(this); // instantiate the drug model drugs = new DrugModel(this); // instantiate the kidney model kidneys = new KidneyModel(this); // instantiate the liver model liver = new LiverModel(this); // instantiate the maternal placenta model maternalPlacenta = new MaternalPlacentaModel(this); // instantiate the ecmo model ecmo = new ECMOModel(this); // instantiate the compressions model compressions = new CompressionModel(this); // instantiate the datacollector dataCollector = new DataCollector(this); } else { modelInterface.StatusMessage = $"Failed to initialize the model.{Environment.NewLine}"; } }