/// <summary>
        /// Constructor accepting the assembly and a usercode performing the registration
        /// </summary>
        /// <param name="daMgr">DataAccess manager object</param>
        /// <param name="assemblyName">Fully qualified assembly name</param>
        /// <param name="assemblyFileName">Fully qualified assembly path and filename</param>
        /// <param name="userCode">Usercode of user performing registration</param>
        /// <returns></returns>
        public static Int32 RegisterAssemblyTasks(DataAccessMgr daMgr
                                                  , string assemblyName
                                                  , string assemblyFileName
                                                  , Int32?userCode)
        {
            // Load the assemlb
            Assembly      asm    = Assembly.LoadFrom(assemblyFileName);
            DbCommandMgr  cmdMgr = new DbCommandMgr(daMgr);
            DbTableDmlMgr dmlMgr = new DbTableDmlMgr(daMgr, DataAccess.Constants.SCHEMA_CORE, Constants.TaskRegistrations);

            dmlMgr.AddColumn(Constants.TaskId, daMgr.BuildParamName(Constants.TaskId), DbTableColumnType.ForInsertOnly);
            dmlMgr.AddColumn(Constants.AssemblyName, daMgr.BuildParamName(Constants.AssemblyName));
            dmlMgr.AddColumn(Constants.TaskDescription, daMgr.BuildParamName(Constants.TaskDescription));
            dmlMgr.AddColumn(Constants.LastRegisteredDate, EnumDateTimeLocale.Default);
            // if usercode was provided add it to last mod key
            if (userCode.HasValue)
            {
                dmlMgr.AddColumn(Constants.LastModifiedUserCode, daMgr.BuildParamName(Constants.LastModifiedUserCode));
                dmlMgr.AddColumn(Constants.LastModifiedDateTime, EnumDateTimeLocale.Default);
            }
            dmlMgr.SetWhereCondition((j) =>
                                     j.Column(Constants.TaskId) ==
                                     j.Parameter(Constants.TaskRegistrations
                                                 , Constants.TaskId
                                                 , daMgr.BuildParamName(Constants.TaskId)));
            // build a merge statement
            DbCommand dbCmd = daMgr.BuildMergeDbCommand(dmlMgr);

            int typesFound = 0;

            // set the values for the dbCommand
            foreach (Type t in ObjectFactory.SearchTypes <TaskProcess>(asm))
            {
                // we must create the task object in or to have access to the TaskDesve
                TaskProcess tp = ObjectFactory.Create <TaskProcess>(assemblyFileName, t.FullName, null, null, null, null, null, null);
                dbCmd.Parameters[daMgr.BuildParamName(Constants.TaskId)].Value          = t.FullName;
                dbCmd.Parameters[daMgr.BuildParamName(Constants.AssemblyName)].Value    = assemblyName;
                dbCmd.Parameters[daMgr.BuildParamName(Constants.TaskDescription)].Value = tp.TaskDescription();
                if (userCode.HasValue)
                {
                    dbCmd.Parameters[daMgr.BuildParamName(Constants.LastModifiedUserCode)].Value = userCode.Value;
                }
                cmdMgr.AddDbCommand(dbCmd);
                ++typesFound;
            }
            // register the task (update it if exists otherwise insert)
            cmdMgr.ExecuteNonQuery();
            return(typesFound);
        }