/// <summary>
        ///     获取留存数据(返回的每个list 都不会是空列表)
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public List <List <Sjqd_StatRetainedUsers> > GetData(HttpContext context, ref List <DateTime> x_DateTime)
        {
            int      channelid = Convert.ToInt32(context.Request["channelid"]);
            int      softid    = Convert.ToInt32(context.Request["softs"]);
            int      platform  = Convert.ToInt32(context.Request["platform"]);
            int      period    = Convert.ToInt32(context.Request["period"]);
            DateTime begin     = Convert.ToDateTime(context.Request["begintime"]);
            DateTime end       = Convert.ToDateTime(context.Request["endtime"]);

            Sjqd_ChannelCustomers node = new CfgChannelService().GetChannelCustomer(channelid);

            if (begin > end || node == null || (end - begin).TotalDays > 93)
            {
                return(new List <List <Sjqd_StatRetainedUsers> >());
            }
            //2点后才开放当天的
            DateTime stattime =
                EtlStates_DataAccess.Instance.GetNowStatTimeByKey("StatUsers_Daily_StatDate", 0).AddDays(-1);

            //下午两点才能开放出去
            if (end >= stattime && (DateTime.Now < stattime.AddHours(38)))
            {
                end = stattime.AddDays(-1);
            }
            //若渠道商设置了最小时间
            if (begin < node.MinViewTime)
            {
                begin = node.MinViewTime;
            }
            List <Sjqd_StatRetainedUsers> lists = Sjqd_StatRetainedUsersService.
                                                  Instance.GetChannelRetainedUsersForOutByCache(softid, (MobileOption)platform,
                                                                                                ChannelTypeOptions.Customer, channelid, period, begin, end,
                                                                                                node.MinViewTime)
                                                  .ToList();

            x_DateTime = lists.Select(p => p.StatDate).Distinct().ToList();
            List <DateTime> tempOriginalDate = lists.Select(p => p.OriginalDate).Distinct().ToList();

            //增加一个起始点,最后一个点是 日期最小点
            if (tempOriginalDate.Count != 0)
            {
                x_DateTime.Insert(0, tempOriginalDate[tempOriginalDate.Count - 1]);
            }

            var listAll = new List <List <Sjqd_StatRetainedUsers> >();

            foreach (DateTime item in tempOriginalDate)
            {
                List <Sjqd_StatRetainedUsers> tempUserbyOriginalDate =
                    lists.Where(p => p.OriginalDate == item).OrderBy(p => p.StatDate).Take(6).ToList();
                if (tempUserbyOriginalDate.Count != 0)
                {
                    listAll.Add(tempUserbyOriginalDate);
                }
            }
            return(listAll);
        }
        public override bool Check(object obj)
        {
            var req = (HttpRequest)obj;

            try
            {
                string   customIdAndPlat = CryptoHelper.DES_Decrypt(req["p"], "$retain^");
                string[] strs            = customIdAndPlat.Split(new[] { '&' }, StringSplitOptions.None);
                int      channelId       = Convert.ToInt32(strs[0]);
                int      platform        = Convert.ToInt32(strs[1]);
                DateTime begin           = Convert.ToDateTime(req["begintime"]);
                DateTime end             = Convert.ToDateTime(req["endtime"]);
                var      platformList    = new List <int> {
                    0, 1, 4, 7, 9, 255
                };
                if (channelId <= 0 || !platformList.Contains(platform))
                {
                    return(false);
                }
                Sjqd_ChannelCustomers node = new CfgChannelService().GetChannelCustomer(channelId);
                //渠道商要存在
                if (node == null)
                {
                    return(false);
                }
                //渠道商留存要开放出去,并且对外可看
                if (!(node.ReportType == 1 && node.ShowType == 2))
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        protected DataTable GetTable(HttpContext context)
        {
            DateTime begintime = Convert.ToDateTime(context.Request["begintime"]);
            DateTime endtime   = Convert.ToDateTime(context.Request["endtime"]);
            int      soft      = Convert.ToInt32(context.Request["softs"]);
            int      platform  = Convert.ToInt32(context.Request["platform"]);
            int      channelid = Convert.ToInt32(context.Request["channelid"]);

            DataTable dtresult = null;
            //没有此软件权限
            List <Channel>        rights = LoginService.GetAvailableChannels(soft, null, false);
            Sjqd_ChannelCustomers node   = new CfgChannelService().GetChannelCustomer(channelid);

            if (node == null || !LoginService.AvailableSofts.Exists(a => a.ID == soft) ||
                !rights.Exists(p => p.ChannelType == ChannelTypeOptions.Customer && p.ID == channelid))
            {
                dtresult = new DataTable();
            }
            else
            {
                DateTime stattime =
                    EtlStates_DataAccess.Instance.GetNowStatTimeByKey("StatUsers_Daily_StatDate", 0).AddDays(-1);
                //下午两点才能开放出去
                if (endtime >= stattime && (DateTime.Now < stattime.AddHours(38)))
                {
                    endtime = stattime.AddDays(-1);
                }
                if (begintime < node.MinViewTime)
                {
                    begintime = node.MinViewTime;
                }

                dtresult = ChannelCustomUsers_DataAccess.Instance.GetChannelCustomTables(channelid, soft, platform,
                                                                                         begintime, endtime);
            }
            return(dtresult);
        }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         P = Request["p"];
         var      p_Result  = net91com.Common.CryptoHelper.DES_Decrypt(Request["p"], "$retain^");
         string[] strs      = p_Result.Split(new char[] { '&' }, StringSplitOptions.None);
         int      channelId = Convert.ToInt32(strs[0]);
         int      platform  = Convert.ToInt32(strs[1]);
         var      node      = new CfgChannelService().GetChannelCustomer(channelId);
         CustomerName = node.Name;
         PlatName     = GetPlatName(platform);
         //渠道商留存要开放出去,并且对外可看
         if (!(node.ReportType == 1 && node.ShowType == 2))
         {
             Response.End();
         }
     }
     catch (Exception)
     {
         Response.Write("无权访问");
         Response.End();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            loginService.HaveUrlRight("Reports/SoftVersionSjqd.aspx");

            //设置周期及默认周期
            PeriodSelector1.AddPeriods(
                new net91com.Stat.Core.PeriodOptions[] {
                net91com.Stat.Core.PeriodOptions.NaturalMonth,
                net91com.Stat.Core.PeriodOptions.Weekly,
                net91com.Stat.Core.PeriodOptions.Daily
            },
                net91com.Stat.Core.PeriodOptions.Daily);
            Period = PeriodSelector1.SelectedPeriod;
            //外部传递过来
            if (!string.IsNullOrEmpty(Request["Channelid"]) && !string.IsNullOrEmpty(Request["Channeltype"]))
            {
                ChannelID.Value   = Request["Channelid"];
                ChannelType.Value = Request["Channeltype"];
            }

            channelId  = Convert.ToInt32(ChannelID.Value);
            customType = Convert.ToInt32(ChannelType.Value);
            //所有产品
            mySupportSoft = AvailableSofts;

            if (customType == (int)ChannelTypeOptions.Category)
            {
                var node = new CfgChannelService().GetChannelCategory(channelId);
                softsid        = node.SoftID;
                Name.InnerHtml = node.Name;
            }
            else
            {
                var node = new CfgChannelService().GetChannelCustomer(channelId);
                softsid        = node.SoftID;
                Name.InnerHtml = node.Name;
            }
            //没有权限
            var softinfo = mySupportSoft.Find(p => p.ID == softsid);

            if (softinfo == null)
            {
                RedirectNoright();
            }
            MySupportPlat = softinfo.Platforms;

            if (fromtime.Value == "" || totime.Value == "")
            {
                endtime        = ds.GetMaxTimeCache(net91com.Stat.Core.PeriodOptions.Daily, ReportType.UserUseNewActivity, CacheTimeOption.TenMinutes);
                endtime        = endtime.Date;
                begintime      = endtime.AddDays(-30);
                fromtime.Value = begintime.ToString("yyyy-MM-dd");
                totime.Value   = endtime.ToString("yyyy-MM-dd");
            }
            else
            {
                begintime = Convert.ToDateTime(fromtime.Value);
                endtime   = Convert.ToDateTime(totime.Value);
            }


            //绑定数据
            BindData();
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                channelId = Convert.ToInt32(net91com.Common.CryptoHelper.DES_Decrypt(Request["p"], "ndwebweb"));
                if (channelId <= 0)
                {
                    ShowErrorMsg("无权访问!");
                }
                platformsid = Convert.ToInt32(Request["plat"]);
            }
            catch (Exception)
            {
                ShowErrorMsg("无权访问!");
                return;
            }
            var node = new CfgChannelService().GetChannelCustomer(channelId);

            if (node == null)
            {
                ShowErrorMsg("该渠道商不存在!");
                return;
            }

            //之所以不从SjqdUtility 那个缓存中取,是缓存数据可能不一致
            int reporttype = node.ReportType;

            if (reporttype != 1)
            {
                ShowErrorMsg("无权访问!");
                return;
            }
            softsid     = node.SoftID;
            channelName = node.Name;
            soft        = new URBasicInfoService().GetSoft(softsid);

            //2014-7-17 lyq 黄金妹认为直接修改platid参数值来查看不同平台的量是一种BUG,
            //但基于保持原来逻辑的一致性,现关闭91助手(手机版)给合作方的"不区分平台"和"AndroidPad"数据。
            if (soft.ID == 2 && (platformsid == 0 || platformsid == 9))
            {
                ShowErrorMsg("无权访问!");
                return;
            }

            //海外的产品跳转到海外分国家页面
            if (soft.ID == 58 || soft.ID == 46 || soft.ID == 85)
            {
                Response.Redirect("AnalysisForChannelV2En.aspx?" + Request.QueryString);
            }

            DateTime dtrighttime = ds.GetMaxChannelUserTimeCache(softsid, MobileOption.None, net91com.Stat.Core.PeriodOptions.Daily, CacheTimeOption.TenMinutes);

            if (fromtime.Value == "" || totime.Value == "")
            {
                endtime            = dtrighttime;
                begintime          = endtime.AddDays(-30);
                fromtime.Value     = begintime.ToString("yyyy-MM-dd");
                totime.Value       = endtime.ToString("yyyy-MM-dd");
                softName.InnerHtml = soft.Name;
            }
            else
            {
                begintime = Convert.ToDateTime(fromtime.Value);
                endtime   = Convert.ToDateTime(totime.Value);
            }
            if (begintime < node.MinViewTime)
            {
                begintime = node.MinViewTime;
            }
            //下午两点才能开放出去
            if (endtime >= dtrighttime && (DateTime.Now < dtrighttime.AddHours(38)))
            {
                endtime = dtrighttime.AddDays(-1);
            }
            if (begintime > endtime)
            {
                begintime = endtime;
            }

            //特殊逻辑,黄金妹要求,将91助手(手机)和安卓市场的对外数据仅提供到2014.9.30止
            if ((soft.ID == 2 || soft.ID == 51) && endtime >= new DateTime(2014, 10, 1))
            {
                endtime   = new DateTime(2014, 9, 30);
                begintime = endtime.AddDays(-30);
                if (begintime < node.MinViewTime)
                {
                    begintime = node.MinViewTime;
                }
                if (begintime > endtime)
                {
                    ShowErrorMsg("无权访问!");
                    return;
                }
            }

            fromtime.Value = begintime.ToString("yyyy-MM-dd");
            totime.Value   = endtime.ToString("yyyy-MM-dd");
            channelCustomName.InnerText = channelName;
            if (platformsid <= 0)
            {
                paltName.InnerHtml = "不区分平台";
            }
            else
            {
                paltName.InnerHtml = ((MobileOption)platformsid).GetDescription();
            }
            BindData();
        }
Exemplo n.º 7
0
        protected void GetQueryString()
        {
            //Request["channeltype"] ==1 就是分类id了
            if (!string.IsNullOrEmpty(Request["channelid"]) && !string.IsNullOrEmpty(Request["channeltype"]))
            {
                channelId = Convert.ToInt32(Request["channelid"]);
                string name = "";
                //传过来是分类
                if (Request["channeltype"] != "1")
                {
                    var temp = new CfgChannelService().GetChannelCustomer(channelId);
                    softsid = temp.SoftID;
                    name    = temp.Name;
                    HeadControl1.Channel1.ParentId = temp.PID == 0 ? "Categorie_" + temp.CID : "Customer_" + temp.PID;
                }
                else
                {
                    var temp = new CfgChannelService().GetChannelCategory(channelId);
                    ;
                    softsid = temp.SoftID;
                    name    = temp.Name;
                    HeadControl1.Channel1.ParentId = "0";
                }
                //没有权限
                var softinfo = AvailableSofts.Find(p => p.ID == softsid);
                if (softinfo == null)
                {
                    Response.Redirect("/Reports/NoRight.aspx");
                }
                else
                {
                    HeadControl1.SoftID = softinfo.ID.ToString();
                    PlatformsidList     = new List <int> {
                        paraPlat
                    };
                    HeadControl1.PlatID                 = PlatformsidList[0].ToString();
                    EndTime                             = ds.GetMaxTimeCache(Period, ReportType.UserUseNewActivity, CacheTimeOption.TenMinutes);
                    BeginTime                           = EndTime.AddDays(-30);
                    inputzhouqi.Value                   = Period.GetDescription();
                    HeadControl1.BeginTime              = BeginTime;
                    HeadControl1.EndTime                = EndTime;
                    HeadControl1.Channel1.SoftId        = HeadControl1.SoftID;
                    HeadControl1.Channel1.Platform      = HeadControl1.PlatID;
                    HeadControl1.Channel1.SelectedValue = channelId.ToString();
                    HeadControl1.Channel1.SelectedText  = name;
                    HeadControl1.Channel1.SelectedCate  = Request["channeltype"];
                    //记住查看用户类型
                    usercate.Value = usercateType.ToString();
                }
            }
            //不是其他页面通过中间页面跳转过来的
            else
            {
                if (HeadControl1.IsFirstLoad)
                {
                    EndTime     =
                        EndTime =
                            ds.GetMaxTimeCache(Period, ReportType.UserUseNewActivity, CacheTimeOption.TenMinutes);
                    BeginTime       = EndTime.AddDays(-30);
                    softsid         = CookieSoftid;
                    PlatformsidList = new List <int> {
                        CookiePlatid
                    };
                    HeadControl1.PlatID            = PlatformsidList[0].ToString();
                    HeadControl1.SoftID            = softsid.ToString();
                    inputzhouqi.Value              = Period.GetDescription();
                    HeadControl1.BeginTime         = BeginTime;
                    HeadControl1.EndTime           = EndTime;
                    HeadControl1.Channel1.SoftId   = HeadControl1.SoftID.ToString();
                    HeadControl1.Channel1.Platform = HeadControl1.PlatID.ToString();
                }
                else
                {
                    BeginTime = HeadControl1.BeginTime;
                    EndTime   = HeadControl1.EndTime;
                    softsid   = Convert.ToInt32(HeadControl1.SoftID);
                    var platformsids = HeadControl1.PlatID.Split(',');
                    foreach (string item in platformsids)
                    {
                        PlatformsidList.Add(Convert.ToInt32(item));
                    }
                    SetRequestCookie(softsid, PlatformsidList[0]);
                }
                HeadControl1.Channel1.PeriodCheck = false;
            }
            //开启对比功能
            HeadControl1.HiddenCompareTime = false;

            /////有渠道商权限
            //LimitChannelCustom(Convert.ToInt32(HeadControl1.Channel1.SoftId));
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //selectcountry = string.IsNullOrEmpty(Request["mycountry"]) ? "0" : Request["mycountry"];
            //List<string> countries = cubaService.GetAllCountries(CacheTimeOption.HalfDay);

            selectCountryId = Request["mycountry"] ?? string.Empty;

            List <B_AreaEntity> areaList = B_BaseToolService.Instance.GetCountriesCache();
            StringBuilder       sb       = new StringBuilder("<option value=\"\" select=\"selected\">不区分国家</option>");

            foreach (var country in areaList)
            {
                sb.AppendFormat("<option value=\"{0}\"{1}>{2}</option>", country.EnShortName, selectCountryId == country.EnShortName ? " selected=\"selected\"" : "", country.Name);
            }
            countryHtml = sb.ToString();
            try
            {
                channelId = Convert.ToInt32(net91com.Common.CryptoHelper.DES_Decrypt(Request["p"], "ndwebweb"));
                if (channelId <= 0)
                {
                    ShowErrorMsg("无权访问");
                }
                platformsid = Convert.ToInt32(Request["plat"]);
            }
            catch (Exception)
            {
                ShowErrorMsg("无权访问");
                return;
            }
            var node = new CfgChannelService().GetChannelCustomer(channelId);

            if (node == null)
            {
                ShowErrorMsg("该渠道商不存在!");
                return;
            }
            //之所以不从SjqdUtility 那个缓存中取,是缓存数据可能不一致
            int reporttype = node.ReportType;

            if (reporttype != 1)
            {
                ShowErrorMsg("无权访问!");
                return;
            }
            softsid     = node.SoftID;
            channelName = node.Name;
            soft        = new URBasicInfoService().GetSoft(softsid);
            DateTime dtrighttime = ds.GetMaxChannelUserTimeCache(softsid, MobileOption.None, net91com.Stat.Core.PeriodOptions.Daily, CacheTimeOption.TenMinutes);

            if (fromtime.Value == "" || totime.Value == "")
            {
                endtime            = dtrighttime;
                begintime          = endtime.AddDays(-30);
                fromtime.Value     = begintime.ToString("yyyy-MM-dd");
                totime.Value       = endtime.ToString("yyyy-MM-dd");
                softName.InnerHtml = soft.Name;
            }
            else
            {
                begintime = Convert.ToDateTime(fromtime.Value);
                endtime   = Convert.ToDateTime(totime.Value);
            }
            if (begintime < node.MinViewTime)
            {
                begintime = node.MinViewTime;
            }
            //下午两点才能开放出去
            if (endtime >= dtrighttime && (DateTime.Now < dtrighttime.AddHours(38)))
            {
                endtime = dtrighttime.AddDays(-1);
            }
            if (begintime > endtime)
            {
                begintime = endtime;
            }
            fromtime.Value = begintime.ToString("yyyy-MM-dd");
            totime.Value   = endtime.ToString("yyyy-MM-dd");
            channelCustomName.InnerText = channelName;
            if (platformsid <= 0)
            {
                paltName.InnerHtml = "不区分平台";
            }
            else
            {
                paltName.InnerHtml = ((MobileOption)platformsid).GetDescription();
            }
            BindData();
        }