/// <summary> /// Gets the result. /// </summary> /// <returns></returns> public ResultsMessures GetResult() { var results = new ResultsMessures(); try { results.DentalBoneDiscrepancy = DentalBoneDiscrepancyCalculator.GetResult(mouthMessure, theethMessure); results.Tanaka = TanakaCalculator.GetResult(theethMessure); results.Moyers = MoyersCalculator.GetResult(mouthMessure, theethMessure); results.Pont = PontCalculator.GetResult(theethMessure); results.BoltonTotal = BoltonCalculator.GetBoltonTotalResult(theethMessure); results.BoltonPreviousRelation = BoltonCalculator.GetBoltonPreviousResult(theethMessure); } catch (Exception ex) { throw new CalculationCustomException("Error en calculos.", ex); } return(results); }
public Result(MessuresViewModel messureViewModule) { this.mouseMessures = messureViewModule.mouseModel; this.theetMessure = messureViewModule.roothModel; this.patientInformation = messureViewModule.patientModel; result = new MessuresResultsProvider(mouseMessures, theetMessure).GetResult(); InitializeComponent(); SetValues(result); }
/// <summary> /// Sets the values. /// </summary> /// <param name="results">The results.</param> private void SetValues(ResultsMessures results) { // Bolton this.Bolton.DataContext = new BoltonViewModel(results.BoltonTotal, results.BoltonPreviousRelation); // Tanaka this.Tanaka.DataContext = new TanakaViewModel(results.Tanaka); //Pont this.Pont.DataContext = new PontViewModel(results.Pont); // Disc this.Discrepancy.DataContext = new DentalBoneDiscrepancyViewModel(results.DentalBoneDiscrepancy); // Moyers this.Moyers.DataContext = new MoyersViewModel(results.Moyers); }
public static void Export(RoothCalculationEntity roothCalculation, MouthCalculationEntity mouthCalculation, PatientInformation patientInformation, ResultsMessures result, string filePath) { InitializeCultures(); var excelTemplate = Resources.FilesResources.HaenggiCalculationResult; CopyStream(excelTemplate, filePath); wapp = new Application(); try { wbook = wapp.Workbooks.Open(filePath, true, true, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); var fileNameSubstr = filePath.LastIndexOf("\\") + 1; wbook.Title = filePath.Substring(fileNameSubstr, filePath.LastIndexOf(".") - fileNameSubstr); SetDataIntoSheetMessure(wbook.Worksheets.get_Item(1), roothCalculation, mouthCalculation, patientInformation); SetDataIntoSheetResult(wbook.Worksheets.get_Item(2), result); wbook.SaveCopyAs(filePath); wbook.Close(false); } catch (Exception) { wbook.Close(false); throw new Exception("Error al intentar exportar el resultado."); } finally { wapp.Workbooks.Close(); wapp.Quit(); } }
public static Stream Export(ResultsMessures result, PatientInformation patientInformation, string fileName) { InitializeCultures(); results = result; patientInfo = patientInformation; using (var doc = new Document(PageSize.A4)) { MemoryStream pdfStream = new MemoryStream(); using (var writer = PdfWriter.GetInstance(doc, new FileStream(fileName, FileMode.Create))) { doc.Open(); doc.AddCreationDate(); doc.AddTitle(Properties.Resources.PdfTitle); doc.AddAuthor(Properties.Resources.PdfAuthor); doc.SetMargins(10, 10, (float)1.5, (float)1.5); SetTitle(doc); SetPatientData(doc); SetDentalBoneDiscrepancy(doc); SetMoyers(doc); SetTanaka(doc); SetBolton(doc); SetPont(doc); doc.Close(); return(pdfStream); } } }
/// <summary> /// Sets the data into sheet result. /// </summary> /// <param name="sheet">The sheet.</param> /// <param name="result">The result.</param> private static void SetDataIntoSheetResult(Worksheet sheet, ResultsMessures result) { // DentalBoneDiscrepancy sheet.get_Range("G4", "G4").Value2 = result.DentalBoneDiscrepancy.Superior.ResultToString(); sheet.get_Range("G5", "G5").Value2 = result.DentalBoneDiscrepancy.Inferior.ResultToString(); sheet.get_Range("G6", "G6").Value2 = result.DentalBoneDiscrepancy.SuperiorAntero.ResultToString(); sheet.get_Range("G7", "G7").Value2 = result.DentalBoneDiscrepancy.InferiorAntero.ResultToString(); sheet.get_Range("G8", "G8").Value2 = result.DentalBoneDiscrepancy.InferiorIncisives.ResultToString(); // Moyers sheet.get_Range("K4", "K4").Value2 = result.Moyers.RightSuperior.ResultToString(); sheet.get_Range("K5", "K5").Value2 = result.Moyers.RightInferior.ResultToString(); sheet.get_Range("L4", "L4").Value2 = result.Moyers.LeftSuperior.ResultToString(); sheet.get_Range("L5", "L5").Value2 = result.Moyers.LeftInferior.ResultToString(); // Pont sheet.get_Range("C13", "C13").Value2 = result.Pont.Pont14To24.ResultToString(); sheet.get_Range("D13", "D13").Value2 = result.Pont.Pont16To26.ResultToString(); sheet.get_Range("E13", "E13").Value2 = result.Pont.ArchLong.ResultToString(); // Tanaka sheet.get_Range("C8", "C8").Value2 = result.Tanaka.Superior.ResultToString(); sheet.get_Range("D8", "D8").Value2 = result.Tanaka.Inferior.ResultToString(); // Bolton // Labels sheet.get_Range("C4", "C4").Value2 = GetBoltonExcessLabel(result.BoltonTotal.IsSuperiorExcess); sheet.get_Range("C5", "C5").Value2 = GetBoltonExcessLabel(result.BoltonPreviousRelation.IsSuperiorExcess); // Values sheet.get_Range("D4", "D4").Value2 = result.BoltonPreviousRelation.IsSuperiorExcess ? result.BoltonTotal.SuperiorExcess.ResultToString() : result.BoltonTotal.InferiorExcess.ResultToString(); sheet.get_Range("D5", "D5").Value2 = result.BoltonPreviousRelation.IsSuperiorExcess ? result.BoltonPreviousRelation.SuperiorExcess.ResultToString() : result.BoltonPreviousRelation.InferiorExcess.ResultToString(); }