Exemplo n.º 1
0
        static string strWhere = ""; //Sql语句 为什么要放外面因为AspNetPager1_PageChanged事件也要用到

        //应该完成了 搜索操作
        protected void btSearch_Click(object sender, EventArgs e)
        {
            BLL.CMS_Column bcol = new BLL.CMS_Column();
            AspNetPager1.CurrentPageIndex = 1;

            string strEndTime = "";             //结束时间,要拿来加1

            if (ddlKeyType.Value == "PostDate") //选的是时间
            {
                if (BLL.Validator.IsStringDate(EntTime1.Value) && BLL.Validator.IsStringDate(EntTime2.Value))
                {
                    strEndTime = DateTime.Parse(EntTime2.Value).AddDays(1).ToString();
                    strWhere   = " PostDate between '" + EntTime1.Value + "' and '" + strEndTime + "'";
                }
                else
                {
                    JavaScript("alert(\"请输入合法格式的日期\");");
                }
            }
            else //选的是标题||作者||栏目||
            {
                if (txtKeyWord.Text != String.Empty || txtKeyWord.Text != "")
                {
                    strWhere  = ddlKeyType.Value == "Column" ? "c.title" : ("a." + ddlKeyType.Value);
                    strWhere += " like '%" + txtKeyWord.Text.Trim() + "%'";
                }
            }

            btShowAll.Visible = true;

            Flush(strWhere);
        }
Exemplo n.º 2
0
        // 更新DDL里面Column的可选项
        public void FlushColumn()
        {
            //只能列出满足下列条件的栏目:不能是跳转网址的栏目,也不能是有子栏目的栏目
            BLL.CMS_Column bcol = new BLL.CMS_Column();
            DataTable      dt2  = bcol.GetList("(Len(GotoUrl)=0 or  GotoUrl is NULL) and id not in (select distinct ParentId from CMS_Column)").Tables[0];

            foreach (DataRow dr in dt2.Rows)
            {
                ListItem li = new ListItem();
                li.Text  = GetColumnName(dr["Title"].ToString(), dr["Code"].ToString());
                li.Value = dr["Id"].ToString();
                ddlColumnId.Items.Add(li);
            }
        }