private void SampleGroups_TDVGridView_SelectionChanging(object sender, FMSC.Controls.SelectionChangingEventArgs e) { try { SampleGroupDO sg = this.SampleGroupBindingSource.Current as SampleGroupDO; TreeDefaultValueDO tdv = e.Item as TreeDefaultValueDO; if (e.IsRemoving == false) { return; } // we don't care if they are adding if (sg == null || tdv == null) { e.Cancel = true; return; } if (!ViewPresenter.CanRemoveTreeDefault(sg, tdv)) { throw new UserFacingException("Can't remove this species because it has tree data or tree counts.", null); } } catch (Exception ex) { this.ExceptionHandler.Handel(ex); e.Cancel = true; } }
private void Strata_CuttingUnitsGridView_SelectionChanging(object sender, FMSC.Controls.SelectionChangingEventArgs e) { try { //stratum is being removed from cutting unit StratumDO st = this.StrataBindingSource.Current as StratumDO; if (e.IsRemoving == false) { return; } // we don't care if they are adding if (st == null) { e.Cancel = true; return; } //see if that stratum can be edited if (!ViewPresenter.CanEditStratumField(st, null)) { throw new UserFacingException("Stratum Can Not Be Removed", null); } } catch (Exception ex) { this.ExceptionHandler.Handel(ex); e.Cancel = true; } }