protected void Page_Load(object sender, EventArgs e) { List<SYCRM.Model.Festivals> listMF = new List<SYCRM.Model.Festivals>(); SYCRM.BLL.Festivals BF = new SYCRM.BLL.Festivals(); string strWhere = " status=1 "; listMF = BF.GetModelList(strWhere); DateTime dtnow = DateTime.Now; foreach (SYCRM.Model.Festivals f in listMF) { DateTime dt = f.FDateTime.Value; if (dt.Year==dtnow.Year&& dt.Month == dtnow.Month) { if (dt.Day >= dtnow.Day && dt.Day <= dtnow.Day + 3) { ltrAlert.Text += f.FName + "(" + dt.Year + "年" + dt.Month + "月" + dt.Day + "日)快到了! "; } } } }
private void BindData() { List<SYCRM.Model.Festivals> listMF = new List<SYCRM.Model.Festivals>(); SYCRM.BLL.Festivals BF = new SYCRM.BLL.Festivals(); string strWhere = " status=1 "; if (!tb_KeyWords.Text.Trim().Equals("")) { strWhere += " and [FName] like '%" + tb_KeyWords.Text.Trim() + "%'"; } listMF = BF.GetModelList(strWhere); GridViewList.DataSource = listMF; GridViewList.DataBind(); }