Ejemplo n.º 1
0
 private void ProcessReportSolution(reportSolution rSol)
 {
     // create document
     Document doc = new Document(rSol.reportParameters.name, rSol.reportParameters.description, rSol.reportParameters.author, DateTime.Now, null);
     // load analysis
     CasePalletAnalysis analysis = LoadPalletAnalysis(doc, rSol.solutionRef.analysisId);
     if (null == analysis)
         return;
     // compute solutions
     TreeDim.StackBuilder.Engine.CasePalletSolver solver = new TreeDim.StackBuilder.Engine.CasePalletSolver();
     solver.ProcessAnalysis(analysis);
     // retrieve wanted solution
     List<Basics.CasePalletSolution> solutions = analysis.Solutions;
     if (rSol.solutionRef.index >= solutions.Count)
         throw new Exception(string.Format("Analysis {0} has no solution with index {1}", analysis.Name, rSol.solutionRef.index));
     Basics.CasePalletSolution sol = solutions[(int)rSol.solutionRef.index];
     // selected solution
     SelCasePalletSolution selSolution = new SelCasePalletSolution(doc, analysis, sol);
     // generate report
     ReporterMSWord reporter = new ReporterMSWord(new ReportData(analysis, selSolution)
         , rSol.reportParameters.templateFilePath, rSol.reportParameters.outputPath, new Margins());
 }
 public static bool LoadFromFile(string fileName, out reportSolution obj)
 {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 public static bool Deserialize(string xml, out reportSolution obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an reportSolution object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output reportSolution object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out reportSolution obj, out System.Exception exception)
 {
     exception = null;
     obj = default(reportSolution);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 /// <summary>
 /// Deserializes workflow markup into an reportSolution object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output reportSolution object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out reportSolution obj, out System.Exception exception)
 {
     exception = null;
     obj = default(reportSolution);
     try
     {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }