private int _startRow = 10; // excel row 11 #endregion Fields #region Constructors public Subreach_Excel(Matrix_Worksheet matrixWS,int number,int inputCol,int outputCol,int startRow) : base(number) { Number = number; _matrixWorksheet = matrixWS; _inputColumn = inputCol; _outputColumn = outputCol; _startRow = startRow; _nDays = GetNumberOfDays(); }
public bool ProcessAll() { DateTime start = DateTime.Now; HydroSharedAddIn.TransitLoss2 tl2 = new HydroSharedAddIn.TransitLoss2(); tl2.DoLock(true); _inputParameterArrays.Clear(); Status.log(Globals.ThisWorkbook.Name + " begin simulation."); List<string> wsNames = hydroLib.ExcelHelper.GetWorksheetNames(); foreach (string wrkSheetName in wsNames) { string lowername = wrkSheetName.ToLower(); if (lowername.IndexOf(" matrix") > 0 || lowername.IndexOf("total flow") == 0 || lowername.IndexOf("native flow") == 0 ) { try { Worksheet excelWS = hydroLib.ExcelHelper.GetWorksheet(wrkSheetName); Matrix_Worksheet matrixWS = new Matrix_Worksheet(this, excelWS); if (!matrixWS.Process()) { StringCollection sc = Status.getInfo(); foreach (string info in sc) { Status.log(info); } tl2.DoLock(false); return false; } } catch (Exception e) { Status.log("Error: Exception thrown"); Status.log(e.ToString()); StringCollection sc = Status.getInfo(); foreach (string info in sc) { Status.log(info); } tl2.DoLock(false); return false; } } } TimeSpan ts = DateTime.Now - start; Status.log(Globals.ThisWorkbook.Name + " simulations completed in " + ts.Seconds.ToString() + " secs."); Status.setBigMatrixStatus(Globals.ThisWorkbook.Name, "successfully completed all simulations."); hydroLib.ExcelHelper.flush(); tl2.DoLock(false); Globals.ThisWorkbook.Application.CalculateFull(); return true; }