Exemplo n.º 1
0
        public override List <AdSiteInfoVO> GetModels(ref AdSiteInfoPara 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 <AdSiteInfoVO> list = new List <AdSiteInfoVO>();

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

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

            return(list);
        }
Exemplo n.º 2
0
        public override string GetOrderByPara(AdSiteInfoPara mp)
        {
            if (!string.IsNullOrEmpty(mp.OrderBy))
            {
                return(string.Format(" order by {0}", mp.OrderBy));
            }

            return("");
        }
Exemplo n.º 3
0
        public override AdSiteInfoVO GetSingle(AdSiteInfoPara mp)
        {
            var list = GetModels(mp);

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

            return(null);
        }
Exemplo n.º 4
0
        public override int GetRecords(AdSiteInfoPara 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()));
        }
Exemplo n.º 5
0
        private void Bind(int pageIndex = 1)
        {
            AdSiteInfoPara cip = new AdSiteInfoPara();

            cip.PageIndex = pageIndex - 1;
            cip.PageSize  = 10;
            cip.UserId    = Account.UserId;
            cip.OrderBy   = " id desc ";

            var list = AdSiteInfoBLL.Instance.GetModels(ref cip);

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

            apPager.RecordCount = cip.Recount.Value;
        }
Exemplo n.º 6
0
        public override bool Delete(AdSiteInfoPara 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);
        }
Exemplo n.º 7
0
        public override string GetConditionByPara(AdSiteInfoPara mp)
        {
            StringBuilder sb = new StringBuilder();

            if (mp.Id.HasValue)
            {
                sb.AppendFormat(" AND [Id]='{0}' ", mp.Id);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Name)))
            {
                sb.AppendFormat(" AND [Name]='{0}' ", mp.Name);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Desc)))
            {
                sb.AppendFormat(" AND [Desc]='{0}' ", mp.Desc);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.WebSite)))
            {
                sb.AppendFormat(" AND [WebSite]='{0}' ", mp.WebSite);
            }
            if (mp.UserId.HasValue)
            {
                sb.AppendFormat(" AND [UserId]='{0}' ", mp.UserId);
            }
            if (mp.CreateDate.HasValue)
            {
                sb.AppendFormat(" AND [CreateDate]='{0}' ", mp.CreateDate);
            }
            if (mp.LastDate.HasValue)
            {
                sb.AppendFormat(" AND [LastDate]='{0}' ", mp.LastDate);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.PlatformType)))
            {
                sb.AppendFormat(" AND [PlatformType]='{0}' ", mp.PlatformType);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Contact)))
            {
                sb.AppendFormat(" AND [Contact]='{0}' ", mp.Contact);
            }


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

            return(sb.ToString());
        }
Exemplo n.º 8
0
        public override List <AdSiteInfoVO> GetModels(AdSiteInfoPara 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 <AdSiteInfoVO> list = new List <AdSiteInfoVO>();

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

            return(list);
        }
Exemplo n.º 9
0
 public override string GetOtherConditionByPara(AdSiteInfoPara mp)
 {
     return("");
 }