예제 #1
0
        public override List <VirAdLogBrowseVO> GetModels(ref VirAdLogBrowsePara 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 <VirAdLogBrowseVO> list = new List <VirAdLogBrowseVO>();

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

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

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

            return("");
        }
예제 #3
0
        public override VirAdLogBrowseVO GetSingle(VirAdLogBrowsePara mp)
        {
            var list = GetModels(mp);

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

            return(null);
        }
예제 #4
0
        public override int GetRecords(VirAdLogBrowsePara 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()));
        }
예제 #5
0
        public override bool Delete(VirAdLogBrowsePara 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);
        }
예제 #6
0
        public override string GetConditionByPara(VirAdLogBrowsePara mp)
        {
            StringBuilder sb = new StringBuilder();

            if (mp.Id.HasValue)
            {
                sb.AppendFormat(" AND [Id]='{0}' ", mp.Id);
            }
            if (mp.Name.HasValue)
            {
                sb.AppendFormat(" AND [Name]='{0}' ", mp.Name);
            }
            if (mp.ShowCount.HasValue)
            {
                sb.AppendFormat(" AND [ShowCount]='{0}' ", mp.ShowCount);
            }
            if (mp.ClickCount.HasValue)
            {
                sb.AppendFormat(" AND [ClickCount]='{0}' ", mp.ClickCount);
            }
            if (mp.VaildClickCount.HasValue)
            {
                sb.AppendFormat(" AND [VaildClickCount]='{0}' ", mp.VaildClickCount);
            }
            if (mp.IpCount.HasValue)
            {
                sb.AppendFormat(" AND [IpCount]='{0}' ", mp.IpCount);
            }
            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());
        }
예제 #7
0
        public override List <VirAdLogBrowseVO> GetModels(VirAdLogBrowsePara 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 <VirAdLogBrowseVO> list = new List <VirAdLogBrowseVO>();

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

            return(list);
        }
예제 #8
0
 public override string GetOtherConditionByPara(VirAdLogBrowsePara mp)
 {
     return("");
 }