コード例 #1
0
    //判断是否是选题时间
    private bool IsChosenTime()
    {
        DateTime  dtm = DateTime.Now;
        DataTable dt  = new DataTable();

        Fannie.Student stu = new Fannie.Student();
        dt = stu.GetChooseTime().Tables[0];
        DateTime begin = Convert.ToDateTime(dt.Rows[0]["ChooseBegin"].ToString());
        DateTime end   = Convert.ToDateTime(dt.Rows[0]["ChooseEnd"].ToString());

        if (dtm < begin || dtm > end)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
コード例 #2
0
    private bool IsTime()
    {
        DateTime  dtm = DateTime.Now;
        DataTable dt  = new DataTable();

        Fannie.Student stu = new Fannie.Student();
        dt = stu.GetChooseTime().Tables[0];
        DateTime begin = Convert.ToDateTime(dt.Rows[0]["ChooseBegin"].ToString());
        DateTime end   = Convert.ToDateTime(dt.Rows[0]["ChooseEnd"].ToString());

        if (dtm < begin || dtm > end)
        {
            Response.Write("<script> alert('还未到选题时间,不能选题!');history.go(-1)</script>");
            return(false);
        }
        else
        {
            return(true);
        }
    }