/// <summary> /// Saves the input back into the dataset. </summary> /// <returns> true if the data was saved successfuly. False if not. </returns> private bool saveData() { string routine = "StateMod_Well_ReturnFlow_JFrame.saveData"; if (!__worksheet.stopEditing()) { // don't save if there are errors. Message.printWarning(1, routine, "There are errors in the data " + "that must be corrected before data can be saved.", this); return(false); } if (checkInput() > 0) { return(false); } // now only save data if any are different. bool needToSave = false; // if the Vectors are differently-sized, they're different System.Collections.IList wv = __worksheet.getAllData(); // w for worksheet System.Collections.IList lv = __currentWell.getReturnFlows(); // l for welL needToSave = !(StateMod_ReturnFlow.Equals(wv, lv)); Message.printStatus(1, routine, "Saving? .........[" + needToSave + "]"); if (!needToSave) { // there's nothing different -- users may even have deleted // some rights and added back in identical values return(true); } // clone the objects from the worksheet vector and assign them // to the well object as its new return flows. int size = wv.Count; System.Collections.IList clone = new List <object>(); StateMod_ReturnFlow rf; StateMod_ReturnFlow crf = null; for (int i = 0; i < size; i++) { rf = (StateMod_ReturnFlow)wv[i]; crf = (StateMod_ReturnFlow)rf.clone(); crf.setCrtnid(StringUtil.getToken(rf.getCrtnid(), " ", StringUtil.DELIM_SKIP_BLANKS, 0)); crf._isClone = false; clone.Add(crf); } __currentWell.setReturnFlows(clone); __dataset.setDirty(StateMod_DataSet.COMP_WELL_STATIONS, true); return(true); }