private void _form_StatusChange(object sender, StatusChangeEventArgs e) { IMap theMap = null; try { if (this._selectedErrors != null) { this.Extension.QAManager.ApplyNewStatusToErrors(this._selectedErrors, e.NewStatus); // Refresh the form view ErrorDisplay[] theDisplayErrors = new ErrorDisplay[this._selectedErrors.Length]; for (int i = 0; i < theDisplayErrors.Length; i++) { dao.QAError theError = this._selectedErrors[i]; theDisplayErrors[i] = new ErrorDisplay( theError.ObjectID, theError.Error.Status, theError.Error.ErrorType, theError.Error.CanDefer, theError.Error.CanExcept); } this._form.UpdateErrors(theDisplayErrors); // Detail view if (this._selectedErrors.Length == 1) this._form.SetDetailError(this._selectedErrors[0]); // Map view theMap = this.Extension.FocusMap; IActiveView theAV = (IActiveView)theMap; theAV.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, theAV.Extent); } } catch (dao.ErrorStorageException ese) { util.Logger.Write("ErrorStorageException caught changing the status of errors: " + Environment.NewLine + ese.Message + Environment.NewLine + ese.StackTrace); MessageBox.Show("Error occurred trying to open and write to the SUITT exceptions table. See log for more details", "Error Accessing SUITT Table", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { util.Logger.Write("Exception caught changing the status of errors: " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace); } finally { if (theMap != null) Marshal.ReleaseComObject(theMap); } }
public void UpdateErrors(ErrorDisplay[] updateList) { if (updateList == null || updateList.Length == 0) return; SortedList theIndex = new SortedList(updateList.Length); for (int i = 0; i < updateList.Length; i++) theIndex.Add(updateList[i].ID, updateList[i]); foreach (object theItemObj in this.lvErrors.Items) { ListViewItem theItem = (ListViewItem)theItemObj; if (theIndex.ContainsKey(theItem.Tag)) { ErrorDisplay theError = (ErrorDisplay)theIndex[theItem.Tag]; theItem.SubItems[0].Text = theError.ErrorType; theItem.SubItems[1].Text = theError.ID.ToString(); theItem.SubItems[2].Text = theError.Status; theItem.SubItems[3].Text = theError.CanDefer.ToString(); theItem.SubItems[4].Text = theError.CanExcept.ToString(); theIndex.Remove(theItem.Tag); } if (theIndex.Count == 0) break; } }
private void FilterErrors(string filter) { // Parse the filter string[] theClauses = null; if (filter != null) { theClauses = filter.Split(@" ".ToCharArray()); } QAManager theQAMan = this.Extension.QAManager; ArrayList theErrors = new ArrayList(); for (int i = 0; i < theQAMan.ErrorCount; i++) { dao.QAError theError = theQAMan.get_QAError(i); bool bPass = true; for (int j = 0; j < theClauses.Length; j++) { string theClause = theClauses[j].Trim().ToUpper(); if (theClause.Length == 0) { } else if (theClause.StartsWith("-")) { theClause = theClause.Substring(1); // Negative. bPass is false if found if (EvaluateFilter(theClause, theError) == true) bPass = false; } else { // Positive. bPass is false if not found if (EvaluateFilter(theClause, theError) == false) bPass = false; } if (bPass == false) break; } if (bPass) theErrors.Add(theError); } ErrorDisplay[] theDisplayErrors = new ErrorDisplay[theErrors.Count]; for (int i = 0; i < theDisplayErrors.Length; i++) { dao.QAError theError = (dao.QAError)theErrors[i]; theDisplayErrors[i] = new ErrorDisplay( theError.ObjectID, theError.Error.Status, theError.Error.ErrorType, theError.Error.CanDefer, theError.Error.CanExcept); } this._form.ErrorList = theDisplayErrors; }