Пример #1
0
        // FORK
        protected void GVCalendar_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            SqlHelper shr = new SqlHelper();

            try
            {
                int    index      = Convert.ToInt32(e.CommandArgument) - 1;
                string RLID       = this.GVCalendar.Rows[index].Cells[0].Text.Trim();
                string RLUserid   = ((LinkButton)this.GVCalendar.Rows[index].Cells[1].FindControl("LinkButton1")).Text.Trim();
                string RLText     = ((TextBox)this.GVCalendar.Rows[index].Cells[1].FindControl("TextBox1")).Text.Trim();
                string RLBuilTime = ((Label)this.GVCalendar.Rows[index].Cells[1].FindControl("Label3")).Text.Trim();

                /*
                 * string datetimeNow = DateTime.Now.AddDays(-30).ToShortDateString();
                 * string sqlSelf = string.Format("select ROW_NUMBER() OVER(ORDER BY a.RLID asc) as SerialN,* from (select * from ZYF_QT_RL where USERID = " +
                 *  "'{0}' OR RLText LIKE '%{1}%') as a inner join(select * from ZYF_QT_RL where" +
                 *  " RLBuildTime > '{2}') as b on a.RLID = b.RLID", RLUserid, RLUserid, datetimeNow);
                 */
                string datetimeNowMany = DateTime.Now.AddDays(-300).ToShortDateString();
                string sqlSelf         = string.Format("select ROW_NUMBER() OVER(ORDER BY a.RLID asc) as SerialN,* from (select * from ZYF_QT_RL where USERID = " +
                                                       "'{0}' OR RLText LIKE '%{1}%') as a inner join(select * from ZYF_QT_RL where" +
                                                       " RLBuildTime > '{2}') as b on a.RLID = b.RLID", RLUserid, RLUserid, datetimeNowMany);
                DataTable dt = shr.Query(sqlSelf);
                GVCalendar.DataSource = dt;
                GVCalendar.DataBind();
                GVCalendar.Visible = true;
            }
            catch (Exception)
            {
            }
            shr.CloseConn();
        }
Пример #2
0
        public void BindGVCalendar()
        {
            string userid = Request.QueryString["userid"].Trim();
            //读取日历系统
            string datetimeNow = DateTime.Now.AddDays(-30).ToShortDateString();
            string systemTip   = string.Format("SELECT ROW_NUMBER() OVER(ORDER BY RLID asc) as SerialN,RLID,USERID,RLText,RLBuildTime from ZYF_QT_RL where RLSYS = 1 or USERID ='{0}' and USERID in" +
                                               " (SELECT USERID from ZYF_QT_RL where RLBuildTime > '{1}' or RLUpdateTime > '{2}')", userid, datetimeNow, datetimeNow);

            SqlHelper shr = new SqlHelper();
            DataTable dt  = shr.Query(systemTip);

            GVCalendar.DataSource = dt;
            GVCalendar.DataBind();
            shr.CloseConn();
        }