Esempio n. 1
0
 internal void RefreshSchema(System.Type objectType, string methodName, System.Type schemaType, bool preferSilent)
 {
     if (((objectType != null) && !string.IsNullOrEmpty(methodName)) && (schemaType != null))
     {
         try
         {
             TypeSchema schema = new TypeSchema(schemaType);
             this._forceSchemaRetrieval = true;
             DataTable[] tables = this.LoadSchema();
             this._forceSchemaRetrieval = false;
             IDataSourceSchema schema2 = (tables == null) ? null : new DataTableArraySchema(tables);
             this.SaveSchema(objectType, methodName, ConvertSchemaToDataTables(schema), schemaType);
             DataTable[]       tableArray2 = this.LoadSchema();
             IDataSourceSchema schema3     = (tableArray2 == null) ? null : new DataTableArraySchema(tableArray2);
             if (!DataSourceDesigner.SchemasEquivalent(schema2, schema3))
             {
                 this.OnSchemaRefreshed(EventArgs.Empty);
             }
         }
         catch (Exception exception)
         {
             if (!preferSilent)
             {
                 UIServiceHelper.ShowError(base.Component.Site, exception, System.Design.SR.GetString("ObjectDataSourceDesigner_CannotGetSchema", new object[] { schemaType.FullName }));
             }
         }
     }
 }
        private bool ConfigureDataSourceChangeCallback(object context)
        {
            IServiceProvider site    = base.Component.Site;
            IDataEnvironment service = (IDataEnvironment)site.GetService(typeof(IDataEnvironment));

            if (service == null)
            {
                return(false);
            }
            IDataSourceViewSchema schema = this.GetView("DefaultView").Schema;
            bool flag = false;

            if (schema == null)
            {
                this._forceSchemaRetrieval = true;
                schema = this.GetView("DefaultView").Schema;
                this._forceSchemaRetrieval = false;
                if (schema != null)
                {
                    flag = true;
                }
            }
            SqlDataSourceWizardForm form = this.CreateConfigureDataSourceWizardForm(site, service);

            if (UIServiceHelper.ShowDialog(site, form) != DialogResult.OK)
            {
                return(false);
            }
            this.OnComponentChanged(this, new ComponentChangedEventArgs(base.Component, null, null, null));
            IDataSourceViewSchema schema2 = null;

            try
            {
                this._forceSchemaRetrieval = true;
                schema2 = this.GetView("DefaultView").Schema;
            }
            finally
            {
                this._forceSchemaRetrieval = false;
            }
            if (!flag && !DataSourceDesigner.ViewSchemasEquivalent(schema, schema2))
            {
                this.OnSchemaRefreshed(EventArgs.Empty);
            }
            this.OnDataSourceChanged(EventArgs.Empty);
            return(true);
        }
 public ClubCloud_FunctieDataSourceViewDesigner(DataSourceDesigner owner, string viewName)
     : base(owner, viewName)
 {
 }
Esempio n. 4
0
 public ClubCloud_AddressDataSourceViewDesigner(DataSourceDesigner owner, string viewName)
     : base(owner, viewName)
 {
 }
 public override void RefreshSchema(bool preferSilent)
 {
     try
     {
         this.SuppressDataSourceEvents();
         bool             flag = false;
         IServiceProvider site = this.SqlDataSource.Site;
         if (!this.CanRefreshSchema)
         {
             if (!preferSilent)
             {
                 UIServiceHelper.ShowError(site, System.Design.SR.GetString("SqlDataSourceDesigner_RefreshSchemaRequiresSettings"));
             }
         }
         else
         {
             IDataSourceViewSchema schema = this.GetView("DefaultView").Schema;
             bool flag2 = false;
             if (schema == null)
             {
                 this._forceSchemaRetrieval = true;
                 schema = this.GetView("DefaultView").Schema;
                 this._forceSchemaRetrieval = false;
                 flag2 = true;
             }
             DesignerDataConnection connection = new DesignerDataConnection(string.Empty, this.ProviderName, this.ConnectionString);
             if (preferSilent)
             {
                 flag = this.RefreshSchema(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType, this.SqlDataSource.SelectParameters, true);
             }
             else
             {
                 Parameter[] parameterArray = this.InferParameterNames(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType);
                 if (parameterArray == null)
                 {
                     return;
                 }
                 ParameterCollection parameters  = new ParameterCollection();
                 ParameterCollection parameters2 = new ParameterCollection();
                 foreach (ICloneable cloneable in this.SqlDataSource.SelectParameters)
                 {
                     parameters2.Add((Parameter)cloneable.Clone());
                 }
                 foreach (Parameter parameter in parameterArray)
                 {
                     if ((parameter.Direction == ParameterDirection.Input) || (parameter.Direction == ParameterDirection.InputOutput))
                     {
                         Parameter parameter2 = parameters2[parameter.Name];
                         if (parameter2 != null)
                         {
                             parameter.DefaultValue = parameter2.DefaultValue;
                             if ((parameter.DbType == DbType.Object) && (parameter.Type == TypeCode.Empty))
                             {
                                 parameter.DbType = parameter2.DbType;
                                 parameter.Type   = parameter2.Type;
                             }
                             parameters2.Remove(parameter2);
                         }
                         parameters.Add(parameter);
                     }
                 }
                 if (parameters.Count > 0)
                 {
                     SqlDataSourceRefreshSchemaForm form = new SqlDataSourceRefreshSchemaForm(site, this, parameters);
                     flag = UIServiceHelper.ShowDialog(site, form) == DialogResult.OK;
                 }
                 else
                 {
                     flag = this.RefreshSchema(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType, parameters, false);
                 }
             }
             if (flag)
             {
                 IDataSourceViewSchema schema2 = this.GetView("DefaultView").Schema;
                 if (flag2 && DataSourceDesigner.ViewSchemasEquivalent(schema, schema2))
                 {
                     this.OnDataSourceChanged(EventArgs.Empty);
                 }
                 else if (!DataSourceDesigner.ViewSchemasEquivalent(schema, schema2))
                 {
                     this.OnSchemaRefreshed(EventArgs.Empty);
                 }
             }
         }
     }
     finally
     {
         this.ResumeDataSourceEvents();
     }
 }
 public ClubCloud_BaansoortDataSourceViewDesigner(DataSourceDesigner owner, string viewName)
     : base(owner, viewName)
 {
 }
 public ClubCloud_LidmaatschapDataSourceViewDesigner(DataSourceDesigner owner, string viewName)
     : base(owner, viewName)
 {
 }
 public ClubCloud_ReserveringDataSourceViewDesigner(DataSourceDesigner owner, string viewName)
     : base(owner, viewName)
 {
 }
 public ClubCloud_BestuursorgaanDataSourceViewDesigner(DataSourceDesigner owner, string viewName)
     : base(owner, viewName)
 {
 }
            private void RegisterData(WebReport webreport, Report report, IServiceProvider provider)
            {
                string[] dataSources = webreport.ReportDataSources.Split(new char[] { ';' });
                foreach (string dataSource in dataSources)
                {
                    IDataSource ds = FindControlRecursive(webreport.Page, dataSource) as IDataSource;
                    if (ds == null)
                    {
                        continue;
                    }
                    string dataName = (ds as Control).ID;

                    // at design time, use design time data view
                    if (provider != null)
                    {
                        if (ds is AccessDataSource)
                        {
                            // for MS Access data source, try to convert relative DataFile path.
                            // This is needed to avoid the exception when access the database in the design time.
                            AccessDataSource accessDs     = ds as AccessDataSource;
                            string           saveDataFile = accessDs.DataFile;
                            try
                            {
                                accessDs.DataFile = MapPath(provider, accessDs.DataFile);
                                webreport.RegisterDataAsp(report, accessDs, accessDs.ID);
                            }
                            finally
                            {
                                accessDs.DataFile = saveDataFile;
                            }
                        }
                        else
                        {
                            object[] attrs = ds.GetType().GetCustomAttributes(typeof(DesignerAttribute), false);
                            if (attrs != null && attrs.Length == 1)
                            {
                                DesignerAttribute  designerAttr = attrs[0] as DesignerAttribute;
                                DataSourceDesigner dsDesigner   = Activator.CreateInstance(Type.GetType(designerAttr.DesignerTypeName)) as DataSourceDesigner;

                                try
                                {
                                    dsDesigner.Initialize(ds as IComponent);
                                    dsDesigner.RefreshSchema(false);

                                    DesignerDataSourceView view = dsDesigner.GetView("");
                                    bool        isSampleData    = false;
                                    IEnumerable data            = view.GetDesignTimeData(10, out isSampleData);
                                    webreport.RegisterDataAsp(report, data, dataName);
                                }
                                finally
                                {
                                    dsDesigner.Dispose();
                                }
                            }
                        }
                    }
                    else
                    {
                        webreport.RegisterDataAsp(report, ds, dataName);
                    }
                }
            }
 public ClubCloud_GebruikerDataSourceViewDesigner(DataSourceDesigner owner, string viewName)
     : base(owner, viewName)
 {
 }