private void DeleteItem() { try { if (shtItemView.Rows.Count == 0) { return; } if (shtItemView.ActiveRowIndex < 0) { return; } NZString ItemCD = new NZString(null, shtItemView.Cells[shtItemView.ActiveRowIndex, (int)eColView.ITEM_CD].Text); ItemValidator validator = new ItemValidator(); ErrorItem errorItem = validator.ValidateBeforeDelete(ItemCD); if (errorItem != null) { ValidateException.ThrowErrorItem(errorItem); } errorItem = validator.CheckExistsTransactionByItem(ItemCD); if (errorItem != null) { MessageDialog.ShowBusiness(this, errorItem.Message); } MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new EVOFramework.Message(SystemMaintenance.Messages.eConfirm.CFM9002.ToString()).MessageDescription); switch (dr) { case MessageDialogResult.Cancel: return; case MessageDialogResult.No: return; case MessageDialogResult.Yes: break; } ItemController ctlItem = new ItemController(); ctlItem.DeleteItem(ItemCD); shtItemView.RemoveRows(shtItemView.ActiveRowIndex, 1); } catch (ValidateException err) { MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message); err.ErrorResults[0].FocusOnControl(); } }