Example #1
0
        public static ICustomObject CreateInstance(AccessApp app, object daoObject, AccessIO.ObjectType objectType)
        {
            string typeName = String.Concat(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, ".", objectType.ToString());
            Type   t        = Type.GetType(typeName);

            return(Activator.CreateInstance(t, daoObject) as ICustomObject);
        }
Example #2
0
        /// <summary>
        /// Enumerate the allowed object types and, for each, the list of objects for that type
        /// </summary>
        /// <param name="app">Access application</param>
        /// <exception cref="ArgumentNullException"> if <paramref name="app"/> is null</exception>
        private void FillObjectTree(AccessIO.AccessApp app)
        {
            //TODO: Do the work in background
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }

            const string key = "db";

            Images                = new TreeImages(AccessApp.ContainersFactory(fileName));
            tree.ImageList        = Images.ImageList;
            tree.ImageKey         = key;
            tree.SelectedImageKey = key;

            tree.Nodes.Clear();
            TreeNode root = tree.Nodes.Add(Path.GetFileName(app.FileName));

            root.ToolTipText = app.FileName;
            foreach (ContainerNames container in app.AllowedContainers)
            {
                TreeNode subItem = root.Nodes.Add(container.DisplayPluralName);
                subItem.ImageKey         = container.DefaultExtension.ToString();
                subItem.SelectedImageKey = container.DefaultExtension.ToString();
                foreach (IObjecOptions item in app.LoadObjectNames(container.InvariantName))
                {
                    TreeNode node = new TreeNode(item.Name);
                    node.Tag              = item;
                    node.ImageKey         = app.AllowedContainers.Find(item.ObjectType).FileExtension.ToString();
                    node.SelectedImageKey = node.ImageKey;
                    subItem.Nodes.Add(node);
                }
            }
        }
Example #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="app">AccessScrCtrl application</param>
 /// <param name="name">Name of the object name</param>
 /// <param name="objectType">Access object type</param>
 public Table(AccessApp app, string name, ObjectType objectType) : base(app, name, objectType)
 {
     //TODO: Ver posibilidad de no instanciar tableDef hasta el método Load (habría que cambiar el método Save)
     dao.Database db = app.Application.CurrentDb();
     if (ExistsTableDef(db, name.ToString()))
     {
         tableDef = app.Application.CurrentDb().TableDefs[name];
     }
     else
     {
         tableDef = null;
     }
     TableName = name;
     Fields    = new List <Field>();
 }
Example #4
0
        /// <summary>
        /// Create a inherited object instance
        /// </summary>
        /// <param name="objectType">Access object type</param>
        /// <param name="name">Object's name</param>
        public static AccessObject CreateInstance(AccessApp app, ObjectType objectType, string name)
        {
            AccessObject newObject;

            if (IsStandardContainerName(objectType.ToString()))
            {
                newObject = new StandardObject(app, name, objectType);
            }
            else
            {
                if (IsStandardObjectType(objectType))
                {
                    newObject = new StandardObject(app, name, objectType);
                }
                else
                {
                    string typeName = String.Concat(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, ".", objectType.ToString());
                    Type   t        = Type.GetType(typeName);
                    newObject = (AccessObject)Activator.CreateInstance(t, app, name, objectType);
                }
            }
            return(newObject);
        }
Example #5
0
        public static AccessApp AccessAppFactory(string fileName)
        {
            AccessApp app = null;

            switch (Path.GetExtension(fileName).ToUpperInvariant())
            {
            case ".MDE":
            case ".MDB":
                app = new AccessMdb(fileName);
                break;

            case ".ADP":
            case ".ADE":
                app = new AccessAdp(fileName);
                break;

            case ".ACCDB":
                app = new AccessAccdb(fileName);
                break;
            }
            app.IntanceAccessApplication();
            app.InitializeAllowedObjetTypes();
            return(app);
        }
Example #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="app"><see cref="AccessApp"/> object</param>
 /// <param name="name">Access object's name</param>
 /// <param name="objectType"><see cref="ObjectType"/> specifing the concrete type of Access object</param>
 public StandardObject(AccessApp app, string name, ObjectType objectType) : base(app, name, objectType)
 {
 }
Example #7
0
 public CustomObject(AccessApp app, string name, ObjectType objectType) : base(app, name, objectType)
 {
 }
Example #8
0
 public Relations(AccessApp app, string name, ObjectType objectType) : base(app, name, objectType)
 {
 }
Example #9
0
 public DatabaseDao(AccessApp app, string name, ObjectType objectType) : base(app, name, objectType)
 {
     DaoObject = app.Application.CurrentDb();
 }
Example #10
0
 public References(AccessApp app, string name, ObjectType objectType) : base(app, name, objectType)
 {
 }
Example #11
0
 public DatabasePrj(AccessApp app, string name, ObjectType objectType) : base(app, name, objectType)
 {
     DaoObject = app.Application.CurrentProject;
 }
Example #12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="app"><see cref="AccessApp"/> object</param>
 /// <param name="name">database file name</param>
 /// <param name="objectType">instance of <see cref="ObjectType"/> with ObjectType.DatabasePrj or ObjectType.DatabaseDao value</param>
 public Database(AccessApp app, string name, ObjectType objectType) : base(app, name, objectType)
 {
 }
Example #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="app">Setting this property also fills the object tree</param>
 public ObjectTree(AccessIO.AccessApp app) : base()
 {
     App = app;
 }
Example #14
0
 /// <summary>
 /// Create an Access object
 /// </summary>
 /// <param name="name">Object's name in Access database</param>
 /// <param name="objectType">Object type</param>
 public AccessObject(AccessApp app, string name, ObjectType objectType)
 {
     this.App        = app;
     this.Name       = name;
     this.ObjectType = objectType;
 }