示例#1
0
 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];
     }
 }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
            }
        }
示例#5
0
        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);
            }
        }
示例#6
0
 public virtual void SetParameters(DBManager dbManager, IRadarParameters key, DataAdapterProperties collection)
 {
 }
示例#7
0
 protected override void SetParameters(IRadarParameters key, DataAdapterProperties dataadapterproperties)
 {
     dataadapterproperties.Parameters["@p1"].Value = key[EF_Users.Username];
 }
示例#8
0
 protected abstract void SetParameters(IRadarParameters key, DataAdapterProperties collection);
示例#9
0
 protected override void SetParameters(IRadarParameters key, DataAdapterProperties collection)
 {
     collection.Parameters["@p1"].Value = key[CustomerTable.ID];
 }