public bool Update <T>(List <WACParameter> parms, WACValidator.UpdateValidateDelegate <T> vDel) { bool result = false; T item = default(T); parms.Add(new WACParameter("modified_by", UserName)); parms.Add(new WACParameter("modified", DateTime.Now)); try { item = vDel(parms, (T)ListSource.GetCurrentItem()); ListSource.RemoveItemFromViewlist <T>(item); ((IWACDataProvider <T>)DataProvider).Update(item); ListSource.SetCurrentItem <T>(item, ((IWACDataProvider <T>)DataProvider).GetPrimaryKey); result = true; } catch (WACEX_ValidationException wex) { WACAlert.Show("Update failed, validation error: " + wex.ErrorText + " In " + this.ToString() + ".Update", 0); } catch (WACEX_GeneralDatabaseException gex) { WACAlert.Show("Update failed: " + gex.ErrorText + " In " + this.ToString() + ".Update", gex.ErrorCode); } catch (Exception ex) { WACAlert.Show("Update failed: " + ex.Message + " In " + this.ToString() + ".Update", 0); } return(result); }
public virtual void OpenFormViewUpdate(WACFormControl form, List <WACParameter> parms) { if (UserAuthorized("Update", AuthorizationArea)) { FormView fv = WACGlobal_Methods.FindControl <FormView>(form); checkDependencies(fv, parms, DataProvider, ListSource); fv.ChangeMode(FormViewMode.Edit); BindFormView(fv, parms, DataProvider.GetItem); BindControlDDLs(fv, parms, ListSource.GetCurrentItem()); form.CurrentState = WACFormControl.FormState.OpenUpdate; InitControls(form, parms); ShowModal(form, true); ContentStateChanged(form); } }