Пример #1
0
        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();
        }
Пример #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            SYCRM.Model.Festivals MF = new SYCRM.Model.Festivals();
            SYCRM.BLL.Festivals BF = new SYCRM.BLL.Festivals();

            DateTime temp = new DateTime();

            if (DateTime.TryParse(tbFDate.Text.Trim(), out temp))
            {
                MF.FName = tbFName.Text;
                MF.FDateTime = temp; ;
                MF.Status = 1;
                BF.Add(MF);
                tbFName.Text = "";
                tbFDate.Text = "";
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "添加成功!", "<script>alert('添加成功!');window.location.href='Festivals.aspx'</script>");
            }
        }
Пример #3
0
        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 + "日)快到了!   ";
                    }
                }
            }
        }
Пример #4
0
 protected void BtnDelete_Click(object sender, EventArgs e)
 {
     CheckBox cb;
     SYCRM.BLL.Festivals BF = new SYCRM.BLL.Festivals();
     for (int i = 0; i < GridViewList.Rows.Count; i++)
     {
         cb = (CheckBox)GridViewList.Rows[i].FindControl("CBSelect");
         if (cb.Checked)
         {
             try
             {
                 SYCRM.Model.Festivals mf = BF.GetModel(new Guid(GridViewList.DataKeys[i].Value.ToString()));
                 mf.Status = 2;
                 BF.Update(mf);
             }
             catch
             {
             }
         }
     }
     Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "节日成功删除!", "<script>alert('节日成功删除!');window.location.href='Festivals.aspx'</script>");
 }