コード例 #1
0
        public override List <DomainInfoVO> GetModels(ref DomainInfoPara 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 <DomainInfoVO> list = new List <DomainInfoVO>();

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

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

            return(list);
        }
コード例 #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";

            string    sname  = context.Request.Params["sname"] ?? "";
            ApiResult result = new ApiResult();

            try
            {
                DomainInfoPara dip = new DomainInfoPara();
                dip.SerName = sname;

                var list = DomainInfoBLL.Instance.GetModels(dip);
                result.datajson = DN.Framework.Utility.Serializer.SerializeObject(list);
                result.code     = 1;
                result.msg      = "获取成功。";
            }
            catch (Exception ex)
            {
                result.msg  = ex.Message;
                result.code = 2;
            }

            string json = DN.Framework.Utility.Serializer.SerializeObject(result);

            context.Response.ClearContent();
            context.Response.Write(json);
            context.Response.End();
        }
コード例 #3
0
        public override string GetOrderByPara(DomainInfoPara mp)
        {
            if (!string.IsNullOrEmpty(mp.OrderBy))
            {
                return(string.Format(" order by {0}", mp.OrderBy));
            }

            return("");
        }
コード例 #4
0
        public override DomainInfoVO GetSingle(DomainInfoPara mp)
        {
            var list = GetModels(mp);

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

            return(null);
        }
コード例 #5
0
        public override int GetRecords(DomainInfoPara 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()));
        }
コード例 #6
0
        private void Bind(int pageIndex = 1)
        {
            DomainInfoPara cip = new DomainInfoPara();

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

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

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

            apPager.RecordCount = cip.Recount.Value;
        }
コード例 #7
0
        public override bool Delete(DomainInfoPara 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);
        }
コード例 #8
0
        private string ReplaceMiddlePageHtml(string html, AdPageInfoVO info)
        {
            //有效域名
            DomainInfoPara dp = new DomainInfoPara();

            dp.IsAuth  = 1;
            dp.IsState = 0;
            var list = DomainInfoBLL.Instance.GetModels(dp);

            StringBuilder sbDomain = new StringBuilder();

            foreach (var item in list)
            {
                sbDomain.AppendFormat("\"{0}\",", item.Domain);
            }
            if (sbDomain.Length != 0)
            {
                sbDomain = sbDomain.Remove(sbDomain.Length - 1, 1);
            }

            //有效页面
            AdUserPagePara aup = new AdUserPagePara();

            aup.AdPageId = info.Id;
            var plist = AdUserPageBLL.Instance.GetModels(aup);

            StringBuilder sbPage = new StringBuilder();

            foreach (var item in plist)
            {
                sbPage.AppendFormat("\"{0}\",", item.PageName);
            }
            sbPage.AppendFormat("\"{0}\"", info.ViewPage);

            html = html
                   .Replace("$domains$", sbDomain.ToString())
                   .Replace("$pages$", sbPage.ToString());
            return(html);
        }
コード例 #9
0
        public override List <DomainInfoVO> GetModels(DomainInfoPara 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 <DomainInfoVO> list = new List <DomainInfoVO>();

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

            return(list);
        }
コード例 #10
0
 public override string GetOtherConditionByPara(DomainInfoPara mp)
 {
     return("");
 }
コード例 #11
0
        public override string GetConditionByPara(DomainInfoPara 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.Domain)))
            {
                sb.AppendFormat(" AND [Domain]='{0}' ", mp.Domain);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.PageName)))
            {
                sb.AppendFormat(" AND [PageName]='{0}' ", mp.PageName);
            }
            if (mp.IsState.HasValue)
            {
                sb.AppendFormat(" AND [IsState]='{0}' ", mp.IsState);
            }
            if (mp.IsAuth.HasValue)
            {
                sb.AppendFormat(" AND [IsAuth]='{0}' ", mp.IsAuth);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.CityName)))
            {
                sb.AppendFormat(" AND [CityName]='{0}' ", mp.CityName);
            }
            if (mp.CreateDate.HasValue)
            {
                sb.AppendFormat(" AND [CreateDate]='{0}' ", mp.CreateDate);
            }
            if (mp.CreateUserId.HasValue)
            {
                sb.AppendFormat(" AND [CreateUserId]='{0}' ", mp.CreateUserId);
            }
            if (mp.IsColse.HasValue)
            {
                sb.AppendFormat(" AND [IsColse]='{0}' ", mp.IsColse);
            }
            if (mp.ColseDate.HasValue)
            {
                sb.AppendFormat(" AND [ColseDate]='{0}' ", mp.ColseDate);
            }
            if (mp.CloseUserId.HasValue)
            {
                sb.AppendFormat(" AND [CloseUserId]='{0}' ", mp.CloseUserId);
            }
            if (mp.AdUserId.HasValue)
            {
                sb.AppendFormat(" AND [AdUserId]='{0}' ", mp.AdUserId);
            }
            if (mp.IsResolution.HasValue)
            {
                sb.AppendFormat(" AND [IsResolution]='{0}' ", mp.IsResolution);
            }
            if (mp.ResolutionDate.HasValue)
            {
                sb.AppendFormat(" AND [ResolutionDate]='{0}' ", mp.ResolutionDate);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.SerName)))
            {
                sb.AppendFormat(" AND [SerName]='{0}' ", mp.SerName);
            }
            if (mp.ResolutionType.HasValue)
            {
                sb.AppendFormat(" AND [ResolutionType]='{0}' ", mp.ResolutionType);
            }


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

            return(sb.ToString());
        }