Пример #1
0
        public UsuarioService(
            IAuthentication authentication,
            IApplication application,
            IParametroService parametroService,
            IUsuarioRepository <Usuario> repositoryUsuario,
            AspUserManager <Rol, Usuario, Modulo> userManager,
            AspRoleManager <Rol, Usuario> roleManager,
            BaseModuleManager <Modulo, Usuario> moduleManager,
            IdentityEmailMessageService emailService,
            ITemplateEngine templateEngine,

            IRolRepository <Rol> rolRepository,
            IRolService rolService) : base(repositoryUsuario)
        {
            this.authentication    = authentication;
            this.application       = application;
            this.ParametroService  = parametroService;
            this.RepositoryUsuario = repositoryUsuario;
            this.UserManager       = userManager;
            this.RoleManager       = roleManager;
            this.ModuleManager     = moduleManager;
            this.EmailService      = emailService;
            this.TemplateEngine    = templateEngine;

            this.RepositoryRol = rolRepository;
            RolService         = rolService;
        }
Пример #2
0
 public FAQService(iApplicationContext oContext)
     : base(oContext.DataContext)
 {
     _Context = oContext;
     Manager  = new BaseModuleManager(oContext.DataContext);
     UC       = oContext.UserContext;
 }
Пример #3
0
 public ServiceCommunityDiary(iApplicationContext oContext)
 {
     Manager            = new BaseModuleManager(oContext.DataContext);
     _Context           = oContext;
     UC                 = oContext.UserContext;
     _ServiceRepository = new FileRepository.Business.ServiceRepository(oContext);
 }
 public AddRepositoryActionPresenter(iApplicationContext oContext, IViewAddRepositoryAction view)
     : base(oContext, view)
 {
     CurrentManager     = new BaseModuleManager(oContext);
     _Service           = new Service(oContext);
     _ServiceRepository = new Core.FileRepository.Business.ServiceFileRepository(oContext);
 }
Пример #5
0
 public ServiceCommunityDiary(iDataContext oDC)
 {
     Manager              = new BaseModuleManager(oDC);
     _Context             = new ApplicationContext();
     _Context.DataContext = oDC;
     this.UC              = null;
     _ServiceRepository   = new FileRepository.Business.ServiceRepository(_Context);
 }
Пример #6
0
 public ScormStatService(iApplicationContext oContext)
     : base(oContext.DataContext)
 {
     _Context   = oContext;
     Manager    = new BaseModuleManager(oContext.DataContext);
     UC         = oContext.UserContext;
     RepService = new ServiceRepository(oContext);
 }
Пример #7
0
 public FAQService(iDataContext oDC)
     : base(oDC)
 {
     Manager  = new BaseModuleManager(oDC);
     _Context = new ApplicationContext {
         DataContext = oDC
     };
 }
Пример #8
0
        /// <summary>
        /// 某个用户是否对某个模块有相应的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="moduleCode">模块编号</param>
        /// <returns>是否有权限</returns>
        public bool IsModuleAuthorizedByUser(BaseUserInfo userInfo, string userId, string moduleCode)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            bool returnValue = false;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    // 是否超级管理员
                    BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo);
                    if (userManager.IsAdministrator(userId))
                    {
                        return(true);
                    }
                    else
                    {
                        BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo);
                        DataTable         dataTable     = moduleManager.GetDataTableByUser(userId);
                        foreach (DataRow dataRow in dataTable.Rows)
                        {
                            if (dataRow[BaseModuleEntity.FieldCode].ToString().Equals(moduleCode))
                            {
                                returnValue = true;
                                break;
                            }
                        }
                    }
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_IsModuleAuthorizedByUser, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(returnValue);
        }
Пример #9
0
 public FileInfoService(iApplicationContext oContext)
     : base(oContext.DataContext)
 {
     _Context          = oContext;
     Manager           = new BaseModuleManager(oContext.DataContext);
     UC                = oContext.UserContext;
     repositoryService = new ServiceRepository(oContext);
     coreApiService    = new CoreAPIService(oContext);
 }
Пример #10
0
 public FileInfoService(iDataContext oDC)
     : base(oDC)
 {
     Manager  = new BaseModuleManager(oDC);
     _Context = new ApplicationContext {
         DataContext = oDC
     };
     repositoryService = new ServiceRepository(oDC);
     coreApiService    = new CoreAPIService(oDC);
 }
Пример #11
0
        /// <summary>
        /// 更新模块菜单
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="moduleEntity">实体</param>
        /// <param name="statusCode">返回状态码</param>
        /// <param name="statusMessage">返回状消息</param>
        /// <returns>影响行数</returns>
        public int Update(BaseUserInfo userInfo, BaseModuleEntity moduleEntity, out string statusCode, out string statusMessage)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            statusCode    = string.Empty;
            statusMessage = string.Empty;
            int returnValue = 0;

            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    string tableName = BaseModuleEntity.TableName;
                    if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
                    {
                        tableName = BaseSystemInfo.SystemCode + "Module";
                    }
                    BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo, tableName);
                    // 调用方法,并且返回运行结果
                    returnValue = moduleManager.Update(moduleEntity, out statusCode);
                    // 获得状态消息
                    statusMessage = moduleManager.GetStateMessage(statusCode);
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ModuleService_Update, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(returnValue);
        }
Пример #12
0
        /// <summary>
        /// 获取模块列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        public DataTable GetDataTable(BaseUserInfo userInfo)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            DataTable dataTable = new DataTable(BaseModuleEntity.TableName);
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    string tableName = BaseModuleEntity.TableName;
                    if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
                    {
                        tableName = BaseSystemInfo.SystemCode + "Module";
                    }
                    BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo, tableName);
                    dataTable = moduleManager.GetDataTable(
                        new KeyValuePair <string, object>(BaseModuleEntity.FieldDeletionStateCode, 0)
                        //, new KeyValuePair<string, object>(BaseModuleEntity.FieldEnabled, 1)
                        , BaseModuleEntity.FieldSortCode);
                    dataTable.DefaultView.Sort = BaseModuleEntity.FieldSortCode;
                    dataTable.TableName        = BaseModuleEntity.TableName;
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ModuleService_GetDataTable, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(dataTable);
        }
        public new string GetIdByCode(string permissionItemCode)
        {
            string tableName = BaseOrganizeEntity.TableName;

            if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
            {
                tableName = BaseSystemInfo.SystemCode + "PermissionItem";
            }
            BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, UserInfo, tableName);

            return(moduleManager.GetIdByCode(permissionItemCode));
            //BasePermissionItemManager permissionItemManager = new BasePermissionItemManager(DbHelper);
            //// 这里应该是若不存在就自动加一个操作权限
            //return permissionItemManager.GetIdByAdd(permissionItemCode);
        }
Пример #14
0
        /// <summary>
        /// 保存排序顺序
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <returns>影响行数</returns>
        public int SetSortCode(BaseUserInfo userInfo, string[] ids)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            int returnValue = 0;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    if (userInfo.IsAdministrator)
                    {
                        string tableName = BaseModuleEntity.TableName;
                        if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
                        {
                            tableName = BaseSystemInfo.SystemCode + "Module";
                        }
                        BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo, tableName);
                        returnValue = moduleManager.BatchSetSortCode(ids);
                    }
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ModuleService_SetSortCode, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(returnValue);
        }
Пример #15
0
        /// <summary>
        /// 批量移动数据
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="organizeIds">组织机构主键数组</param>
        /// <param name="parentId">父结点主键</param>
        /// <returns>数据表</returns>
        public int BatchMoveTo(BaseUserInfo userInfo, string[] moduleIds, string parentId)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            int returnValue = 0;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    string tableName = BaseModuleEntity.TableName;
                    if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
                    {
                        tableName = BaseSystemInfo.SystemCode + "Module";
                    }
                    BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo, tableName);
                    for (int i = 0; i < moduleIds.Length; i++)
                    {
                        returnValue += moduleManager.SetProperty(moduleIds[i], new KeyValuePair <string, object>(BaseModuleEntity.FieldParentId, parentId));
                    }
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ModuleService_BatchMoveTo, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(returnValue);
        }
Пример #16
0
        /// <summary>
        /// 获取用户有权限访问的模块主键
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>主键数组</returns>
        public string[] GetModuleIdsByUser(BaseUserInfo userInfo, string userId)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            string[] returnValue = null;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo);
                    if (userInfo.IsAdministrator)
                    {
                        // 有效的,未被删除的显示出来
                        returnValue = moduleManager.GetIds(new KeyValuePair <string, object>(BaseModuleEntity.FieldDeletionStateCode, 0), new KeyValuePair <string, object>(BaseModuleEntity.FieldEnabled, 1));
                    }
                    else
                    {
                        returnValue = moduleManager.GetIdsByUser(userId);
                    }
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_GetModuleDTByUser, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif
            return(returnValue);
        }
Пример #17
0
        /// <summary>
        /// 按某个权限域获取模块列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemCode">权限域编号</param>
        /// <returns>数据表</returns>
        public DataTable GetModuleDTByPermissionScope(BaseUserInfo userInfo, string userId, string permissionItemCode)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            DataTable dataTable = new DataTable(BaseModuleEntity.TableName);
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo);
                    dataTable           = moduleManager.GetDataTableByPermission(userId, permissionItemCode);
                    dataTable.TableName = BaseModuleEntity.TableName;
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_GetModuleDTByPermission, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(dataTable);
        }
Пример #18
0
    /// <summary>
    /// 获取菜单模块树型列表
    /// </summary>
    /// <param name="systemCode">子系统</param>
    /// <param name="ddlModule">菜单模块选项</param>
    /// <param name="insertBlank">插入空行</param>
    /// <param name="isMenu">是否菜单(0/1)</param>
    protected void GetModuleTree(string systemCode, DropDownList ddlModule, bool insertBlank = true, string isMenu = null)
    {
        ddlModule.Items.Clear();
        if (string.IsNullOrEmpty(systemCode))
        {
            systemCode = "Base";
        }
        //读取选定子系统的菜单模块
        var dt = new BaseModuleManager(UserInfo).GetModuleTree(systemCode, isMenu);

        if (dt != null && dt.Rows.Count > 0)
        {
            ddlModule.DataValueField = BaseModuleEntity.FieldId;
            ddlModule.DataTextField  = BaseModuleEntity.FieldName;
            ddlModule.DataSource     = dt;
            ddlModule.DataBind();
        }
        if (insertBlank)
        {
            ddlModule.Items.Insert(0, new ListItem());
        }
    }
Пример #19
0
 public ImportPresenter(iApplicationContext oContext, IViewImport view)
     : base(oContext, view)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
Пример #20
0
 public GlossaryAddPresenter(iApplicationContext oContext)
     : base(oContext)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
 public UC_GlossarySettingsPresenter(iApplicationContext oContext, IViewUC_GlossarySettings view)
     : base(oContext, view)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
Пример #22
0
 public UC_GlossaryImportTermsPresenter(iApplicationContext oContext)
     : base(oContext)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
 public UC_GlossaryShareStatePresenter(iApplicationContext oContext, IViewUC_GlosssaryShareState view)
     : base(oContext, view)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
Пример #24
0
 public RecycleBinPresenter(iApplicationContext oContext, IViewRecycleBin view)
     : base(oContext, view)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
Пример #25
0
 public TermAddPresenter(iApplicationContext oContext, IViewTermAdd view)
     : base(oContext, view)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
Пример #26
0
        /// <summary>
        /// 获得用户有访问权限的模块
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>数据表</returns>
        public DataTable GetModuleDTByUser(BaseUserInfo userInfo, string userId)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            DataTable dataTable = new DataTable(BaseModuleEntity.TableName);
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    string tableName = BaseModuleEntity.TableName;
                    if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
                    {
                        tableName = BaseSystemInfo.SystemCode + "Module";
                    }
                    BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo, tableName);
                    if (userInfo.IsAdministrator)
                    {
                        List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                        parameters.Add(new KeyValuePair <string, object>(BaseModuleEntity.FieldEnabled, 1));
                        parameters.Add(new KeyValuePair <string, object>(BaseModuleEntity.FieldDeletionStateCode, 0));
                        // 有效的,未被删除的显示出来
                        dataTable = moduleManager.GetDataTable(parameters, BaseModuleEntity.FieldSortCode);
                    }
                    else
                    {
                        dataTable = moduleManager.GetDataTableByUser(userId);
                    }
                    // 若不是员工,有些菜单可以去掉的功能,加在这里
                    if (string.IsNullOrEmpty(userInfo.StaffId))
                    {
                        BaseBusinessLogic.Delete(dataTable, BaseModuleEntity.FieldCode, "FrmStaffAddressEdit");
                        dataTable.AcceptChanges();
                    }
                    dataTable.TableName = BaseModuleEntity.TableName;
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_GetModuleDTByUser, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif
            return(dataTable);
        }
Пример #27
0
 public GlossaryViewPresenter(iApplicationContext oContext, IViewGlossaryView view)
     : base(oContext, view)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
Пример #28
0
 public UC_ImportCommunityGlossaryPresenter(iApplicationContext oContext, IViewUC_ImportCommunityGlossary view)
     : base(oContext, view)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
Пример #29
0
 public TermEditPresenter(iApplicationContext oContext)
     : base(oContext)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }
 public GlossaryEditImportTermsPresenter(iApplicationContext oContext, IViewGlossaryImportTerms view)
     : base(oContext, view)
 {
     CurrentManager = new BaseModuleManager(oContext);
 }