protected override void SetParameters(IRadarParameters key, DataAdapterProperties dataadapterproperties) { if (dataadapterproperties.Name == EF_Counter.Name) { dataadapterproperties.Parameters["@p1"].Value = key[EF_Counter.Year]; dataadapterproperties.Parameters["@p2"].Value = key[EF_Counter.Type]; } else { dataadapterproperties.Parameters["@p2"].Value = key[EF_CounterValue.Code]; } }
private bool FindRecursiveDataAdapter(IRadarParameters key, DataAdapterProperties collection) { bool found = false; try { SetParameters(key, collection); // AddOn management if (myDocument.AddonList != null) { foreach (Addon scr in myDocument.AddonList) { scr.SetParameters(this, key, collection); } } found = collection.DataAdapter.Fill(Dataset, collection.Name) > 0; if (found) { foreach (DataRow row in Dataset.Tables[collection.Name].Rows) { OnPrepareAuxColumns(row); } } } catch (Exception exc) { MessageBox.Show(exc.Message, exc.StackTrace); } if (found) { foreach (DataAdapterProperties slavecollection in collection.SlaveDataAdapters) { FindRecursiveDataAdapter(key, slavecollection); } } return(found); }
public DBManager MasterTable <T>(bool createCommand = true) { System.Diagnostics.Debug.Assert(typeof(T).BaseType == typeof(Table)); var tableName = typeof(T).Tablename(); ForeignKey = typeof(T).GetField("ForeignKey").GetValue(null) as IColumn; masterDataAdapterProperties = new DataAdapterProperties(); var dCommand = CreateMasterCommand(); var dAdapter = CreateDataAdapter(tableName, dCommand); masterDataAdapterProperties.AddMaster(tableName, dAdapter, dCommand); AddMasterBinding(tableName); dAdapter.RowUpdated += dAdapter_MasterRowUpdated; masterDataAdapterProperties.HasToCreateCommand = createCommand; return(this); }
protected DBManager(IDocument document) { this.myDocument = document; globalPref = new PreferencesManager <GlobalPreferences>("", null).ReadPreference(); DBConnection = new SqlProxyConnection(GlobalInfo.DBaseInfo.dbManager.DB_ConnectionString); Dataset = new DataSet(document.GetType().Name) { Locale = System.Globalization.CultureInfo.InvariantCulture }; masterDataAdapterProperties = new DataAdapterProperties(); slaveBindingCollection = new BindingCollection(); try { if (DBConnection.State != ConnectionState.Open) { DBConnection.Open(); } } catch (SqlException exc) { MessageBox.Show(exc.Message); } }
private void UpdateRecursiveDataAdapter(DataSet dataSet, DataAdapterProperties collection) { try { SetDataAdapterTransaction(collection.DataAdapter); if (true) { CreateCommand(collection.DataAdapter); collection.HasToCreateCommand = false; } collection.DataAdapter.Update(dataSet, collection.Name); } catch (Exception exc) { MessageBox.Show(exc.Message, "UpdateRecursiveDataAdapter"); return; } foreach (DataAdapterProperties slavecollection in collection.SlaveDataAdapters) { UpdateRecursiveDataAdapter(dataSet, slavecollection); } }
public virtual void SetParameters(DBManager dbManager, IRadarParameters key, DataAdapterProperties collection) { }
protected override void SetParameters(IRadarParameters key, DataAdapterProperties dataadapterproperties) { dataadapterproperties.Parameters["@p1"].Value = key[EF_Users.Username]; }
protected abstract void SetParameters(IRadarParameters key, DataAdapterProperties collection);
protected override void SetParameters(IRadarParameters key, DataAdapterProperties collection) { collection.Parameters["@p1"].Value = key[CustomerTable.ID]; }