private void Bind() { QueryGroupInfo query = new QueryGroupInfo(); query.TimeStart = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-01")); query.GroupBy = "AdId"; query.OrderBy = " AdId desc "; query.AdUserID = Account.UserId; DataTable table = LogBrowseAnalysisBLL.Instance.GetAnalysis(query); VirAdBrowsePara adp = new VirAdBrowsePara(); for (int i = 0; i < table.Rows.Count; i++) { int AdId = int.Parse(table.Rows[i]["AdId"].ToString()); int ipcount = int.Parse(table.Rows[i]["ipcount"].ToString()); adp.AdId = AdId; var list = VirAdBrowseBLL.Instance.GetModels(adp); foreach (var item in list) { ipcount += item.IpCount; } table.Rows[i]["ipcount"] = ipcount; } rptTable.DataSource = table; rptTable.DataBind(); }
private void Bind() { FlowInfo flow = new FlowInfo(); flow.Time = DateTime.Parse(txtTime.Value); if (!string.IsNullOrEmpty(ddlAdPage.SelectedValue)) { flow.AdId = int.Parse(ddlAdPage.SelectedValue); } ltStime.Text = flow.Time.ToString("yyyy-MM-dd"); ltAdTitle.Text = ddlAdPage.SelectedItem.Text; QueryGroupInfo query = new QueryGroupInfo(); query.Time = DateTime.Parse(txtTime.Value); query.GroupBy = " time "; DataTable table = LogBrowseAnalysisBLL.Instance.GetAnalysis(query); if (table.Rows.Count != 0) { ltIp.Text = table.Rows[0]["ipcount"].ToString(); ltPv.Text = table.Rows[0]["pvcount"].ToString(); ltUv.Text = table.Rows[0]["uvcount"].ToString(); ltIp1.Text = table.Rows[0]["ipcount"].ToString(); ltPv1.Text = table.Rows[0]["pvcount"].ToString(); ltUv1.Text = table.Rows[0]["uvcount"].ToString(); } else { ltIp.Text = "0"; ltPv.Text = "0"; ltUv.Text = "0"; ltIp1.Text = "0"; ltPv1.Text = "0"; ltUv1.Text = "0"; } DataTable table1 = LogBrowseAnalysisBLL.Instance.GetBrowseHour(query); int hour = int.Parse(DateTime.Now.ToString("HH")); if (flow.Time.ToString("yyyyMMdd") != DateTime.Now.ToString("yyyyMMdd")) { hour = 24; } var chart = ChartComonBLL.GetAdBrowseHour(table1, hour); hidDataJson.Value = DN.Framework.Utility.Serializer.SerializeObject(chart); rptTable.DataSource = table1; rptTable.DataBind(); }
/// <summary> /// 通用汇总,groupby必须填写 /// </summary> /// <param name="flow"></param> /// <returns></returns> public DataTable GetAnalysis(QueryGroupInfo flow) { StringBuilder sb = new StringBuilder(); if (flow.AdId.HasValue) { sb.AppendFormat(" and AdId = {0} ", flow.AdId); } if (flow.FlowUserId.HasValue) { sb.AppendFormat(" and FlowUserId = {0} ", flow.FlowUserId); } if (flow.AdUserID.HasValue) { sb.AppendFormat(" and AdUserId = {0} ", flow.AdUserID); } if (flow.Time.HasValue) { sb.AppendFormat(" and time = {0} ", flow.Time.Value.ToString("yyyyMMdd")); } if (flow.TimeStart.HasValue) { sb.AppendFormat(" and time >= {0} ", flow.TimeStart.Value.ToString("yyyyMMdd")); } if (flow.TimeEnd.HasValue) { sb.AppendFormat(" and time <= {0} ", flow.TimeEnd.Value.ToString("yyyyMMdd")); } string orderby = ""; if (!string.IsNullOrEmpty(flow.OrderBy)) { orderby = " order by " + flow.OrderBy; } string cmd = string.Format(@" select {1} ,count(*) as pvcount ,count(distinct(clientid)) as uvcount ,count(distinct(clientip)) as ipcount ,count(distinct(clientid)) /count(*) as useravg from [LogBrowseHistory] where 1=1 {0} group by {1} {2}", sb, flow.GroupBy, orderby); ChartPara cp = new ChartPara(); cp.CommandText = cmd; DataTable table = acc.GetTable(cp); return(table); }
private void Bind(int pageIndex = 1) { QueryGroupInfo query = new QueryGroupInfo(); query.AdUserID = Account.UserId; query.GroupBy = "time"; var list = AnalysisBLL.Instance.GetAnalysis(query); rptTable.DataSource = list; rptTable.DataBind(); }
private void Bind(int pageIndex = 1) { QueryGroupInfo query = new QueryGroupInfo(); query.AdId = int.Parse(hidAdId.Value); query.GroupBy = "time"; var list = AnalysisBLL.Instance.GetAnalysis(query); rptTable.DataSource = list; rptTable.DataBind(); }
private void Bind() { QueryGroupInfo query = new QueryGroupInfo(); query.AdId = int.Parse(hidAdId.Value); query.GroupBy = "Time,AdId"; query.OrderBy = "Time desc, AdId desc "; DataTable table = LogBrowseAnalysisBLL.Instance.GetAnalysis(query); rptTable.DataSource = table; rptTable.DataBind(); }
private void Bind() { QueryGroupInfo query = new QueryGroupInfo(); query.Time = DateTime.Parse(txtTime.Value); query.GroupBy = "time,AdUserId "; query.OrderBy = " time desc "; DataTable table = LogBrowseAnalysisBLL.Instance.GetAnalysis(query); rptTable.DataSource = table; rptTable.DataBind(); }
private void Bind() { QueryGroupInfo query = new QueryGroupInfo(); query.TimeStart = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-01")); query.GroupBy = "AdId"; query.OrderBy = " AdId desc "; DataTable table = LogBrowseAnalysisBLL.Instance.GetAnalysis(query); rptTable.DataSource = table; rptTable.DataBind(); }
private void Bind() { QueryGroupInfo query = new QueryGroupInfo(); query.Time = DN.WeiAd.Framework.TimeHelper.ConverTimeByString(txtTime.Value); query.GroupBy = "time,AdId "; query.OrderBy = " time desc,adid desc "; query.AdUserID = Account.UserId; DataTable table = LogBrowseAnalysisBLL.Instance.GetAnalysis(query); rptTable.DataSource = table; rptTable.DataBind(); }
private void Bind(int pageIndex = 1) { QueryGroupInfo query = new QueryGroupInfo(); query.Time = DateTime.Now; query.GroupBy = "time,AdId "; query.OrderBy = " time desc "; query.AdUserID = Account.UserId; DataTable table = LogBrowseAnalysisBLL.Instance.GetAnalysis(query); rptTable.DataSource = table; rptTable.DataBind(); }
private void Bind(int pageIndex = 1) { QueryGroupInfo query = new QueryGroupInfo(); query.FlowUserId = Account.UserId; query.GroupBy = "time,adid"; query.Time = DateTime.Parse(txtTime.Value); if (!string.IsNullOrEmpty(ddlAdPage.SelectedValue)) { query.AdId = int.Parse(ddlAdPage.SelectedValue); } var list = AnalysisBLL.Instance.GetAnalysis(query); rptTable.DataSource = list; rptTable.DataBind(); }
private void Bind() { QueryGroupInfo query = new QueryGroupInfo(); query.Time = DN.WeiAd.Framework.TimeHelper.ConverTimeByString(txtTime.Value); query.GroupBy = "time,AdId "; query.OrderBy = " time desc,adid desc "; if (!string.IsNullOrEmpty(ddlAdUserId.SelectedValue)) { query.AdUserID = int.Parse(ddlAdUserId.SelectedValue); } DataTable table = LogBrowseAnalysisBLL.Instance.GetAnalysis(query); rptTable.DataSource = table; rptTable.DataBind(); }
private void Bind(int pageIndex = 1) { AdUserPagePara cip = new AdUserPagePara(); cip.PageIndex = pageIndex - 1; cip.PageSize = 10; cip.FlowUserId = Account.UserId; cip.OrderBy = " id desc "; cip.IsState = int.Parse(hidState.Value); var list = AdUserPageBLL.Instance.GetModels(ref cip); rptTable.DataSource = list; rptTable.DataBind(); QueryGroupInfo query = new QueryGroupInfo(); query.FlowUserId = Account.UserId; query.Time = DateTime.Now; query.GroupBy = "adid"; var table = AnalysisBLL.Instance.GetAnalysis(query); for (int i = 0; i < rptTable.Items.Count; i++) { HiddenField hidAdId = (HiddenField)rptTable.Items[i].FindControl("hidAdId"); Literal ltPvCount = (Literal)rptTable.Items[i].FindControl("ltPvCount"); Literal ltUvCount = (Literal)rptTable.Items[i].FindControl("ltUvCount"); Literal ltIpCount = (Literal)rptTable.Items[i].FindControl("ltIpCount"); var rows = table.Select(string.Format("adid={0}", hidAdId.Value)); if (rows != null && rows.Count() != 0) { ltPvCount.Text = rows[0]["pvcount"].ToString(); ltUvCount.Text = rows[0]["uvcount"].ToString(); ltIpCount.Text = rows[0]["ipcount"].ToString(); } } apPager.RecordCount = cip.Recount.Value; }
/// <summary> /// 通用汇总,groupby必须填写 /// </summary> /// <param name="flow"></param> /// <returns></returns> public DataTable GetAnalysis(QueryGroupInfo flow) { StringBuilder sb = new StringBuilder(); if (flow.AdId.HasValue) { sb.AppendFormat(" and AdId = {0} ", flow.AdId); } if (flow.FlowUserId.HasValue) { sb.AppendFormat(" and FlowUserId = {0} ", flow.FlowUserId); } if (flow.AdUserID.HasValue) { sb.AppendFormat(" and AdUserId = {0} ", flow.AdUserID); } if (flow.Time.HasValue) { sb.AppendFormat(" and time = {0} ", flow.Time.Value.ToString("yyyyMMdd")); } string cmd = string.Format(@" select {1} ,count(*) as pvcount ,count(distinct(clientid)) as uvcount ,count(distinct(clientip)) as ipcount ,count(distinct(clientid)) /count(*) as useravg from [AdBrowse] where 1=1 {0} group by {1}", sb, flow.GroupBy); ChartPara cp = new ChartPara(); cp.CommandText = cmd; DataTable table = acc.GetTable(cp); return(table); }
/// <summary> /// 获取小时分组数据 /// </summary> /// <param name="flow"></param> /// <returns></returns> public DataTable GetBrowseHour(QueryGroupInfo flow) { StringBuilder sb = new StringBuilder(); if (flow.AdId.HasValue) { sb.AppendFormat(" and AdId = {0} ", flow.AdId); } if (flow.FlowUserId.HasValue) { sb.AppendFormat(" and FlowUserId = {0} ", flow.FlowUserId); } if (flow.AdUserID.HasValue) { sb.AppendFormat(" and AdUserId = {0} ", flow.AdUserID); } if (flow.Time.HasValue) { sb.AppendFormat(" and time = {0} ", flow.Time.Value.ToString("yyyyMMdd")); } ChartPara cp = new ChartPara(); cp.CommandText = string.Format(@"select * from ( select left(convert(varchar(10), CreateDate, 108), 2) as time ,count(*) as pvcount ,count(distinct(clientid)) as uvcount ,count(distinct(clientip)) as ipcount from [LogBrowseHistory] where 1=1 {0} group by left(convert(varchar(10), CreateDate, 108), 2) ) a order by a.time asc", sb); //数据 DataTable table = acc.GetTable(cp); return(table); }