/// <summary>
        /// 5.2.10	根据用户ID获取所有用户权限集合
        /// </summary>
        /// <param name="loginID">登录标识ID</param>
        /// <param name="userID">用户ID</param>
        /// <param name="userPrivilegesInfo">权限</param>
        /// <returns></returns>
        public ErrType UserRolePrivileges(string loginID, string userID, ref UserPrivilegesInfo userPrivilegesInfo)
        {
            try
            {
                List<PrivilegeEntity> list = new List<PrivilegeEntity>();
                EntityBase result = ManagerService.UserRolePrivileges(loginID, userID, ref  list);

                if (!result.Result)
                    return new ErrType(ERR.SERVICE, result.Desc);
                userPrivilegesInfo = MyConverter.ToUserPrivilegesInfo(list);
                return GeneralErr.Success;
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message); return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException);
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return new ErrType(ERR.EXEPTION, ErrorText.QueryError);
            }
        }
Exemplo n.º 2
0
        internal static UserPrivilegesInfo ToUserPrivilegesInfo(List<PrivilegeEntity> list)
        {
            UserPrivilegesInfo info = new UserPrivilegesInfo();

            if (list != null)
            {

                #region 管理权限

                info.AccountManager = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account).FirstOrDefault() == null ? false : true;// 账号管理权限(父级)
                //管理员
                info.AdminAccountManager = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Manager).FirstOrDefault() == null ? false : true;//管理员权限
                info.RolePrivilegeEnabled = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Manager_Role).FirstOrDefault() == null ? false : true;//管理员--角色权限
                info.AdminAccountManagerAccountInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Manager_AccountInfo).FirstOrDefault() == null ? false : true;//管理员--管理员资料
                info.AdminAccountManagerAddAccount = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Manager_AddAccount).FirstOrDefault() == null ? false : true;//管理员--新增管理员
                info.AdminAccountManagerDelAccount = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Manager_DelAccount).FirstOrDefault() == null ? false : true;//管理员--删除管理员


                //客户管理 
                info.ClientAccountManager = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client).FirstOrDefault() == null ? false : true;//客户账号管理权限
                info.ClientAccountManagerAccountInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client_AccountInfo).FirstOrDefault() == null ? false : true;//客户账号--客户账户资料
                info.ClientAccountManagerAddAccount = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client_AddAccount).FirstOrDefault() == null ? false : true;//客户账号--新增客户账户
                info.ClientAccountManagerAdjustMoney = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client_AdjustMoney).FirstOrDefault() == null ? false : true;//客户账号--调节
                info.ClientAccountManagerDelAccount = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client_DelAccount).FirstOrDefault() == null ? false : true;//客户账号--删除客户账户
                info.ClientAccountManagerFundsInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client_FundsInfo).FirstOrDefault() == null ? false : true;//客户账号--客户资金信息
                info.ClientAccountManagerMarketOrder = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client_MarketOrder).FirstOrDefault() == null ? false : true;//客户账号--即时成交
                info.ClientAccountManagerPendingOrder = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client_PendingOrder).FirstOrDefault() == null ? false : true;//客户账号--挂单交易
                info.ClientAccountManagerOrderInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client_OrderInfo
                    && p.ParentPrivilegeName == AppPrivilegeConfig.Account_Client).FirstOrDefault() == null ? false : true;//客户管理--订单信息


                //会员账户
                info.DealerAccountManager = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_OrgAccount).FirstOrDefault() == null ? false : true;//金商账号/会员账户管理权限
                info.DealerAccountManagerAccountInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_OrgAccount_AccountInfo).FirstOrDefault() == null ? false : true;//会员账户--会员账户资料
                info.DealerAccountManagerAddAccount = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_OrgAccount_AddAccount).FirstOrDefault() == null ? false : true;//会员账户--新增会员账户
                info.DealerAccountManagerDelAccount = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_OrgAccount_DelAccount).FirstOrDefault() == null ? false : true;//会员账户--删除会员账户
                info.DealerAccountManagerRole = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_OrgAccount_Role).FirstOrDefault() == null ? false : true;//会员账户--会员账户角色

                //在线客户
                info.ClientOnlineAccountManager = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Online).FirstOrDefault() == null ? false : true;//在线客户
                info.ClientOnlineAccountManagerAccountInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Online_AccountInfo).FirstOrDefault() == null ? false : true;//在线客户--账户资料
                info.ClientOnlineAccountManagerDelAccount = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Online_DelAccount).FirstOrDefault() == null ? false : true;//在线客户--删除账户
                info.ClientOnlineAccountManagerFundsInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Online_FundsInfo).FirstOrDefault() == null ? false : true;//在线客户--资金信息
                info.ClientOnlineAccountManagerOrderInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Online_OrderInfo
                  && p.ParentPrivilegeName == AppPrivilegeConfig.Account_Online).FirstOrDefault() == null ? false : true;//在线客户--订单信息

                //微会员
                info.OrgManager = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Org).FirstOrDefault() == null ? false : true;//微会员
                info.OrgManagerAccountInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Org_AccountInfo).FirstOrDefault() == null ? false : true;//微会员--微会员资料

                info.OrgManagerAddAccount = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Org_AddAccount).FirstOrDefault() == null ? false : true;//微会员--新增微会员
                info.OrgManagerDelAccount = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Org_DelAccount).FirstOrDefault() == null ? false : true;//微会员--删除微会员

                info.orgManagerRole = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Org_Role).FirstOrDefault() == null ? false : true;//微会员--微会员角色
                info.OrgManagerSetCommissionRatio = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Org_SetCommissionRatio).FirstOrDefault() == null ? false : true;//微会员--返佣比例

                info.OrgManagerSetDefaultCommissionRatio = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Org_SetDefaultCommissionRatio).FirstOrDefault() == null ? false : true;//微会员--返佣比例
                info.OrgManagerSetAllCommissionRatio = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Org_SetAllCommissionRatio).FirstOrDefault() == null ? false : true;//微会员--返佣比例



                #endregion

                #region 系统设置
                info.IsSystemSettingsEnabled = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System).FirstOrDefault() == null ? false : true;//系统设置(父类)
                info.AllowReleaseNews = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_1).FirstOrDefault() == null ? false : true;//发布新闻
                info.AllowArticlesInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_ArticlesInfo).FirstOrDefault() == null ? false : true;//理财师说
                info.AllowAdvert = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_Advert).FirstOrDefault() == null ? false : true;//广告

                info.AllowReleaseAnnouncement = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_2).FirstOrDefault() == null ? false : true;//发布公告
                info.AllowViewLog = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_LogInfo).FirstOrDefault() == null ? false : true;//查看日志
                info.AllowHolidaysSettings = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_Holiday).FirstOrDefault() == null ? false : true;//假日设置
                info.AllowTradingDaySettings = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_TradingDay).FirstOrDefault() == null ? false : true;//交易日设置
                info.AllowTransactionSettings = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_TradingSetting).FirstOrDefault() == null ? false : true;//交易设置
                info.EnableIPAddressFiltering = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_IPAddrFilter).FirstOrDefault() == null ? false : true;//IP地址过滤
                info.EnableMACAddressFiltering = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_MACFilter).FirstOrDefault() == null ? false : true;//MAC地址过滤
                info.EnableRoleManager = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_RoleManager).FirstOrDefault() == null ? false : true;//角色管理
                info.EnablePrivilegeManager = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_PrivilegeManager).FirstOrDefault() == null ? false : true;//权限管理
                info.EnableTradeMoneyInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_TradeMoneyInfo).FirstOrDefault() == null ? false : true;//出入金解约
                info.GroupManager = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.System_Group).FirstOrDefault() == null ? false : true;//客户分组管理
                
                #endregion

                #region 数据管理
                info.IsDataManagerEnabled = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Data).FirstOrDefault() == null ? false : true;//数据管理权限(父类)
                info.IsProductManagerEnabled = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Data_ProductInfo).FirstOrDefault() == null ? false : true;//商品管理权限
                info.IsHistoryDataManagerEnabled = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Data_HistoryData).FirstOrDefault() == null ? false : true;//历史数据管理
                info.ExchangeRateWater = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Data_RateWaterInfo).FirstOrDefault() == null ? false : true;//汇率/水
                info.ManualPriceEnabled = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Data_ProductInfo_ManualPrice).FirstOrDefault() == null ? false : true;//手工报价
                info.EffectiveEnabled = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Data_Effective).FirstOrDefault() == null ? false : true;//体验券
                #endregion

                #region 提货受理权限
                info.TiHuoShouLi = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.TakeGoods).FirstOrDefault() == null ? false : true;//提货受理 (父级)
                info.ShouLiMingXi = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.TakeGoods_AcceptDetail).FirstOrDefault() == null ? false : true;//受理明细
                info.TiHuo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.TakeGoods_TakeGoods).FirstOrDefault() == null ? false : true;//提货
                info.BangDingUser = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.TakeGoods_BindingAccount).FirstOrDefault() == null ? false : true;//绑定账号
                #endregion

                #region 交易管理
                //交易管理(父级)
                info.IsTradeManagerEnabled = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade).FirstOrDefault() == null ? false : true;//交易管理(父级)
                //金生金单
                info.JgjOrder = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_JgjGoods).FirstOrDefault() == null ? false : true;//金生金单
                //买跌单
                info.HuiGouOrder = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_BackGoods).FirstOrDefault() == null ? false : true;//买跌单
                //提货单
                info.TihuoOrder = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_TakeGoods).FirstOrDefault() == null ? false : true;//提货单
                //交割单
                info.DeliverOrder = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_DeliveryGoods).FirstOrDefault() == null ? false : true;//交割单
                //市价定单
                info.AllowViewMarketOrder = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_MarketOrder).FirstOrDefault() == null ? false : true;//市价定单(有效单)
                info.AllowViewMarketOrderChargeback = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_MarketOrder_Chargeback).FirstOrDefault() == null ? false : true;//市价定单--平仓
                info.AllowViewMarketOrderOrderInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_MarketOrder_OrderInfo
                    && p.ParentPrivilegeName == AppPrivilegeConfig.Trade_MarketOrder).FirstOrDefault() == null ? false : true;//市价定单--订单信息

                //限价定单/委托订单
                info.AllowViewPendingOrder = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_PendingOrder).FirstOrDefault() == null ? false : true;//限价定单
                info.AllowViewPendingOrderCancel = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_PendingOrder_Cancel).FirstOrDefault() == null ? false : true;//限价定单--撤销
                info.AllowViewPendingOrderOrderInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_PendingOrder_OrderInfo
                      && p.ParentPrivilegeName == AppPrivilegeConfig.Trade_PendingOrder).FirstOrDefault() == null ? false : true;//限价定单--订单信息
                //平仓历史
                info.AllowViewChargebackRecord = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ChargebackRecode).FirstOrDefault() == null ? false : true;//平仓历史
                info.AllowViewChargebackRecordOrderInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ChargebackRecode_OrderInfo
                     && p.ParentPrivilegeName == AppPrivilegeConfig.Trade_ChargebackRecode).FirstOrDefault() == null ? false : true;//平仓历史--订单信息
                //入库单
                info.AllowViewWarehousing = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_WarehousingOrder).FirstOrDefault() == null ? false : true;//入库单
                //对冲交易
                info.AllowViewHedgingTransactions = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_HedgeTrade).FirstOrDefault() == null ? false : true;//对冲交易
                //导出报表
                info.AllowExportStatement = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ExportStatements).FirstOrDefault() == null ? false : true;//导出报表
                info.AllowExportMarketOrderReport = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ExportStatements_MarketOrderReport).FirstOrDefault() == null ? false : true;//市价单报表
                info.AllowExportPendingOrderReport = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ExportStatements_PendingOrderReport).FirstOrDefault() == null ? false : true;//限价单报表
                info.AllowExportFundReport = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ExportStatements_FundReport).FirstOrDefault() == null ? false : true;//资金报表
                info.AllowExportAdjustReport = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ExportStatements_AdjustReport).FirstOrDefault() == null ? false : true;//导出平仓报表
                //出金处理
                info.TradeChuJin = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ChuJin).FirstOrDefault() == null ? false : true;//出金处理

                info.TradeChuJinDetails = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ChuJin_Details).FirstOrDefault() == null ? false : true;//出入金详情 
                info.TradeChuJinOrderInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_ChuJin_OrderInfo
                && p.ParentPrivilegeName == AppPrivilegeConfig.Trade_ChuJin).FirstOrDefault() == null ? false : true;//出金处理--订单信息
                //解约处理
                info.TradeTermination = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_Termination).FirstOrDefault() == null ? false : true;//解约处理
                info.TradeTerminationApproved = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_Termination_Approved).FirstOrDefault() == null ? false : true;//解约处理--审核解约
                info.TradeTerminationReject = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_Termination_Reject).FirstOrDefault() == null ? false : true;//解约处理--拒绝解约
                info.TradeTerminationOrderInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_Termination_OrderInfo
               && p.ParentPrivilegeName == AppPrivilegeConfig.Trade_Termination).FirstOrDefault() == null ? false : true;//解约处理--订单信息
                //资金报表
                info.AllowFundReport = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_FundReport).FirstOrDefault() == null ? false : true;//资金报表
                info.AllowFundReportOrderInfo = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_FundReport_OrderInfo
               && p.ParentPrivilegeName == AppPrivilegeConfig.Trade_FundReport).FirstOrDefault() == null ? false : true;//资金报表--订单信息
                //会员报表
                info.AllowJujian = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Trade_JujianManager).FirstOrDefault() == null ? false : true;//会员报表

                info.IsCanAlterDJ = list.Where(p => p.PrivilegeName == AppPrivilegeConfig.Account_Client_FundsInfo_Ok).FirstOrDefault() == null ? false : true;//修改冻结资金



                #endregion
            }

            return info;
        }