Beispiel #1
0
        private void CreateObjectsFormXDocument(XDocument xml)
        {
            var xmlUserObjects = xml.Descendants(@"UserObject");

            foreach (var xmlUserObject in xmlUserObjects)
            {
                var userObject = (UserObjectsMD)company.GetBusinessObject(BoObjectTypes.oUserObjectsMD);
                var adapter    = new UserObjectAdapter(userObject, xmlUserObject);
                adapter.Execute();

                var addUserObject = new AddUserObject(company, userObject);
                addUserObject.OnError += OnAddUserObjectError;
                addUserObject.Execute();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates the object.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="tableName">Name of the table.</param>
        private void CreateObject(Type type, string tableName)
        {
            // ignore if not marked with user object attribute
            var userObjectAttribute = type.GetCustomAttribute <UserObjectAttribute>();

            if (userObjectAttribute == null)
            {
                return;
            }

            var userObject = (UserObjectsMD)company.GetBusinessObject(BoObjectTypes.oUserObjectsMD);
            var adapter    = new TypeUserObjectAdapter(type, tableName, userObject);

            adapter.Execute();

            var addUserObject = new AddUserObject(company, userObject);

            addUserObject.OnError += OnAddUserObjectError;
            addUserObject.Execute();
        }