private void btnAdd_Click(object sender, EventArgs e) { if (ValidationUtility.FieldNotAllowNull(this) == false) { return; } Model.CurrencyUnit cu = new Model.CurrencyUnit(); CoverObjectUtility.GetAutoBindingData(this, cu); try { using (Interface.IUnitOfWork uow = new UnitOfWork()) { uow.CurrencyUnitRepository.Add(cu); uow.Commit(); } } catch { labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed); return; } if (insertCurrency != null) { insertCurrency(cu, Utility.CRUD.Insert); } Close(); }
private void InsertOrUpdate(Model.CurrencyUnit cu, Utility.CRUD cru) { if (cru == Utility.CRUD.Insert) { utility.AddNewRow(cu); } else { utility.UpdateRow(cu); } gridView4.RefreshData(); }