/// <summary> /// Service callable code to Delete/Insert/Update Grid Filters /// </summary> /// <param name="ds">A DataSet of type GridFiltersCD</param> /// <returns>A GridFiltersCD. If ALL updated OK contains updated data, if not contains the RowErrors</returns> public static GridFiltersCD UpdateGridFilters(DataSet ds) { if (ds == null || ds.Tables["GridFilters"] == null) { throw new Exception("The DataSet and/or DataTable is null."); } var clientDataSet = new GridFiltersCD(); clientDataSet.Merge(ds, false, MissingSchemaAction.Ignore); #region Update GridFilters if (clientDataSet.GridFilters.Select("", "", DataViewRowState.Added).Length > 0) { var gridFiltersTD = new GridFiltersTD(); gridFiltersTD.GridFilters.BeginLoadData(); gridFiltersTD.GridFilters.Merge(clientDataSet.GridFilters, false, MissingSchemaAction.Ignore); using (var ts = new TransactionScope(TransactionScopeOption.Required)) { GridFiltersTD.UpdateGridFilters(gridFiltersTD); ts.Complete(); } } #endregion return(clientDataSet); }
/// <summary> /// Get all GridFilters /// </summary> /// <returns>A GridFiltersTD</returns> public static DataSet GetGridFilters() { using (new TransactionScope(TransactionScopeOption.Suppress)) { var ds = new GridFiltersTD(); var ta = new GridFiltersTDTableAdapters.GridFiltersTableAdapter(); ta.Fill(ds.GridFilters); return(ds); } }