Exemplo n.º 1
0
        protected void tripDelete_Click(object sender, EventArgs e)
        {
            string        DBConnect  = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
            SqlConnection myConn     = new SqlConnection(DBConnect);
            LinkButton    tripDelete = sender as LinkButton;
            GridViewRow   row        = tripDelete.NamingContainer as GridViewRow;
            //string ProgCode = Convert.ToString(GridViewTrip.DataKeys[row.RowIndex].Value.ToString());
            string ProgCode = row.Cells[0].Text;
            int    result;

            myConn.Open();
            SqlCommand cmd = new SqlCommand("DELETE FROM Trip WHERE TripID ='" + ProgCode + "'", myConn);

            result = cmd.ExecuteNonQuery();
            myConn.Close();
            if (result == 1)
            {
                trip        tripOjb  = new trip();
                tripDAO     tripDAO  = new tripDAO();
                List <trip> tripList = new List <trip>();
                tripList = tripDAO.getTripInfo();
                GridViewTrip.DataSource = tripList;
                GridViewTrip.DataBind();
            }
            //Response.Redirect("Tripmanagement.aspx");
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            tripDAO tripDAO = new tripDAO();

            List <trip> studyTrip = new List <trip>();

            studyTrip = tripDAO.getStudyTrip();
            GridViewTrip.DataSource = studyTrip;
            GridViewTrip.DataBind();

            List <trip> studyTripHist = new List <trip>();

            studyTripHist           = tripDAO.getStudyTripHist();
            GridViewHist.DataSource = studyTripHist;
            GridViewHist.DataBind();
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                trip    tripOjb = new trip();
                tripDAO tripDAO = new tripDAO();
                //tripOjb = tripDAO.getTripById(1);
                //Lbl_country.Text = tripOjb.Country;
                //Lbl_description.Text = tripOjb.Description;

                List <trip> tripList = new List <trip>();
                tripList = tripDAO.getTripInfo();
                GridViewTrip.DataSource = tripList;
                GridViewTrip.DataBind();

                List <trip> tripHist = new List <trip>();
                tripHist = tripDAO.getTripHist();
                GridViewHist.DataSource = tripHist;
                GridViewHist.DataBind();
            }
            if (Session["Username"] == null)
            {
            }
        }