コード例 #1
0
ファイル: ListofStud.aspx.cs プロジェクト: 171107x/EADP
        protected void gvbind()
        {
            StudListDAO     tdDAO  = new StudListDAO();
            List <StudList> tdList = new List <StudList>();

            tdList = tdDAO.getTDbyTripID(Session["Code"].ToString());
            GridViewTD.DataSource = tdList;
            GridViewTD.DataBind();
        }
コード例 #2
0
ファイル: ListofStud.aspx.cs プロジェクト: 171107x/EADP
        protected void Page_Load(object sender, EventArgs e)
        {
            StudListDAO     tdDAO  = new StudListDAO();
            List <StudList> tdList = new List <StudList>();

            if (!Page.IsPostBack)
            {
                tdList = tdDAO.getTDbyTripID(Session["Code"].ToString());
                GridViewTD.DataSource = tdList;
                GridViewTD.DataBind();
                ProgCode.Text = "<h1>" + Session["Code"].ToString() + "</h1>";
            }
            countStud(Session["Code"].ToString());
        }
コード例 #3
0
ファイル: ListofStud.aspx.cs プロジェクト: 171107x/EADP
 protected void studsearchbtn_Click(object sender, EventArgs e)
 {
     if (tbstudsearch.Text == "")
     {
         StudListDAO     tdDAO  = new StudListDAO();
         List <StudList> tdList = new List <StudList>();
         tdList = tdDAO.getTDbyTripID(Session["Code"].ToString());
         GridViewTD.DataSource = tdList;
         GridViewTD.DataBind();
     }
     else
     {
         StudListDAO     tdDAO  = new StudListDAO();
         List <StudList> tdList = new List <StudList>();
         tdList = tdDAO.getTDbyStudentAdmin(tbstudsearch.Text.ToString(), Session["Code"].ToString());
         GridViewTD.DataSource = tdList;
         GridViewTD.DataBind();
     }
 }
コード例 #4
0
ファイル: ListofStud.aspx.cs プロジェクト: 171107x/EADP
        protected void GridViewTD_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Accept")
            {
                int rowIndex = Convert.ToInt32(e.CommandArgument);

                GridViewRow row = GridViewTD.Rows[rowIndex];

                string        studAdmin = row.Cells[1].Text;
                string        DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
                StringBuilder sqlStr    = new StringBuilder();
                int           result    = 0;
                SqlCommand    sqlCmd    = new SqlCommand();

                sqlStr.AppendLine("UPDATE RegisteredStudent set TripStatus = @paraStatus ");
                sqlStr.AppendLine("WHERE StudentAdmin = @paraStudentAdmin And TripID = @paraTripID");

                SqlConnection myConn = new SqlConnection(DBConnect);

                sqlCmd = new SqlCommand(sqlStr.ToString(), myConn);
                sqlCmd.Parameters.AddWithValue("@paraStatus", "Accepted");
                sqlCmd.Parameters.AddWithValue("@paraStudentAdmin", studAdmin.ToString());
                sqlCmd.Parameters.AddWithValue("@paraTripID", Session["Code"].ToString());

                myConn.Open();
                result = sqlCmd.ExecuteNonQuery();

                myConn.Close();
                StudListDAO     tdDAO  = new StudListDAO();
                List <StudList> tdList = new List <StudList>();
                tdList = tdDAO.getTDbyTripID(Session["Code"].ToString());
                GridViewTD.DataSource = tdList;
                GridViewTD.DataBind();
                countStud(Session["Code"].ToString());
            }
            if (e.CommandName == "Reject")
            {
                int rowIndex = Convert.ToInt32(e.CommandArgument);

                GridViewRow row = GridViewTD.Rows[rowIndex];

                string        studAdmin = row.Cells[1].Text;
                string        DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
                StringBuilder sqlStr    = new StringBuilder();
                int           result    = 0;
                SqlCommand    sqlCmd    = new SqlCommand();

                sqlStr.AppendLine("UPDATE RegisteredStudent set TripStatus = @paraStatus ");
                sqlStr.AppendLine("WHERE StudentAdmin = @paraStudentAdmin And TripID = @paraTripID");

                SqlConnection myConn = new SqlConnection(DBConnect);

                sqlCmd = new SqlCommand(sqlStr.ToString(), myConn);
                sqlCmd.Parameters.AddWithValue("@paraStatus", "Rejected");
                sqlCmd.Parameters.AddWithValue("@paraStudentAdmin", studAdmin.ToString());
                sqlCmd.Parameters.AddWithValue("@paraTripID", Session["Code"].ToString());

                myConn.Open();
                result = sqlCmd.ExecuteNonQuery();

                myConn.Close();
                StudListDAO     tdDAO  = new StudListDAO();
                List <StudList> tdList = new List <StudList>();
                tdList = tdDAO.getTDbyTripID(Session["Code"].ToString());
                GridViewTD.DataSource = tdList;
                GridViewTD.DataBind();
                countStud(Session["Code"].ToString());
            }
        }