示例#1
0
        static int GetUserSupp(int userId, int typeId)
        {
            int suppid = -1;

            var typeUserConf = ChannelTypeUsers.GetCacheModel(userId, typeId);

            if (typeUserConf != null && typeUserConf.suppid.HasValue)
            {
                if (typeUserConf.suppid.Value > 0)
                {
                    suppid = typeUserConf.suppid.Value;
                }
            }
            return(suppid);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="typeId"></param>
        /// <returns></returns>
        public static ChannelTypeUserInfo GetCacheModel(int userId, int typeId)
        {
            DataTable data = ChannelTypeUsers.GetList(userId, true);

            if (data == null || data.Rows.Count <= 0)
            {
                return(null);
            }

            DataRow[] chanelUser = data.Select("typeId=" + typeId.ToString());
            if (chanelUser != null && chanelUser.Length > 0)
            {
                return(GetModelFromRow(chanelUser[0]));
            }
            return(null);
        }
示例#3
0
        /// <summary>
        /// 系统通道状态 包括后台对用户的设置,通道本身的开户状态
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="chanelNo"></param>
        /// <param name="typeId"></param>
        /// <param name="defaultvalue"></param>
        /// <returns></returns>
        public static bool GetSysOpenStatus(int userId, int typeId, bool defaultvalue)
        {
            bool result = defaultvalue;
            ChannelTypeUserInfo typeuserinfo = ChannelTypeUsers.GetCacheModel(userId, typeId);

            if (typeuserinfo == null)
            {
                return(result);
            }

            /*系统设置状态*/
            if (typeuserinfo.sysIsOpen.HasValue)
            {
                result = typeuserinfo.sysIsOpen.Value;
            }
            return(result);
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="typeId"></param>
        /// <param name="defaultvalue"></param>
        /// <returns></returns>
        public static int GetUserOpenStatus(int userId, int typeId, int defaultvalue)
        {
            int result = defaultvalue;
            ChannelTypeUserInfo typeuserinfo = ChannelTypeUsers.GetCacheModel(userId, typeId);

            if (typeuserinfo == null)
            {
                return(result);
            }

            /*用户设置状态*/
            if (typeuserinfo.userIsOpen.HasValue)
            {
                result = typeuserinfo.userIsOpen.Value ? 1 : 0;
            }

            return(result);
        }
示例#5
0
        /// <summary>
        /// 两者同时为1才 为开启
        /// </summary>
        /// <param name="typeStatus">类型状态</param>
        /// <param name="userId">用户ID</param>
        /// <param name="chanelNo">通道</param>
        /// <param name="typeId">通道类型ID</param>
        /// <returns></returns>
        public static int GetChanelSysStatus(int typeStatus, int userId, string chanelNo, int typeId, ref int suppid)
        {
            suppid = -1;

            int result          = 0;
            int chanelValue     = -1;
            int sysSettingValue = -1;

            ChannelInfo channelInfo = null;

            if (!string.IsNullOrEmpty(chanelNo))
            {
                channelInfo = Channel.GetCacheModel(chanelNo);
            }

            ChannelTypeUserInfo typeUserConf = ChannelTypeUsers.GetCacheModel(userId, typeId);

            if (channelInfo != null && channelInfo.isOpen.HasValue)
            {
                chanelValue = channelInfo.isOpen.Value;
            }

            if (typeUserConf != null)
            {
                if (typeUserConf.sysIsOpen.HasValue)
                {
                    sysSettingValue = typeUserConf.sysIsOpen.Value ? 1 : 0;
                }

                if (typeUserConf.suppid.HasValue)
                {
                    if (typeUserConf.suppid.Value > 0)
                    {
                        suppid = typeUserConf.suppid.Value;
                    }
                }
            }

            //默认是关闭
            if (typeStatus == 4)
            {
                if (chanelValue == -1)
                {
                    chanelValue = 0;
                }
                if (sysSettingValue == -1)
                {
                    sysSettingValue = 0;
                }
            }
            //默认是开启
            else if (typeStatus == 8)
            {
                if (chanelValue == -1)
                {
                    chanelValue = 1;
                }
                if (sysSettingValue == -1)
                {
                    sysSettingValue = 1;
                }
            }

            //同时开启才开启
            if (chanelValue == 1 && sysSettingValue == 1)
            {
                result = 1;
            }
            return(result);
        }