示例#1
0
        protected void BtnRemove_Click(object sender, EventArgs e)
        {
            List <int> selectedIDs = new List <int>();

            foreach (GridViewRow row in GVRegistrationRequests.Rows)
            {
                CheckBox chkSelection = (CheckBox)row.FindControl("ChkDeleteRequest");
                if (chkSelection.Checked)
                {
                    int id = int.Parse(((HiddenField)row.FindControl("HFID")).Value);
                    selectedIDs.Add(id);
                }
            }

            RegistrationRequestDAO requestDAO = new RegistrationRequestDAO(
                ConfigurationManager.ConnectionStrings["flexiLearn"].ConnectionString);

            foreach (int id in selectedIDs)
            {
                requestDAO.DeleteRegistrationRequest(id);
            }

            userRequests = requestDAO.GetAllUserRequests(Context.User.Identity.Name);
            GVRegistrationRequests.DataSource = userRequests;
            GVRegistrationRequests.DataBind();
        }
示例#2
0
        /// <summary>
        /// Populates the gridview to show all request data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            RegistrationRequestDAO requestDAO = new RegistrationRequestDAO(
                ConfigurationManager.ConnectionStrings["flexiLearn"].ConnectionString);

            userRequests = requestDAO.GetAllUserRequests(Context.User.Identity.Name);

            UserTableDAO userDAO = new UserTableDAO(
                ConfigurationManager.ConnectionStrings["flexiLearn"].ConnectionString);
            User user = userDAO.SearchByEmail(Context.User.Identity.Name);

            LblName.Text = user.Name;

            if (!IsPostBack)
            {
                GVRegistrationRequests.DataSource = userRequests;
                GVRegistrationRequests.DataBind();
            }
        }