Exemple #1
0
        public override List <HistoryUserLogBrowseVO> GetModels(ref HistoryUserLogBrowsePara mp)
        {
            string where = GetConditionByPara(mp);

            int    pStart = mp.PageIndex.Value * mp.PageSize.Value;
            int    pEnd   = mp.PageSize.Value;
            string cmd    = QUERYPAGE
                            .Replace("@PAGESIZE", pEnd.ToString())
                            .Replace("@PTOP", pStart.ToString())
                            .Replace("@WHERE", where)
                            .Replace("@ORDER", GetOrderByPara(mp));

            CodeCommand command = new CodeCommand();

            command.CommandText = cmd;

            var table = DbProxyFactory.Instance.Proxy.ExecuteTable(command);

            List <HistoryUserLogBrowseVO> list = new List <HistoryUserLogBrowseVO>();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                list.Add(new HistoryUserLogBrowseVO(table.Rows[i]));
            }

            if (!mp.Recount.HasValue)
            {
                mp.Recount = GetRecords(mp);
            }

            return(list);
        }
Exemple #2
0
        public override string GetOrderByPara(HistoryUserLogBrowsePara mp)
        {
            if (!string.IsNullOrEmpty(mp.OrderBy))
            {
                return(string.Format(" order by {0}", mp.OrderBy));
            }

            return("");
        }
Exemple #3
0
        public override HistoryUserLogBrowseVO GetSingle(HistoryUserLogBrowsePara mp)
        {
            var list = GetModels(mp);

            if (list.Count == 1)
            {
                return(list[0]);
            }

            return(null);
        }
Exemple #4
0
        public override string GetConditionByPara(HistoryUserLogBrowsePara mp)
        {
            StringBuilder sb = new StringBuilder();

            if (mp.Id.HasValue)
            {
                sb.AppendFormat(" AND [Id]='{0}' ", mp.Id);
            }
            if (mp.Time.HasValue)
            {
                sb.AppendFormat(" AND [Time]='{0}' ", mp.Time);
            }
            if (mp.AdId.HasValue)
            {
                sb.AppendFormat(" AND [AdId]='{0}' ", mp.AdId);
            }
            if (mp.UserId.HasValue)
            {
                sb.AppendFormat(" AND [UserId]='{0}' ", mp.UserId);
            }
            if (mp.PvCount.HasValue)
            {
                sb.AppendFormat(" AND [PvCount]='{0}' ", mp.PvCount);
            }
            if (mp.UvCount.HasValue)
            {
                sb.AppendFormat(" AND [UvCount]='{0}' ", mp.UvCount);
            }
            if (mp.IpCount.HasValue)
            {
                sb.AppendFormat(" AND [IpCount]='{0}' ", mp.IpCount);
            }
            if (mp.Price.HasValue)
            {
                sb.AppendFormat(" AND [Price]='{0}' ", mp.Price);
            }
            if (mp.Money.HasValue)
            {
                sb.AppendFormat(" AND [Money]='{0}' ", mp.Money);
            }
            if (mp.CreateDate.HasValue)
            {
                sb.AppendFormat(" AND [CreateDate]='{0}' ", mp.CreateDate);
            }
            if (mp.CreateUserId.HasValue)
            {
                sb.AppendFormat(" AND [CreateUserId]='{0}' ", mp.CreateUserId);
            }


            sb.Insert(0, " WHERE 1=1 ");

            return(sb.ToString());
        }
        protected void btnShowSummer_Click(object sender, EventArgs e)
        {
            HistoryUserLogBrowsePara ubp = new HistoryUserLogBrowsePara();

            ubp.Time = int.Parse(txtTimeOld.Value.Replace("-", ""));

            var list = HistoryUserLogBrowseBLL.Instance.GetModels(ubp);

            rptTables.DataSource = list;
            rptTables.DataBind();
        }
Exemple #6
0
        public override int GetRecords(HistoryUserLogBrowsePara mp)
        {
            string where = GetConditionByPara(mp);

            CodeCommand command = new CodeCommand();

            command.CommandText = QUERYCOUNT + where;

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

            return(int.Parse(result.ToString()));
        }
        private void Bind(int pageIndex = 1)
        {
            HistoryUserLogBrowsePara hup = new HistoryUserLogBrowsePara();

            hup.UserId    = Account.UserId;
            hup.PageIndex = pageIndex - 1;
            hup.PageSize  = 10;

            var list = HistoryUserLogBrowseBLL.Instance.GetModels(ref hup);

            rptTable.DataSource = list;
            rptTable.DataBind();

            apPager.RecordCount = hup.Recount.Value;
        }
Exemple #8
0
        public override bool Delete(HistoryUserLogBrowsePara mp)
        {
            string where = GetConditionByPara(mp);

            CodeCommand command = new CodeCommand();

            command.CommandText = DELETE + where;

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

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

            return(false);
        }
Exemple #9
0
        public override List <HistoryUserLogBrowseVO> GetModels(HistoryUserLogBrowsePara mp)
        {
            string where = GetConditionByPara(mp);

            CodeCommand command = new CodeCommand();

            string cmd = LOAD
                         .Replace("@WHERE", where)
                         .Replace("@ORDER", GetOrderByPara(mp));

            command.CommandText = cmd;

            var table = DbProxyFactory.Instance.Proxy.ExecuteTable(command);

            List <HistoryUserLogBrowseVO> list = new List <HistoryUserLogBrowseVO>();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                list.Add(new HistoryUserLogBrowseVO(table.Rows[i]));
            }

            return(list);
        }
Exemple #10
0
 public override string GetOtherConditionByPara(HistoryUserLogBrowsePara mp)
 {
     return("");
 }