⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t_calendar.aspx.cs

📁 实验课预约系统。采用.net+access数据库实现。 管理员对学生教师有管理功能
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ExpReserve;

public partial class T_Calendar : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Admin aAdmin = (Admin)this.Master;
            aAdmin.ManageTitle = "实验课表";
            aAdmin.MenuSelectedValue = "TCalendar";
            

            lblCurrentTerm.Text = SingleInitials.DbAccess.GetActiveTerm();
            this.lbMsg.Text = "";
            BindDisplayList(0, "");
        }


    }


    #region 属性
    static int m_ColID = 0;
    public string CurrentTerm
    {
        get
        {
            return this.lblCurrentTerm.Text;
        }
    }
    
    public long CurrentTeacherID
    {
        get
        {
            return long.Parse(Users.GetCurrentTableID());
        }
    }
    #endregion



    /// <summary>
    /// 返回所有的实验项目批次
    /// </summary>
    /// <param name="pageIndex"></param>
    /// <param name="sortExpression">要排序的字段</param>
    private void BindDisplayList(int pageIndex, string sortExpression)
    {
        this.lbMsg.Text = "";
        BatchList.Columns[m_ColID].Visible = true;
        BatchList.SelectedIndex = -1;

        DataTable dt = SingleInitials.DbAccess.GetTeacherAsuredBatchList(CurrentTerm,CurrentTeacherID).Tables[0];//返回所有列表
        dt.Columns.Add("State",typeof(string),"BookingCount+'/'+Capacity");
       
        if (sortExpression == null || sortExpression == string.Empty)
        {
            JKLib.Web.GridViewOperation.BindPagingGridView(BatchList, dt.DefaultView, pageIndex);
        }
        else
        {
            JKLib.Web.GridViewOperation.BindPagingGridView(BatchList, dt.DefaultView, pageIndex, sortExpression, true, JKLib.Web.GridViewOperation.BindPagingGridViewType.Sorting);
        }
        BatchList.Columns[m_ColID].Visible = false;
    }

   


    #region 表格处理
    protected void BatchList_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        BindDisplayList(e.NewPageIndex, null);
    }
    protected void BatchList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "ShowStudents")
        {
            BatchList.SelectedIndex = int.Parse(e.CommandArgument.ToString());
            string theID = BatchList.Rows[int.Parse(e.CommandArgument.ToString())].Cells[m_ColID].Text;
            Response.Redirect("T_ExpBooking.aspx?BatchID=" + theID);  
        }
    }
    protected void BatchList_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Pager)
            JKLib.Web.GridViewOperation.GridRowCreated(sender, e);
    }
    protected void BatchList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        ////Button   btn   =   (Button)e.Row.Cells[2].Controls[0]; 
        ////btn.Attributes.Add("onclick","return   confirm('您真的要删除吗?');");
        //LinkButton btn = (LinkButton)e.Row.Cells[2].Controls[0]; 
        //btn.Attributes.Add("onclick", "return   confirm('您真的要删除吗?');");    
    }
    protected void BatchList_Sorting(object sender, GridViewSortEventArgs e)
    {
        BindDisplayList(BatchList.PageIndex, e.SortExpression);
    }
    #endregion

    protected void BtnRefresh_Click(object sender, EventArgs e)
    {
        BindDisplayList(0,"");
    }
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        UIControls.ExportExcelFromDataGrid("课程表.xls", this.BatchList, this);
    }

    public override void VerifyRenderingInServerForm(Control control)
    {
        //base.VerifyRenderingInServerForm(control);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -