protected void Page_Load(object sender, EventArgs e)
        {
            loginService.HaveUrlRight(HttpContext.Current.Request.RawUrl);
            SoftPlatformJson = "{'-2':[1,7,4,9],'-46':[4,9] }";

            RestypeHtml = GetResTypeHtml();
            PlatHtml    = GetPlatformHtml(true, 0, true);

            StringBuilder sb    = new StringBuilder();
            var           softs = AvailableSofts.Where(a => a.SoftType == SoftTypeOptions.InternalSoft && (a.ID != 85 && a.ID != 58 && a.ID != 46)).ToList();

            if (softs.Count > 0)
            {
                sb.AppendFormat("<option value='{0}' {2} >{1}</option>", -2, "国内产品", -2 == CookieSoftid ? "selected='selected'" : "");
            }

            var soft2 = AvailableSofts.Where(a => a.SoftType == SoftTypeOptions.InternalSoft && a.ID == 85 || a.ID == 58 || a.ID == 46).ToList();

            if (soft2.Count > 0)
            {
                sb.AppendFormat("<option value='{0}' {2} >{1}</option>", -46, "海外产品", -46 == CookieSoftid ? "selected='selected'" : "");
            }
            SoftHtml = sb.ToString();
            if (softs.Count == 0 && soft2.Count == 0)
            {
                throw new NotRightException();
            }

            SoftAreaJson = GetSoftAreaJson();
            AreaJson     = GetAreaJsonForEnShortName(1);

            BeginTime = DateTime.Now.AddDays(-1);
        }
예제 #2
0
 /// <summary>
 /// 检查权限(检查软件权限)
 /// </summary>
 /// <param name="softid"></param>
 /// <param name="url"></param>
 protected void CheckHasRight(int softid, string url)
 {
     if (!AvailableSofts.Exists(a => a.ID == softid) || !loginService.CheckUrlRight(url))
     {
         throw new NotRightException();
     }
 }
예제 #3
0
        /// <summary>
        /// 验证是否有管理员权限(没有权限抛出NotRightException异常)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="softId"></param>
        /// <returns></returns>
        internal User HaveAdminRightForUserGrantSoft(int userId, int softId)
        {
            User user = HaveAdminRightForUserGrant(userId);

            if (LoginUser.AccountType == UserTypeOptions.ProductAdmin && !AvailableSofts.Exists(a => a.ID == softId))
            {
                throw new NotRightException();
            }
            return(user);
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            loginService.HaveUrlRight(HttpContext.Current.Request.RawUrl);
            //SoftPlatformJson = GetSoftPlatHtmlJson();
            SoftPlatformJson = "{'-2':[1,7,4,9],'-46':[4,9],'113938':[1,7,4,9]}";

            RestypeHtml = GetResTypeHtml();
            PlatHtml    = GetPlatformHtml(true, 0, true);

            StringBuilder sb    = new StringBuilder();
            var           softs = AvailableSofts.Where(a => a.SoftType == SoftTypeOptions.InternalSoft && (a.ID != 85 && a.ID != 58 && a.ID != 46)).ToList();

            if (softs.Count > 0)
            {
                sb.AppendFormat("<option value='{0}' {2} >{1}</option>", -2, "国内产品", -2 == CookieSoftid ? "selected='selected'" : "");
            }
            if (softs.Where(p => p.ID == 113938).Count() > 0)
            {
                sb.AppendFormat("<option value='{0}' {2} >{1}</option>", softs.Where(p => p.ID == 113938).Single().ID, softs.Where(p => p.ID == 113938).Single().Name, -2 == CookieSoftid ? "selected='selected'" : "");
            }

            var soft2 = AvailableSofts.Where(a => a.SoftType == SoftTypeOptions.InternalSoft && a.ID == 85 || a.ID == 58 || a.ID == 46).ToList();

            if (soft2.Count > 0)
            {
                sb.AppendFormat("<option value='{0}' {2} >{1}</option>", -46, "海外产品", -46 == CookieSoftid ? "selected='selected'" : "");
            }
            SoftHtml = sb.ToString();
            if (softs.Count == 0 && soft2.Count == 0)
            {
                throw new NotRightException();
            }

            SoftAreaJson = GetSoftAreaJson();
            sb           = new StringBuilder();

            List <KeyValueModel> list = B_BaseToolService.Instance.GetResCateCache(2)
                                        .Where(p => p.PCID == 0 && p.ResType == 1)
                                        .Select(p => new KeyValueModel {
                ID = p.CID.ToString(), Value = p.CName
            })
                                        .ToList();

            sb.AppendFormat("<option  value='{0}' selected='selected'>{1}</option>", -1, "不区分大分类");
            for (int i = 0; i < list.Count; i++)
            {
                sb.AppendFormat("<option  value='{0}'>{1}</option>", list[i].ID, list[i].Value);
            }
            ParentCategoryHtml = sb.ToString();

            BeginTime = DateTime.Now.AddDays(-1);
        }
예제 #5
0
        /// <summary>
        /// 获取指定用户指定产品的渠道列表
        /// </summary>
        /// <param name="softId"></param>
        /// <param name="platforms"></param>
        /// <param name="includeChannelIds">是否包含渠道ID</param>
        /// <returns></returns>
        public List <Channel> GetAvailableChannels(int softId, MobileOption[] platforms, bool includeChannelIds)
        {
            if (!AvailableSofts.Exists(a => a.ID == softId))
            {
                return(new List <Channel>());
            }

            if (LoginUser.AccountType == UserTypeOptions.Channel || LoginUser.AccountType == UserTypeOptions.ChannelPartner)
            {
                string cacheKey = string.Format("net91com.Reports.UserRights.URLoginService.GetAvailableChannels_{0}_{1}", LoginUser.ID, softId);
                if (CacheHelper.Contains(cacheKey))
                {
                    return(CacheHelper.Get <List <Channel> >(cacheKey));
                }

                List <Channel> channels = DAChannelsHelper.GetChannels(LoginUser.ID, softId);
                CacheHelper.Set <List <Channel> >(cacheKey, channels, CacheTimeOption.TenMinutes, CacheExpirationOption.AbsoluteExpiration);
                return(channels);
            }
            else
            {
                List <Channel> channels;
                string         cacheKey = string.Format("net91com.Reports.UserRights.URLoginService.GetAvailableChannels_{0}_{1}", softId, includeChannelIds);
                if (CacheHelper.Contains(cacheKey))
                {
                    channels = CacheHelper.Get <List <Channel> >(cacheKey);
                }
                else
                {
                    channels = DAChannelsHelper.GetChannels(softId, includeChannelIds);
                    CacheHelper.Set <List <Channel> >(cacheKey, channels, CacheTimeOption.TenMinutes, CacheExpirationOption.AbsoluteExpiration);
                }
                if (!includeChannelIds || platforms == null || platforms.Length == 0 ||
                    platforms.Contains(MobileOption.None))
                {
                    return(channels);
                }

                List <Channel> result = new List <Channel>();
                for (int i = 0; i < channels.Count; i++)
                {
                    if (channels[i].Platform == MobileOption.None || platforms.Contains(channels[i].Platform))
                    {
                        result.Add(channels[i]);
                    }
                }
                return(result);
            }
        }
예제 #6
0
        /// <summary>
        /// 获取用户渠道ID权限
        /// </summary>
        /// <param name="softId"></param>
        /// <param name="channelType"></param>
        /// <param name="channels"></param>
        /// <param name="mustLogin">有些地方不需要登录也可以请求</param>
        /// <returns></returns>
        public List <int> GetAvailableChannelIds(int softId, ChannelTypeOptions channelType, int[] channels, bool mustLogin = true)
        {
            if (mustLogin)
            {
                if (!AvailableSofts.Exists(a => a.ID == softId))
                {
                    return(new List <int>());
                }

                if (LoginUser.AccountType == UserTypeOptions.Channel ||
                    LoginUser.AccountType == UserTypeOptions.ChannelPartner)
                {
                    return(DAChannelsHelper.GetChannelIds(LoginUser.ID, softId, channelType, channels));
                }
            }
            return(DAChannelsHelper.GetChannelIds(softId, channelType, channels));
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            loginService.HaveUrlRight(HttpContext.Current.Request.RawUrl);
            SoftPlatformJson = "{'-2':[1,7,4,9],'-46':[4,9] }";

            RestypeHtml = GetResTypeHtml();
            PlatHtml    = GetPlatformHtml(true, 0, true);

            StringBuilder sb    = new StringBuilder();
            var           softs = AvailableSofts.Where(a => a.SoftType == SoftTypeOptions.InternalSoft && (a.ID != 85 && a.ID != 58 && a.ID != 46)).ToList();

            if (softs.Count > 0)
            {
                sb.AppendFormat("<option value='{0}' {2} >{1}</option>", -2, "国内产品", -2 == CookieSoftid ? "selected='selected'" : "");
            }

            var soft2 = AvailableSofts.Where(a => a.SoftType == SoftTypeOptions.InternalSoft && a.ID == 85 || a.ID == 58 || a.ID == 46).ToList();

            if (soft2.Count > 0)
            {
                sb.AppendFormat("<option value='{0}' {2} >{1}</option>", -46, "海外产品", -46 == CookieSoftid ? "selected='selected'" : "");
            }
            SoftHtml = sb.ToString();
            if (softs.Count == 0 && soft2.Count == 0)
            {
                throw new NotRightException();
            }

            SoftAreaJson = GetSoftAreaJson();
            AreaJson     = GetAreaJson();

            // key = string.Format("N_StatDownRank_{0}_StatDate{1}", period, ProjectSourceType == 2 ? "_46" : "");
            BeginTime = ToolService.Instance.GetEltStates("N_StatDownRank_Daily_StatDate_46");
            DateTime BegintTimeChina = ToolService.Instance.GetEltStates("N_StatDownRank_Daily_StatDate");

            if (BeginTime.Year != 1 || BegintTimeChina.Year != 1)
            {
                BeginTime = (BeginTime < BegintTimeChina ? BegintTimeChina : BeginTime).AddDays(-1);
            }
            else
            {
                BeginTime = new DateTime().AddYears(-20).AddDays(-1);
            }
        }
예제 #8
0
        public void GetExcelNewUser()
        {
            try
            {
                net91com.Stat.Core.PeriodOptions Period = HttpContext.Current.Request["inputzhouqi"].ToEnum <net91com.Stat.Core.PeriodOptions>(net91com.Stat.Core.PeriodOptions.Daily);
                DateTime begintime   = Convert.ToDateTime(HttpContext.Current.Request["inputtimestart"]);
                DateTime endtime     = Convert.ToDateTime(HttpContext.Current.Request["inputtimeend"]);
                int      excelsoft   = Convert.ToInt32(HttpContext.Current.Request["excelsoft"]);
                int      channelcate = Convert.ToInt32(HttpContext.Current.Request["channelcate"]);
                int      channeltype = Convert.ToInt32(HttpContext.Current.Request["channeltype"]);
                ///检查权限
                CheckHasRight(excelsoft, "Reports/NewUserReport.aspx");

                int excelplatform = Convert.ToInt32(HttpContext.Current.Request["excelplatform"]);
                SetStandardTime(Period, begintime, endtime);
                List <SoftUser> users;
                if (channelcate == -1)
                {
                    if (Period != net91com.Stat.Core.PeriodOptions.Hours && Period != net91com.Stat.Core.PeriodOptions.TimeOfDay)
                    {
                        users = Sjqd_StatUsersService.GetInstance().GetSoftUserListCache(begintime, endtime, excelsoft, (int)excelplatform, Period, loginService, CacheTimeOption.TenMinutes).OrderByDescending(p => p.StatDate).ToList();
                    }
                    else
                    {
                        //users = StatUsersByHourService.GetInstance().GetHourUserDataCache(excelsoft, excelplatform, begintime, endtime, Period, loginService,CacheTimeOption.TenMinutes).OrderByDescending(p => p.StatDate).ToList();
                        net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService();
                        List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers>         ssUsers;
                        ssUsers = suService.GetStatUsersByHour(excelsoft, excelplatform, ChannelTypeOptions.Category, 0, (int)Period, begintime, endtime);
                        users   = new List <SoftUser>();
                        foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers)
                        {
                            SoftUser softuser = new SoftUser();
                            softuser.StatDate  = u.StatDate;
                            softuser.SoftId    = excelsoft;
                            softuser.Platform  = excelplatform;
                            softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount;
                            softuser.Hour      = u.StatHour;
                            softuser.NewNum    = u.NewUserCount;
                            softuser.UseNum    = u.ActiveUserCount;
                            users.Add(softuser);
                        }
                        users = users.OrderBy(p => p.StatDate).ToList();
                    }
                }
                else
                {
                    if (Period != net91com.Stat.Core.PeriodOptions.Hours && Period != net91com.Stat.Core.PeriodOptions.TimeOfDay)
                    {
                        users = Sjqd_StatUsersByChannelsService.GetInstance().GetSoftUserChanelListCache(begintime, endtime, excelsoft, excelplatform, Period,
                                                                                                         (ChannelTypeOptions)channeltype, channelcate, "", false, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList();
                    }
                    else
                    {
                        net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService();
                        List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers>         ssUsers;
                        ssUsers = suService.GetStatUsersByHour(excelsoft, excelplatform, (ChannelTypeOptions)channeltype, channelcate, (int)Period, begintime, endtime);
                        users   = new List <SoftUser>();
                        foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers)
                        {
                            SoftUser softuser = new SoftUser();
                            softuser.StatDate  = u.StatDate;
                            softuser.SoftId    = excelsoft;
                            softuser.Platform  = excelplatform;
                            softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount;
                            softuser.Hour      = u.StatHour;
                            softuser.NewNum    = u.NewUserCount;
                            softuser.UseNum    = u.ActiveUserCount;
                            users.Add(softuser);
                        }
                        users = users.OrderBy(p => p.StatDate).ToList();
                    }
                }
                HttpResponse resp;
                resp = HttpContext.Current.Response;
                resp.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
                string filename = "新增用户.xls";

                AddHead(filename);

                //是否是内部软件
                bool isInternalSoft = AvailableSofts.FirstOrDefault(a => a.ID == excelsoft) != null;
                resp.Write(TableTemplateHelper.BuildStatUsersTable(excelsoft, (MobileOption)excelplatform, isInternalSoft, channelcate != -1, Period, "new", false, users, true, 0, ""));
                resp.End();
            }
            catch (Exception)
            {
                HttpContext.Current.Response.Write("");
            }
        }