} /* end of level of course dropdown box method */ protected void Ddl_TypeOfCourse_SelectedIndexChanged(object sender, EventArgs e) // start of the type of course selected item method { SubjectArea TypeOfCourse = Cache[cacheKey] as SubjectArea; /* creating a new instance of the object under the class SubjectArea called TypeOfCourse */ SubjectAreaId = Convert.ToInt32(Request.QueryString.Get("SubjectAreaId")); /*setting SubjectArea depending on the SubjectAreaId passed from the previous variable */ string typeOfCourse = Ddl_TypeOfCourse.SelectedValue; // selecting the value based on the part time of full time course selected using (HigherEducationChesterfieldCollegeEntities myEntities = new HigherEducationChesterfieldCollegeEntities()) // creating a new instance of class by calling the object myEntities { // statement updates the type of course and outputs it onto the subject area page var levelOfCourseReviews = from course in myEntities.Courses orderby course.Name_Course ascending where course.SubjectAreaID == SubjectAreaId && course.PartFullTime == typeOfCourse select course; Repeater1.DataSource = levelOfCourseReviews.ToList(); Repeater1.DataBind(); // selecting the subject areas again just in case they have been updated TypeOfCourse = (from r in myEntities.SubjectAreas where r.ID == SubjectAreaId select r).SingleOrDefault(); if (TypeOfCourse != null) // when the type of null is not nothing { Cache.Insert(cacheKey, TypeOfCourse, null, DateTime.Now.AddSeconds(1), System.Web.Caching.Cache.NoSlidingExpiration); // updates the information every second } } // updating page infromation below just in case an administrator has changed information on the web page TitleLabel.Text = TypeOfCourse.Name_SA; BodyLabel.Text = TypeOfCourse.AdditionalInformation; Title = TypeOfCourse.Name_SA; } //end of the type of course selected item method
public async Task <IActionResult> PutSubjectArea([FromRoute] int id, [FromBody] SubjectArea subjectArea) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != subjectArea.Id) { return(BadRequest()); } _context.Entry(subjectArea).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubjectAreaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
} /* end of the function when the page loads */ protected void Ddl_LevelOfCourse_SelectedIndexChanged(object sender, EventArgs e) /* when the level of course dropdown box is selected which doesn't return anything*/ { SubjectArea LevelOfCourse = Cache[cacheKey] as SubjectArea; /* creating a new instance of the object under the class SubjectArea called LevelOfCourse */ SubjectAreaId = Convert.ToInt32(Request.QueryString.Get("SubjectAreaId")); /*setting SubjectArea depending on the SubjectAreaId passed from the previous variable */ int level = Convert.ToInt32(Ddl_LevelOfCourse.SelectedValue); /* setting the level of the course by an integer by converting value from drop down box */ // creating a new instance of class by calling the object myEntities using (HigherEducationChesterfieldCollegeEntities myEntities = new HigherEducationChesterfieldCollegeEntities()) { // statement updates the level of courses; var levelOfCourseReviews = from course in myEntities.Courses orderby course.Name_Course ascending where course.SubjectAreaID == SubjectAreaId where course.LevelOfCourse == level select course; Repeater1.DataSource = levelOfCourseReviews.ToList(); // outputting repeater to pass variable through to the page Repeater1.DataBind(); LevelOfCourse = (from r in myEntities.SubjectAreas // outputting the courses that changes depending on the level of course that is selected where r.ID == SubjectAreaId select r).SingleOrDefault(); if (LevelOfCourse != null) // when the level of course is nothing { Cache.Insert(cacheKey, LevelOfCourse, null, DateTime.Now.AddSeconds(1), System.Web.Caching.Cache.NoSlidingExpiration); // updates the page every second } } // updating page infromation below just in case an administrator has changed information on the web page TitleLabel.Text = LevelOfCourse.Name_SA; BodyLabel.Text = LevelOfCourse.AdditionalInformation; Title = LevelOfCourse.Name_SA; } /* end of level of course dropdown box method */
public void testSubjectAreaSIF15r1() { Adk.SifVersion = SifVersion.SIF15r1; SchoolCourseInfo sci = new SchoolCourseInfo(); SubjectAreaList lst = new SubjectAreaList(); sci.SubjectAreaList = lst; SubjectArea sa = new SubjectArea("13"); sa.TextValue = "Graphic Arts"; // for SIF 1.x ??? OtherCodeList ocl = new OtherCodeList(); ocl.Add(new OtherCode(Codeset.TEXT, "Graphic Arts")); sa.OtherCodeList = ocl; lst.Add(sa); StringWriter sw = new StringWriter(); SifWriter sifw = new SifWriter(sw); sifw.Write(sci); sifw.Flush(); sifw.Close(); String xml = sw.ToString(); Console.WriteLine(xml); int found = xml.IndexOf(">Graphic Arts</SubjectArea>"); Assertion.Assert(found > -1); }
public async Task <IActionResult> Edit(int id, [Bind("SubjectAreaId,SubjectAreaName,ActiveYn,SubjectAreaFormId,DefaultTargetSchema,UpdatedBy")] SubjectArea subjectArea) { if (id != subjectArea.SubjectAreaId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(subjectArea); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubjectAreaExists(subjectArea.SubjectAreaId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(subjectArea)); }
/// <summary> /// Constructor that accepts values for all mandatory fields /// </summary> ///<param name="yearCreated">This represents the year that this specific learning standard was created. This is important to indicate as standards are updated to reflect the appropriate year it was created. This would be assigned and unique to the standard setting body.</param> ///<param name="subjectArea">This represents the subject or content area this learning standard addresses. This would be assigned and unique to the standard setting body.\</param> ///<param name="standardNumber">This is the specific number of the standard. For example, if the subject is mathematics and this standard is Patterns, Functions and Algebra, this would be StandardNumber 1. This would be assigned and unique to the standard setting body.</param> ///<param name="gradeLevels">This represents the grade level(s) this specific learning standard will address. This may be addressed in different ways. Some states have a grade level that covers several grades and others have just one grade. This would be assigned and unique to the standard setting body.</param> ///<param name="organization">Name of organization represented by the document, i.e., "National Council of Teachers of Mathematics (NCTM)," "Washington," "Seattle School District." This is the name of the organization that has this AlternateIdentificationCode. This should be a text field.</param> /// public StandardIdentifier(int?yearCreated, SubjectArea subjectArea, string standardNumber, GradeLevels gradeLevels, string organization) : base(InstrDTD.STANDARDIDENTIFIER) { this.YearCreated = yearCreated; this.SubjectArea = subjectArea; this.StandardNumber = standardNumber; this.GradeLevels = gradeLevels; this.Organization = organization; }
// GET: SubjectArea/Create public IActionResult Create() { ViewData["SubjectAreaFormId"] = new SelectList(_context.SubjectAreaForm.OrderBy(x => x.SubjectAreaFormId), "SubjectAreaFormId", "SubjectAreaFormId"); SubjectArea subjectArea = new SubjectArea(); subjectArea.ActiveYn = true; return(View(subjectArea)); }
public SubjectArea getSubArea(string subject) { var sub = _context.SubjectArea.SingleOrDefaultAsync(m => m.Area == subject); SubjectArea s = new SubjectArea(); s.Id = sub.Result.Id; s.Area = sub.Result.Area; return(s); }
public async Task <IActionResult> Create([Bind("SubjectAreaId,SubjectAreaName,ActiveYn,SubjectAreaFormId,DefaultTargetSchema,UpdatedBy")] SubjectArea subjectArea) { if (ModelState.IsValid) { _context.Add(subjectArea); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(subjectArea)); }
public async Task <IActionResult> PostSubjectArea([FromBody] SubjectArea subjectArea) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.SubjectArea.Add(subjectArea); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSubjectArea", new { id = subjectArea.Id }, subjectArea)); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (MinGrade != null) { MinGrade.Validate(); } if (MaxGrade != null) { MaxGrade.Validate(); } if (SubjectArea != null) { SubjectArea.Validate(); } }
public async Task <IActionResult> Create([Bind("SubjectAreaId,SubjectAreaName,ActiveYn,SubjectAreaFormId,DefaultTargetSchema,UpdatedBy")] SubjectArea subjectArea) { if (ModelState.IsValid) { _context.Add(subjectArea); if (!await CanPerformCurrentActionOnRecord(subjectArea)) { return(new ForbidResult()); } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(IndexDataTable))); } ViewData["SubjectAreaFormId"] = new SelectList(_context.SubjectAreaForm.OrderBy(x => x.SubjectAreaFormId), "SubjectAreaFormId", "SubjectAreaFormId", subjectArea.SubjectAreaFormId); return(View(subjectArea)); }
public bool SaveSubjectArea(SubjectAreaViewModel subjectArea) { try { if (ValidateSubjectAreaModel(subjectArea)) { var s = new SubjectArea(); s.Name = subjectArea.Name; s.SubjectId = subjectArea.SubjectId; subjectAreaRepository.Add(s); unitOfWork.Save(); } return(true); } catch (Exception ex) { Logger.Warn(ex.Message, ex); throw; } }
public bool DeleteSubjectArea(long subjectAreaId) { try { SubjectArea subjectArea = subjectAreaRepository.Find(subjectAreaId); subjectAreaRepository.Remove(subjectArea); unitOfWork.Save(); return(true); } catch (DbUpdateException ex) { Logger.Warn(ex.Message, ex); throw; } catch (Exception ex) { Logger.Warn(ex.Message, ex); throw; } }
public bool UpdateSubjectArea(SubjectAreaViewModel model) { try { if (ValidateSubjectAreaModel(model)) { var subjectArea = new SubjectArea(); subjectArea.SubjectAreaId = model.SubjectAreaId; subjectArea.Name = model.Name; subjectArea.SubjectId = model.SubjectId; subjectAreaRepository.Update(subjectArea); unitOfWork.Save(); } return(true); } catch (Exception ex) { Logger.Warn(ex.Message, ex); throw; } }
public string cacheKey; /* string called cacheKey is public */ protected void Page_Load(object sender, EventArgs e) /* start of the function when the page first loads which doesn't return anything */ { SubjectAreaId = Convert.ToInt32(Request.QueryString.Get("SubjectAreaId")); /* converts the passed variable through url into an integer */ cacheKey = "SubjectArea" + SubjectAreaId.ToString(); /*setting the cache key */ SubjectArea mySubjectArea = Cache[cacheKey] as SubjectArea; /* creating a new instance of class by calling the object mySubjectArea */ if (mySubjectArea == null) // when mySubejctArea is null { // creating a new instance of class by calling the object myEntities using (HigherEducationChesterfieldCollegeEntities myEntities = new HigherEducationChesterfieldCollegeEntities()) { // statement below outputs all the courses that are part of that subject area var authorizedReviews = from course in myEntities.Courses orderby course.Name_Course ascending where course.SubjectAreaID == SubjectAreaId select course; Repeater1.DataSource = authorizedReviews.ToList(); // output courses to the page Repeater1.DataBind(); mySubjectArea = (from r in myEntities.SubjectAreas // used to output data based on that subject area where r.ID == SubjectAreaId select r).SingleOrDefault(); if (mySubjectArea != null) // when mySubjectArea is not empty { Cache.Insert(cacheKey, mySubjectArea, null, DateTime.Now.AddSeconds(1), System.Web.Caching.Cache.NoSlidingExpiration); // updates changes every second, not possible to set it to 0 } } } if (mySubjectArea != null) // when mySubjectArea is not empty { TitleLabel.Text = mySubjectArea.Name_SA; // title label is set dynamically depending on what subject area is selected BodyLabel.Text = mySubjectArea.AdditionalInformation; // setting BodyLabel.Text to what information from the database Title = "Higher Education Chesterfield College - " + mySubjectArea.Name_SA; // setting the title of the page which depends on whcih subject area is selected */ } } /* end of the function when the page loads */
public async Task <IActionResult> Edit(int id, [Bind("SubjectAreaId,SubjectAreaName,ActiveYn,SubjectAreaFormId,DefaultTargetSchema,UpdatedBy")] SubjectArea subjectArea) { if (id != subjectArea.SubjectAreaId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(subjectArea); if (!await CanPerformCurrentActionOnRecord(subjectArea)) { return(new ForbidResult()); } await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubjectAreaExists(subjectArea.SubjectAreaId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(IndexDataTable))); } ViewData["SubjectAreaFormId"] = new SelectList(_context.SubjectAreaForm.OrderBy(x => x.SubjectAreaFormId), "SubjectAreaFormId", "SubjectAreaFormId", subjectArea.SubjectAreaFormId); return(View(subjectArea)); }
///<summary>Sets the value of the <c><SubTestSubjectAreas></c> element.</summary> /// <param name="SubjectArea">Subject matter.</param> ///<remarks> /// <para>This form of <c>setSubTestSubjectAreas</c> is provided as a convenience method /// that is functionally equivalent to the <c>SubTestSubjectAreas</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.6</para> /// </remarks> public void SetSubTestSubjectAreas(SubjectArea SubjectArea) { RemoveChild(Sif3assessmentDTD.SIF3ASSESSMENTSUBTEST_SUBTESTSUBJECTAREAS); AddChild(Sif3assessmentDTD.SIF3ASSESSMENTSUBTEST_SUBTESTSUBJECTAREAS, new SubjectAreaList(SubjectArea)); }
///<summary>Sets the value of the <c><SubjectAreaList></c> element.</summary> /// <param name="SubjectArea">Subject matter.</param> ///<remarks> /// <para>This form of <c>setSubjectAreaList</c> is provided as a convenience method /// that is functionally equivalent to the <c>SubjectAreaList</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.0</para> /// </remarks> public void SetSubjectAreaList(SubjectArea SubjectArea) { RemoveChild(SchoolDTD.SCHOOLGROUPTYPE_SUBJECTAREALIST); AddChild(SchoolDTD.SCHOOLGROUPTYPE_SUBJECTAREALIST, new SubjectAreaList(SubjectArea)); }
///<summary>Sets the value of the <c><StandardIdentifier></c> element.</summary> /// <param name="YearCreated">This represents the year that this specific learning standard was created. This is important to indicate as standards are updated to reflect the appropriate year it was created. This would be assigned and unique to the standard setting body.</param> /// <param name="SubjectArea">This represents the subject or content area this learning standard addresses. This would be assigned and unique to the standard setting body.\</param> /// <param name="StandardNumber">This is the specific number of the standard. For example, if the subject is mathematics and this standard is Patterns, Functions and Algebra, this would be StandardNumber 1. This would be assigned and unique to the standard setting body.</param> /// <param name="GradeLevels">This represents the grade level(s) this specific learning standard will address. This may be addressed in different ways. Some states have a grade level that covers several grades and others have just one grade. This would be assigned and unique to the standard setting body.</param> /// <param name="Organization">Name of organization represented by the document, i.e., "National Council of Teachers of Mathematics (NCTM)," "Washington," "Seattle School District." This is the name of the organization that has this AlternateIdentificationCode. This should be a text field.</param> ///<remarks> /// <para>This form of <c>setStandardIdentifier</c> is provided as a convenience method /// that is functionally equivalent to the <c>StandardIdentifier</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.2</para> /// </remarks> public void SetStandardIdentifier(int?YearCreated, SubjectArea SubjectArea, string StandardNumber, GradeLevels GradeLevels, string Organization) { RemoveChild(InstrDTD.LEARNINGSTANDARDITEM_STANDARDIDENTIFIER); AddChild(InstrDTD.LEARNINGSTANDARDITEM_STANDARDIDENTIFIER, new StandardIdentifier(YearCreated, SubjectArea, StandardNumber, GradeLevels, Organization)); }
///<summary>Sets the value of the <c><AssetSubjects></c> element.</summary> /// <param name="SubjectArea">Subject matter.</param> ///<remarks> /// <para>This form of <c>setAssetSubjects</c> is provided as a convenience method /// that is functionally equivalent to the <c>AssetSubjects</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.6</para> /// </remarks> public void SetAssetSubjects(SubjectArea SubjectArea) { RemoveChild(Sif3assessmentDTD.SIF3ASSESSMENTASSET_ASSETSUBJECTS); AddChild(Sif3assessmentDTD.SIF3ASSESSMENTASSET_ASSETSUBJECTS, new SubjectAreaList(SubjectArea)); }
///<summary>Sets the value of the <c><SubjectAreas></c> element.</summary> /// <param name="SubjectArea">Subject matter.</param> ///<remarks> /// <para>This form of <c>setSubjectAreas</c> is provided as a convenience method /// that is functionally equivalent to the <c>SubjectAreas</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.4</para> /// </remarks> public void SetSubjectAreas(SubjectArea SubjectArea) { RemoveChild(LearningDTD.LEARNINGSTANDARDDOCUMENT_SUBJECTAREAS); AddChild(LearningDTD.LEARNINGSTANDARDDOCUMENT_SUBJECTAREAS, new SubjectAreaList(SubjectArea)); }
///<summary>Sets the value of the <c><SubjectAreas></c> element.</summary> /// <param name="SubjectArea">Subject matter.</param> ///<remarks> /// <para>This form of <c>setSubjectAreas</c> is provided as a convenience method /// that is functionally equivalent to the <c>SubjectAreas</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.4</para> /// </remarks> public void SetSubjectAreas(SubjectArea SubjectArea) { RemoveChild(LearningDTD.LEARNINGRESOURCE_SUBJECTAREAS); AddChild(LearningDTD.LEARNINGRESOURCE_SUBJECTAREAS, new SubjectAreaList(SubjectArea)); }
///<summary>Sets the value of the <c><SubjectAreaList></c> element.</summary> /// <param name="SubjectArea">Subject matter.</param> ///<remarks> /// <para>This form of <c>setSubjectAreaList</c> is provided as a convenience method /// that is functionally equivalent to the <c>SubjectAreaList</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.3</para> /// </remarks> public void SetSubjectAreaList(SubjectArea SubjectArea) { RemoveChild(StudentDTD.SCHOOLCOURSEINFO_SUBJECTAREALIST); AddChild(StudentDTD.SCHOOLCOURSEINFO_SUBJECTAREALIST, new SubjectAreaList(SubjectArea)); }