Esempio n. 1
0
        public override List <AdQcodeInfoVO> GetModels(ref AdQcodeInfoPara 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 <AdQcodeInfoVO> list = new List <AdQcodeInfoVO>();

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

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

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

            return("");
        }
Esempio n. 3
0
        public override AdQcodeInfoVO GetSingle(AdQcodeInfoPara mp)
        {
            var list = GetModels(mp);

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

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

            cip.PageIndex = pageIndex - 1;
            cip.PageSize  = 10;
            cip.AdId      = int.Parse(hidAdId.Value);
            cip.OrderBy   = " id desc ";

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

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

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

            if (mp.Id.HasValue)
            {
                sb.AppendFormat(" AND [Id]='{0}' ", mp.Id);
            }
            if (mp.AdId.HasValue)
            {
                sb.AppendFormat(" AND [AdId]='{0}' ", mp.AdId);
            }
            if (mp.AdUserId.HasValue)
            {
                sb.AppendFormat(" AND [AdUserId]='{0}' ", mp.AdUserId);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Name)))
            {
                sb.AppendFormat(" AND [Name]='{0}' ", mp.Name);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.QcodeUrl)))
            {
                sb.AppendFormat(" AND [QcodeUrl]='{0}' ", mp.QcodeUrl);
            }
            if (mp.CreateDate.HasValue)
            {
                sb.AppendFormat(" AND [CreateDate]='{0}' ", mp.CreateDate);
            }
            if (mp.CreateUserId.HasValue)
            {
                sb.AppendFormat(" AND [CreateUserId]='{0}' ", mp.CreateUserId);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.QcodeUrl2)))
            {
                sb.AppendFormat(" AND [QcodeUrl2]='{0}' ", mp.QcodeUrl2);
            }


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

            return(sb.ToString());
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hidAdId.Value    = Request.Params["adid"] ?? "0";
                hidQcodeId.Value = Request.Params["id"] ?? "0";

                string isdel = Request.Params["isdel"] ?? "";
                if (isdel == "1")
                {
                    AdQcodeInfoPara ap = new AdQcodeInfoPara();
                    ap.Id       = int.Parse(hidQcodeId.Value);
                    ap.AdUserId = Account.UserId;
                    var qinfo = AdQcodeInfoBLL.Instance.GetSingle(ap);
                    if (qinfo != null)
                    {
                        AdQcodeInfoBLL.Instance.Delete(ap);

                        var adinfo = AdPageInfoBLL.Instance.GetSingle(new AdPageInfoPara()
                        {
                            Id = qinfo.AdId
                        });
                        if (adinfo != null)
                        {
                            adinfo.QcodeCount = AdQcodeInfoBLL.Instance.GetRecords(new AdQcodeInfoPara()
                            {
                                AdId = qinfo.AdId
                            });
                            adinfo.LastDate = DateTime.Now;
                            AdPageInfoBLL.Instance.Edit(adinfo);
                        }
                    }
                }

                BindPage();

                Bind();
            }
        }
Esempio n. 9
0
        public override List <AdQcodeInfoVO> GetModels(AdQcodeInfoPara 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 <AdQcodeInfoVO> list = new List <AdQcodeInfoVO>();

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

            return(list);
        }
Esempio n. 10
0
 public override string GetOtherConditionByPara(AdQcodeInfoPara mp)
 {
     return("");
 }