public bool EditRoll(int enrollmentId, string classID, string firefighterID)
        {
            var _db = new WebApplication1.HalonModels.HalonContext();
            var myEnrollment = (from c in _db.Enrollments where c.Enrollment_ID == enrollmentId select c).FirstOrDefault();
            myEnrollment.Class_ID = Convert.ToInt32(classID);
            myEnrollment.Firefighter_ID = Convert.ToInt32(firefighterID);

            // Add product to DB.

            _db.SaveChanges();

            // Success.
            return true;
        }
        public bool EditRoll(string classID, string firefighterID)
        {
            var _db = new WebApplication1.HalonModels.HalonContext();
            HalonModels.Enrollment myEnrollment = new HalonModels.Enrollment();
            myEnrollment.Class_ID = Convert.ToInt32(classID);
            myEnrollment.Firefighter_ID = Convert.ToInt32(firefighterID);

            // Add product to DB.
            _db.Enrollments.Add(myEnrollment);
            _db.SaveChanges();

            // Success.
            return true;
        }
        public bool EditClasses(string classId, bool cancelled, string firefighterID, string course, string note, string dateVar)
        {
            var _db = new WebApplication1.HalonModels.HalonContext();
            int class_ID = Convert.ToInt32(classId);
            var myClass = (from c in _db.Classes where c.Class_ID == class_ID select c).FirstOrDefault();
            myClass.Class_Cancelled = cancelled;
            myClass.Firefighter_ID = Convert.ToInt32(firefighterID);
            myClass.Course_ID = Convert.ToInt32(course);
            myClass.Class_Note = note;
            myClass.Class_Date = dateVar;

            // Add product to DB.
            _db.SaveChanges();

            // Success.
            return true;
        }
        public bool EditClasses(bool cancelled, string firefighterID, string course, string note, string dateVar)
        {
            var _db = new WebApplication1.HalonModels.HalonContext();
            HalonModels.Class myClass = new HalonModels.Class();
            myClass.Class_Cancelled = cancelled;
            myClass.Firefighter_ID = Convert.ToInt32(firefighterID);
            myClass.Course_ID = Convert.ToInt32(course);
            myClass.Class_Note = note;
            myClass.Class_Date = dateVar;

            // Add product to DB.
            _db.Classes.Add(myClass);
            _db.SaveChanges();

            // Success.
            return true;
        }
        //called when update button clicked
        protected void UpdateUserButton_Click(object sender, EventArgs e)
        {
            bool updateSuccess;

            try
            {
                user.Email = UpdateUserEmail.Text.Trim();
                Membership.UpdateUser(user);

                if (Roles.GetRolesForUser(user.UserName).Length > 0)
                    Roles.RemoveUserFromRoles(user.UserName, Roles.GetRolesForUser(user.UserName));

                Roles.AddUserToRole(user.UserName, DropDownUpdateRole.SelectedValue);
                Membership.UpdateUser(user);

                if (DropDownUpdateFireFighter.SelectedValue != "none")
                {
                    var db = new WebApplication1.HalonModels.HalonContext();
                    IQueryable<HalonModels.Firefighter> query = db.Firefighters;

                    int selectedID = Convert.ToInt32(DropDownUpdateFireFighter.SelectedValue);
                    query = query.Where(f => f.Firefighter_ID == selectedID);

                    query.FirstOrDefault().Firefighter_Account_Username = username;
                    db.SaveChanges();
                }
                else
                {
                    var db = new WebApplication1.HalonModels.HalonContext();
                    IQueryable<HalonModels.Firefighter> query = db.Firefighters;

                    query = query.Where(f => f.Firefighter_Account_Username == username);

                    query.FirstOrDefault().Firefighter_Account_Username = null;
                    db.SaveChanges();
                }

                updateSuccess = true;
            }
            catch (Exception exc)
            {
                updateSuccess = false;
                LabelUpdateStatus.Text = exc.ToString();
            }

            //reload with status
            if (updateSuccess)
            {
                Response.Redirect("/Admin/Users/Display_Users.aspx");
            }
            else
            {
                //LabelUpdateStatus.Text = "Unable to update user.";
            }
        }