Exemplo n.º 1
0
        /// <summary>
        ///     Dispose IAppRuntime
        /// </summary>
        /// <param name="pIAppRuntime"></param>
        /// <param name="pCheckSession"></param>
        public static void DisposeAppRuntime(IAppRuntime pIAppRuntime, bool pCheckSession)
        {
            try
            {
                if (pIAppRuntime == null && pCheckSession)
                {
                    pIAppRuntime = WebUtilities.GetSessionObject <IAppRuntime>(Constants.SessionKey_IAppRuntime);
                }

                if (pIAppRuntime != null)
                {
                    pIAppRuntime.Dispose();
                    pIAppRuntime = null;
                }

                if (pCheckSession)
                {
                    WebUtilities.RemoveSessionObject(Constants.SessionKey_IAppRuntime);
                }
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Create an instance of the IAppRuntime
        /// </summary>
        /// <param name="pCheckSession"></param>
        /// <returns></returns>
        public static IAppRuntime CreateAppRuntime(bool pCheckSession)
        {
            IAppRuntime appRunTime = null;

            try
            {
                if (pCheckSession)
                {
                    appRunTime = WebUtilities.GetSessionObject <IAppRuntime>(Constants.SessionKey_IAppRuntime);
                }

                if (appRunTime == null)
                {
                    appRunTime = AppRuntime.Create();
                }

                if (pCheckSession)
                {
                    WebUtilities.SetSessionObject(Constants.SessionKey_IAppRuntime, appRunTime);
                }
            }
            catch
            {
                throw;
            }

            return(appRunTime);
        }
Exemplo n.º 3
0
        public static TTarget Adapt <TTarget>(this IAppRuntime @this, object source)
            where TTarget : class, new()
        {
            var adpter = @this.TypeAdapterFactory.Create();

            return(adpter.Adapt <TTarget>(source));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get Presenter
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="pAppRuntime"></param>
        /// <param name="pSessionKey"></param>
        /// <returns></returns>
        public static T GetPresenter <T>(IAppRuntime pAppRuntime, string pSessionKey) where T : PresenterBase
        {
            T presenter = null;

            try
            {
                presenter = WebUtilities.GetSessionObject <T>(pSessionKey);

                if (presenter == null)
                {
                    presenter = Activator.CreateInstance(typeof(T), new object[] { pAppRuntime }, null) as T;

                    if (presenter != null)
                    {
                        WebUtilities.SetSessionObject(pSessionKey, presenter);
                    }
                }
            }
            catch { throw; }

            return(presenter);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Get History Manager
        /// </summary>
        /// <param name="pAppRuntime"></param>
        /// <param name="pSessionKey"></param>
        /// <returns></returns>
        public static HistoryManager GetHistoryManager(IAppRuntime pAppRuntime, string pSessionKey)
        {
            HistoryManager manager = null;

            try
            {
                manager = WebUtilities.GetSessionObject <HistoryManager>(pSessionKey);

                if (manager == null)
                {
                    manager = Activator.CreateInstance(typeof(HistoryManager), new object[] { pAppRuntime }, null) as HistoryManager;

                    if (manager != null)
                    {
                        WebUtilities.SetSessionObject(pSessionKey, manager);
                    }
                }
            }
            catch { throw; }

            return(manager);
        }
 public ApplicationWebServiceRequestPresenter(IAppRuntime pAppRuntime)
     : base(pAppRuntime)
 {
 }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ModelAssemblyRegistry"/> class.
        /// </summary>
        /// <param name="appRuntime">The application runtime.</param>
        public ModelAssemblyRegistry(IAppRuntime appRuntime)
        {
            Contract.Requires(appRuntime != null);

            this.appRuntime = appRuntime;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Create DBProvider
        /// </summary>
        /// <param name="pAdapterMetadata"></param>
        /// <param name="pApplicationDatabase"></param>
        /// <param name="pAppRuntime"></param>
        /// <returns></returns>
        public static AbstractDBProvider CreateDBProvider(IntegrationAdapter pAdapterMetadata, ApplicationDatabas pApplicationDatabase, IAppRuntime pAppRuntime)
        {
            AbstractDBProvider dbProvider = null;

            try
            {
                switch (pApplicationDatabase.ApplicationDatabaseType.ToEnum <ApplicationDatabaseType>())
                {
                case ApplicationDatabaseType.SQLServer:
                {
                    dbProvider = SQLProvider.Create(pAdapterMetadata, pApplicationDatabase, pAppRuntime);
                }
                break;

                case ApplicationDatabaseType.Oracle:
                {
                    dbProvider = OracleProvider.Create(pAdapterMetadata, pApplicationDatabase, pAppRuntime);
                }
                break;

                case ApplicationDatabaseType.MySQL:
                {
                    //Not yet Implemented
                }
                break;

                case ApplicationDatabaseType.Sybase:
                {
                    //Not yet Implemented
                }
                break;

                default:
                { }
                break;
                }
            }
            catch { throw; }

            return(dbProvider);
        }
Exemplo n.º 9
0
 internal SettingsService(IAppRuntime pIAppRuntime)
     : base(pIAppRuntime)
 {
 }
Exemplo n.º 10
0
 internal static DBAdapter Create(IntegrationProcess pProcessMetadata, IntegrationAdapter pAdapterMetadata, IAppRuntime pIAppRuntime)
 {
     return(new DBAdapter(pProcessMetadata, pAdapterMetadata, pIAppRuntime));
 }
Exemplo n.º 11
0
 internal ReportsService(IAppRuntime pIAppRuntime)
     : base(pIAppRuntime)
 {
 }
Exemplo n.º 12
0
 public IntegrationAdapterPresenter(IAppRuntime pAppRuntime)
     : base(pAppRuntime)
 {
 }
 public ApplicationDatabasePresenter(IAppRuntime pAppRuntime)
     : base(pAppRuntime)
 {
 }
Exemplo n.º 14
0
 internal AdapterCacheManager(IAppRuntime pIAppRuntime)
     : base(pIAppRuntime)
 {
 }
 public IntegrationProcessHistoryPresenter(IAppRuntime pAppRuntime)
     : base(pAppRuntime)
 {
 }
Exemplo n.º 16
0
 public AbstractProvider(IntegrationAdapter pAdapterMetadata, IAppRuntime pAppRuntime)
     : base(pAppRuntime)
 {
     this.AdapterMetadata = pAdapterMetadata;
 }
Exemplo n.º 17
0
 internal AbstractAdapter(IntegrationProcess pProcessMetadata, IntegrationAdapter pAdapterMetadata, IAppRuntime pIAppRuntime)
     : base(pIAppRuntime)
 {
     this.ProcessMetadata = pProcessMetadata;
     this.AdapterMetadata = pAdapterMetadata;
 }
Exemplo n.º 18
0
        /// <summary>
        /// Create Adapter
        /// </summary>
        /// <param name="pProcessMetadata"></param>
        /// <param name="pAdapterMetadata"></param>
        /// <param name="pAppRuntime"></param>
        /// <returns></returns>
        internal static AbstractAdapter CreateAdapter(IntegrationProcess pProcessMetadata, IntegrationAdapter pAdapterMetadata, IAppRuntime pAppRuntime)
        {
            AbstractAdapter adapter = null;

            switch (pAdapterMetadata.EndPointType.ToEnum <EndPointType>())
            {
            case EndPointType.Database:
            {
                adapter = DBAdapter.Create(pProcessMetadata, pAdapterMetadata, pAppRuntime);
            }
            break;

            case EndPointType.WebService:
            {
                adapter = WSAdapter.Create(pProcessMetadata, pAdapterMetadata, pAppRuntime);
            }
            break;

            default:
            { }
            break;
            }

            return(adapter);
        }
Exemplo n.º 19
0
 internal TransactionLogManager(IAppRuntime pIAppRuntime)
     : base(pIAppRuntime)
 {
 }
Exemplo n.º 20
0
 internal static IReportsService Create(IAppRuntime pIAppRuntime)
 {
     return(new ReportsService(pIAppRuntime));
 }
Exemplo n.º 21
0
 internal SecurityService(IAppRuntime pIAppRuntime)
     : base(pIAppRuntime)
 {
 }
Exemplo n.º 22
0
 internal DBAdapter(IntegrationProcess pProcessMetadata, IntegrationAdapter pAdapterMetadata, IAppRuntime pIAppRuntime)
     : base(pProcessMetadata, pAdapterMetadata, pIAppRuntime)
 {
 }
Exemplo n.º 23
0
        ///// <summary>
        ///// Get User
        ///// </summary>
        ///// <param name="pUserName"></param>
        ///// <param name="pIncludeAll"></param>
        ///// <returns></returns>
        //public ApplicationUser GetUser(string pUserName, bool pIncludeAll = true)
        //{
        //    ApplicationUser user = null;

        //    try
        //    {
        //        List<string> includes = new List<string>();

        //        if (pIncludeAll)
        //        {
        //            includes.Add("ApplicationUserInGroups.ApplicationGroup.ApplicationGroupInRoles.ApplicationRole.ApplicationRoleUsersAccess");
        //        }
        //        else
        //        {
        //            includes.Add("ApplicationUserInGroups.ApplicationGroup");
        //            includes.Add("ApplicationUserCCSIs.CCSI");
        //            includes.Add("ApplicationUserLicenses.License");
        //        }

        //        user = base.AppRuntime.DataService.GetEntity(GetDataRequest<ApplicationUser>.Create(
        //            c => c.UserName == pUserName, includes.ToArray()));
        //    }
        //    catch { throw; }

        //    return user;
        //}

        ///// <summary>
        ///// Get User Info
        ///// </summary>
        ///// <returns></returns>
        //public UserInfo GetUserInfo(string pUserName)
        //{
        //    UserInfo userInfo = null;

        //    try
        //    {
        //        userInfo = DTOUtilities.BuildUserInfo(pUserName, this.GetUser(pUserName, false));
        //    }
        //    catch (Exception ex)
        //    {
        //        LogManager.LogException(ex);
        //    }

        //    return userInfo;
        //}

        ///// <summary>
        ///// Get Current User
        ///// </summary>
        ///// <param name="pReload"></param>
        ///// <returns></returns>
        //public UserInfo GetCurrentUser(bool pReload = true)
        //{
        //    if (pReload)
        //    {
        //        this.CurrentUser = null;
        //    }

        //    return this.CurrentUser;
        //}

        ///// <summary>
        ///// Add User Track Page
        ///// </summary>
        ///// <param name="pApplicationRole"></param>
        ///// <param name="pUserID"></param>
        //public void AddUserTrackPage(ApplicationRole pApplicationRole, string pUserID)
        //{
        //    try
        //    {
        //        if (pApplicationRole != null)
        //        {
        //            ApplicationRoleUsersAccess appRoleUserAccesss = new ApplicationRoleUsersAccess()
        //            {
        //                ApplicationRoleID = pApplicationRole.ApplicationRoleID,
        //                ApplicationUserID = pUserID,
        //                AccessDateTime = DateTime.Now,
        //            };

        //            base.AppRuntime.DataService.AddEntity(appRoleUserAccesss);
        //            base.AppRuntime.DataService.SaveChanges();
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        LogManager.LogException(ex);
        //    }
        //}

        ///// <summary>
        ///// Add User Track Page
        ///// </summary>
        ///// <param name="pApplicationRolePath"></param>
        ///// <param name="pUserID"></param>
        //public void AddUserTrackPage(string pApplicationRolePath, string pUserID)
        //{
        //    try
        //    {
        //        ApplicationRole appRole = base.AppRuntime.MetadataService.GetRole(pApplicationRolePath);

        //        if (appRole != null)
        //        {
        //            this.AddUserTrackPage(appRole, pUserID);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        LogManager.LogException(ex);
        //    }
        //}

        ///// <summary>
        ///// Check User Authorization
        ///// </summary>
        ///// <param name="pUser"></param>
        ///// <param name="pApplicationRolePath"></param>
        ///// <param name="pAddUserTrack"></param>
        ///// <returns></returns>
        //public bool CheckUserAuthorization(UserInfo pUser, string pApplicationRolePath, bool pAddUserTrack = true)
        //{
        //    bool isAuthorized = false;

        //    try
        //    {
        //        ApplicationRole appRole = base.AppRuntime.MetadataService.GetRole(pApplicationRolePath);

        //        if (appRole != null)
        //        {
        //            isAuthorized = this.CheckUserAuthorization(pUser, appRole, pAddUserTrack);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        LogManager.LogException(ex);
        //    }

        //    return isAuthorized;
        //}

        ///// <summary>
        ///// Check User Authorization
        ///// </summary>
        ///// <param name="pUser"></param>
        ///// <param name="pApplicationRole"></param>
        ///// <param name="pAddUserTrack"></param>
        ///// <returns></returns>
        //public bool CheckUserAuthorization(UserInfo pUser, ApplicationRole pApplicationRole, bool pAddUserTrack = true)
        //{
        //    bool isAuthorized = false;

        //    try
        //    {
        //        if (pApplicationRole != null)
        //        {
        //            foreach (ApplicationGroupInRole appGroup in pApplicationRole.ApplicationGroupInRoles.Where(c => c.ApplicationGroup.IsActiveDirectoryGroup == false))
        //            {
        //                ApplicationUserInGroup appGroupUser = appGroup.ApplicationGroup.ApplicationUserInGroups.FirstOrDefault(c =>
        //                    c.ApplicationUser.UserName.ToLower() == pUser.UserName.ToLower());

        //                if (appGroupUser != null)
        //                {
        //                    isAuthorized = true;
        //                    break;
        //                }
        //            }

        //            if (pAddUserTrack)
        //            {
        //                this.AddUserTrackPage(pApplicationRole, pUser.UserName);
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        LogManager.LogException(ex);
        //    }

        //    return isAuthorized;
        //}

        ///// <summary>
        ///// Get User Roles
        ///// </summary>
        ///// <param name="pUser"></param>
        ///// <returns></returns>
        //public List<ApplicationRole> GetUserRoles(UserInfo pUser)
        //{
        //    List<ApplicationRole> roles = null;

        //    try
        //    {
        //        roles = new List<ApplicationRole>();

        //        foreach (ApplicationRole appRole in base.AppRuntime.MetadataService.Roles)
        //        {
        //            foreach (ApplicationGroupInRole appGroup in appRole.ApplicationGroupInRoles)
        //            {
        //                ApplicationUserInGroup appGroupUser = appGroup.ApplicationGroup.ApplicationUserInGroups.FirstOrDefault(c =>
        //                    c.ApplicationUser.UserName.ToLower() == pUser.UserName);

        //                if (appGroupUser != null)
        //                {
        //                    roles.Add(appRole);
        //                    break;
        //                }
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        LogManager.LogException(ex);
        //    }

        //    return roles;
        //}

        ///// <summary>
        ///// Get User Menu
        ///// </summary>
        ///// <param name="pUser"></param>
        ///// <returns></returns>
        //public List<ApplicationMenu> GetUserMenu(UserInfo pUser)
        //{
        //    List<ApplicationMenu> menus = null;

        //    try
        //    {
        //        menus = new List<ApplicationMenu>();
        //        List<ApplicationRole> userRoles = this.GetUserRoles(pUser);

        //        foreach (ApplicationMenu menuModule in base.AppRuntime.MetadataService.Menus.Where(c => c.IsModuleRoot).OrderBy(c => c.DisplaySequence))
        //        {
        //            bool pAddModule = false;

        //            foreach (ApplicationMenu menuGroup in menuModule.Items.OrderBy(c => c.DisplaySequence))
        //            {
        //                bool pAddGroup = false;

        //                foreach (ApplicationMenu menuRole in menuGroup.Items.OrderBy(c => c.DisplaySequence))
        //                {
        //                    ApplicationRole appRole = userRoles.FirstOrDefault(c => c.ApplicationRoleID == menuRole.ApplicationRoleID);

        //                    if (appRole != null)
        //                    {
        //                        pAddModule = true;
        //                        pAddGroup = true;

        //                        menus.Add(menuRole);
        //                    }
        //                }

        //                if (pAddGroup)
        //                {
        //                    menus.Add(menuGroup);
        //                }
        //            }

        //            if (pAddModule)
        //            {
        //                menus.Add(menuModule);
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        LogManager.LogException(ex);
        //    }

        //    return menus;
        //}

        #endregion

        #endregion

        #region Factory

        internal static ISecurityService Create(IAppRuntime pIAppRuntime)
        {
            return(new SecurityService(pIAppRuntime));
        }
Exemplo n.º 24
0
 internal static ISettingsService Create(IAppRuntime pIAppRuntime)
 {
     return(new SettingsService(pIAppRuntime));
 }
Exemplo n.º 25
0
 public AbstractWSProvider(IntegrationAdapter pAdapterMetadata, ApplicationWebService pApplicationWebServiceMetadata, IAppRuntime pAppRuntime)
     : base(pAdapterMetadata, pAppRuntime)
 {
     this.ApplicationWebServiceMetadata = pApplicationWebServiceMetadata;
 }
Exemplo n.º 26
0
 public IntegrationProcessMappingPresenter(IAppRuntime pAppRuntime)
     : base(pAppRuntime)
 {
 }
Exemplo n.º 27
0
        public AbstractDBProvider(IntegrationAdapter pAdapterMetadata, ApplicationDatabas pApplicationDatabaseMetadata, IAppRuntime pAppRuntime)
            : base(pAdapterMetadata, pAppRuntime)
        {
            this.ApplicationDatabaseMetadata = pApplicationDatabaseMetadata;

            if (this.ApplicationDatabaseMetadata != null)
            {
                this.ProviderType = this.ApplicationDatabaseMetadata.ApplicationDatabaseType.ToEnum <ApplicationDatabaseType>();
            }
        }
Exemplo n.º 28
0
 public AppRuntimeComponent(IAppRuntime pIAppRuntime)
 {
     this.AppRuntime = pIAppRuntime;
 }
Exemplo n.º 29
0
 internal MetadataService(IAppRuntime pIAppRuntime)
     : base(pIAppRuntime)
 {
 }
Exemplo n.º 30
0
 /// <summary>
 /// Presenter Base
 /// </summary>
 /// <param name="pAppRuntime"></param>
 public PresenterBase(IAppRuntime pAppRuntime)
 {
     this.AppRuntime = pAppRuntime;
 }
Exemplo n.º 31
0
 internal static IMetadataService Create(IAppRuntime pIAppRuntime)
 {
     return(new MetadataService(pIAppRuntime));
 }