Exemplo n.º 1
0
        public override bool Insert(HistoryUserLogBrowseVO m)
        {
            CodeCommand command = new CodeCommand();

            command.CommandText = INSERT;
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@Time", Value = ParameterHelper.ConvertValue(m.Time)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@AdId", Value = ParameterHelper.ConvertValue(m.AdId)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@UserId", Value = ParameterHelper.ConvertValue(m.UserId)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@PvCount", Value = ParameterHelper.ConvertValue(m.PvCount)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@UvCount", Value = ParameterHelper.ConvertValue(m.UvCount)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@IpCount", Value = ParameterHelper.ConvertValue(m.IpCount)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@Price", Value = ParameterHelper.ConvertValue(m.Price)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@Money", Value = ParameterHelper.ConvertValue(m.Money)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@CreateDate", Value = ParameterHelper.ConvertValue(m.CreateDate)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@CreateUserId", Value = ParameterHelper.ConvertValue(m.CreateUserId)
            });


            int result = DbProxyFactory.Instance.Proxy.ExecuteNonQuery(command);

            if (result >= 1)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        public override int InsertIdentityId(HistoryUserLogBrowseVO m)
        {
            CodeCommand command = new CodeCommand();

            command.CommandText = INSERT + "; select @@Identity";

            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@Time", Value = ParameterHelper.ConvertValue(m.Time)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@AdId", Value = ParameterHelper.ConvertValue(m.AdId)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@UserId", Value = ParameterHelper.ConvertValue(m.UserId)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@PvCount", Value = ParameterHelper.ConvertValue(m.PvCount)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@UvCount", Value = ParameterHelper.ConvertValue(m.UvCount)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@IpCount", Value = ParameterHelper.ConvertValue(m.IpCount)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@Price", Value = ParameterHelper.ConvertValue(m.Price)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@Money", Value = ParameterHelper.ConvertValue(m.Money)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@CreateDate", Value = ParameterHelper.ConvertValue(m.CreateDate)
            });
            command.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@CreateUserId", Value = ParameterHelper.ConvertValue(m.CreateUserId)
            });


            var result = DbProxyFactory.Instance.Proxy.ExecuteScalar(command);

            return(int.Parse(result.ToString()));
        }
        /// <summary>
        /// 汇总相关数据
        /// </summary>
        /// <param name="time"></param>
        public void SummaryHistoryUserLogBrowse(DateTime time)
        {
            string timeid = time.ToString("yyyyMMdd");

            string cmd = @"select  time,adid,aduserid,count(*) pvcount,count(distinct(clientid)) uvcount,count(distinct(clientip)) ipcount
                            from LogBrowseHistory 
                            where Time=$TIME$
                            group by time,adid,aduserid
                            order by adid";

            //替换汇总时间
            cmd = cmd.Replace("$TIME$", timeid);

            ChartPara cp = new ChartPara();

            cp.CommandText = cmd;
            DataTable table = m_acc.GetTable(cp);

            //获取所有的广告信息,获取相关的价格信息
            var list = AdPageInfoBLL.Instance.GetModels(new AdPageInfoPara());

            for (int i = 0; i < table.Rows.Count; i++)
            {
                HistoryUserLogBrowseVO his = new HistoryUserLogBrowseVO();
                his.AdId         = int.Parse(table.Rows[i]["adid"].ToString());
                his.CreateUserId = 0;
                his.CreateDate   = DateTime.Now;
                his.IpCount      = int.Parse(table.Rows[i]["ipcount"].ToString());
                his.UvCount      = int.Parse(table.Rows[i]["uvcount"].ToString());
                his.PvCount      = int.Parse(table.Rows[i]["pvcount"].ToString());
                his.UserId       = int.Parse(table.Rows[i]["aduserid"].ToString());
                his.Time         = int.Parse(timeid);

                var adinfo = list.SingleOrDefault(p => p.Id == his.AdId);
                if (adinfo != null)
                {
                    his.Price = adinfo.Money;
                    his.Money = his.Price * his.IpCount;
                }

                HistoryUserLogBrowseBLL.Instance.Add(his);
            }
        }
Exemplo n.º 4
0
 public override string GetOtherConditionByModel(HistoryUserLogBrowseVO m)
 {
     return("");
 }
Exemplo n.º 5
0
 public override string GetOrderByModel(HistoryUserLogBrowseVO m)
 {
     return("");
 }