コード例 #1
0
 public override void Run(object interactionHandler, DataRow row, DataObjectStore store)
 {
     if (this.dataObject == null)
     {
         if (this.creator != null)
         {
             this.dataObject = this.creator.Create(this.table);
             return;
         }
         ConstructorInfo constructor = this.type.GetConstructor(new Type[0]);
         if (null != constructor)
         {
             this.dataObject = constructor.Invoke(new object[0]);
             return;
         }
     }
     else
     {
         if (store.GetDataObject(this.dataObjectName) != null)
         {
             this.dataObject = store.GetDataObject(this.dataObjectName);
         }
         IConfigurable configurable = this.DataObject as IConfigurable;
         if (configurable != null)
         {
             try
             {
                 configurable.ResetChangeTracking();
             }
             catch (NotImplementedException)
             {
             }
         }
     }
 }
コード例 #2
0
        private void bindingSource_ListChanged(object sender, ListChangedEventArgs e)
        {
            BindingSource bindingSource = (BindingSource)sender;
            IVersionable  versionable   = bindingSource.DataSource as IVersionable;

            if (versionable != null)
            {
                if (!this.datasourceVersions.ContainsKey(bindingSource))
                {
                    this.datasourceVersions[bindingSource] = versionable.ExchangeVersion;
                    this.DisableControlsByVersion(bindingSource, versionable);
                    return;
                }
                ExchangeObjectVersion exchangeObjectVersion = this.datasourceVersions[bindingSource];
                if (!exchangeObjectVersion.IsSameVersion(versionable.ExchangeVersion))
                {
                    this.datasourceVersions[bindingSource] = versionable.ExchangeVersion;
                    this.EnableControlsByVersion(bindingSource, versionable);
                    return;
                }
            }
            else
            {
                DataTable dataTable = bindingSource.DataSource as DataTable;
                if (dataTable != null)
                {
                    DataObjectStore dataObjectStore = dataTable.ExtendedProperties["DataSourceStore"] as DataObjectStore;
                    if (dataObjectStore != null)
                    {
                        foreach (string text in dataObjectStore.GetKeys())
                        {
                            IVersionable versionable2 = dataObjectStore.GetDataObject(text) as IVersionable;
                            if (versionable2 != null)
                            {
                                if (this.dataSourceInTableVersions.ContainsKey(text))
                                {
                                    ExchangeObjectVersion exchangeObjectVersion2 = this.dataSourceInTableVersions[text];
                                    if (!exchangeObjectVersion2.IsSameVersion(versionable2.ExchangeVersion))
                                    {
                                        this.dataSourceInTableVersions[text] = versionable2.ExchangeVersion;
                                        this.EnableControlsByVersion(bindingSource, versionable2);
                                    }
                                }
                                else
                                {
                                    this.dataSourceInTableVersions[text] = versionable2.ExchangeVersion;
                                    this.DisableControlsByVersion(bindingSource, versionable2);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
 public override void BuildParameters(DataRow row, DataObjectStore store, IList <ParameterProfile> paramInfos)
 {
     if (!string.IsNullOrEmpty(this.CommandTextLambdaExpression))
     {
         this.DataHandler.CommandText = (string)ExpressionCalculator.CalculateLambdaExpression(ExpressionCalculator.BuildColumnExpression(this.CommandTextLambdaExpression), typeof(string), row, null);
     }
     this.DataHandler.Parameters.Clear();
     if (!string.IsNullOrEmpty(this.DataObjectName))
     {
         this.DataHandler.Parameters.AddWithValue("Instance", store.GetDataObject(this.DataObjectName));
     }
     else
     {
         this.DataHandler.KeepInstanceParamerter = true;
     }
     MonadSaveTask.BuildParametersCore(row, paramInfos, this.DataHandler.Parameters);
     this.workUnitDescription = MonadSaveTask.BuildParametersDescription(row, paramInfos);
     this.DataHandler.ClearParameterNames();
     this.DataHandler.SpecifyParameterNames(store.GetModifiedPropertiesBasedOnDataObject(row, this.DataObjectName));
 }