/// <summary>
        /// Updates or creates a resource based on the resource identifier. The PUT operation is used to update or create a resource by identifier.  If the resource doesn't exist, the resource will be created using that identifier.  Additionally, natural key values cannot be changed using this operation, and will not be modified in the database.  If the resource &quot;id&quot; is provided in the JSON body, it will be ignored as well.
        /// </summary>
        /// <param name="id">A resource identifier specifying the resource to be updated.</param>
        /// <param name="IfMatch">The ETag header value used to prevent the PUT from updating a resource modified by another consumer.</param>
        /// <param name="body">The JSON representation of the &quot;schoolYearType&quot; resource to be updated.</param>
        /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns>
        public IRestResponse PutSchoolYearType(string id, string IfMatch, SchoolYearType body)
        {
            var request = new RestRequest("/schoolYearTypes/{id}", Method.PUT);

            request.RequestFormat = DataFormat.Json;

            request.AddUrlSegment("id", id);
            // verify required params are set
            if (id == null || body == null)
            {
                throw new ArgumentException("API method call is missing required parameters");
            }
            request.AddHeader("If-Match", IfMatch);
            request.AddBody(body);
            request.Parameters.First(param => param.Type == ParameterType.RequestBody).Name = "application/json";
            var response = client.Execute(request);

            var location = response.Headers.FirstOrDefault(x => x.Name == "Location");

            if (location != null && !string.IsNullOrWhiteSpace(location.Value.ToString()))
            {
                body.id = location.Value.ToString().Split('/').Last();
            }
            return(response);
        }
Пример #2
0
        private Grade createGrade(GradeType gradeType, SchoolYearType schoolYear, string sectionId, string studentId, string studentSectionAssocation)
        {
            Grade grade = new Grade();
            grade.gradeType = gradeType;
            grade.schoolYear = schoolYear;
            grade.sectionId = sectionId;
            grade.studentId = studentId;
            grade.studentSectionAssociationId = studentSectionAssocation;

            return grade;
        }
Пример #3
0
        /// <summary>
        /// Creates or updates resources based on the natural key values of the supplied resource. The POST operation can be used to create or update resources. In database terms, this is often referred to as an &quot;upsert&quot; operation (insert + update).  Clients should NOT include the resource &quot;id&quot; in the JSON body because it will result in an error (you must use a PUT operation to update a resource by &quot;id&quot;). The web service will identify whether the resource already exists based on the natural key values provided, and update or create the resource appropriately.
        /// </summary>
        /// <param name="body">The JSON representation of the &quot;schoolYearType&quot; resource to be created or updated.</param>
        /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns>
        public IRestResponse PostSchoolYearTypes(SchoolYearType body)
        {
            var request = new RestRequest("/schoolYearTypes", Method.POST);

            request.RequestFormat = DataFormat.Json;

            // verify required params are set
            if (body == null)
            {
                throw new ArgumentException("API method call is missing required parameters");
            }
            request.AddBody(body);
            var response = client.Execute(request);

            var location = response.Headers.FirstOrDefault(x => x.Name == "Location");

            if (location != null && !string.IsNullOrWhiteSpace(location.Value.ToString()))
            {
                body.id = location.Value.ToString().Split('/').Last();
            }
            return(response);
        }
Пример #4
0
 public static void ShouldBeSchoolYear(this SchoolYearType actual, short expectedSchoolYear, bool isCurrent = false)
 {
     actual.SchoolYear.ShouldBe(expectedSchoolYear);
     actual.SchoolYearDescription.ShouldBe((expectedSchoolYear - 1) + "-" + expectedSchoolYear);
     actual.CurrentSchoolYear.ShouldBe(isCurrent);
 }
        public static WordDocument CreateDocument(Student student, AnnualGoal goal, string teacherName, string gradingPeriod, SchoolYearType year, string campus)
        {
            WordDocument doc = WordFactory.Document();

            doc = doc.AddTitle("Special Education");
            doc = doc.AddTitle("Data Collection Sheet");
            doc = doc.AddStudentInfo(student.GetFullName(), student.LocalID, student.DateOfBirth, student.Gender, student.Grade, campus, year, teacherName, gradingPeriod);
            doc = doc.AddGoal(goal);
            return(doc);
        }
Пример #6
0
 public static WordDocument ProcessDocument(this WordDocument doc, Student student, AnnualGoal goal, string teacherName, string gradingPeriod, SchoolYearType year, string campus, bool last)
 {
     doc = doc.AddTitle("Special Education");
     doc = doc.AddTitle("Data Collection Sheet");
     doc = doc.AddStudentInfo(student.GetFullName(), student.LocalID, student.DateOfBirth, student.Gender, student.Grade, campus, year, teacherName, gradingPeriod);
     doc = doc.AddGoal(goal, true, last);
     return(doc);
 }
Пример #7
0
        public static WordDocument AddStudentInfo(this WordDocument source, string name, string id, string dob, GenderType gender, string grade, string campus, SchoolYearType schoolYear, string teacherName, string gradingPeriod)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            if (dob == null)
            {
                throw new ArgumentNullException(nameof(dob));
            }

            if (grade == null)
            {
                throw new ArgumentNullException(nameof(grade));
            }

            if (campus == null)
            {
                throw new ArgumentNullException(nameof(campus));
            }

            if (teacherName == null)
            {
                throw new ArgumentNullException(nameof(teacherName));
            }

            if (gradingPeriod == null)
            {
                throw new ArgumentNullException(nameof(gradingPeriod));
            }

            DateTime zeroTime = new DateTime(1, 1, 1);
            var      age      = DateTime.Now - DateTime.Parse(dob);
            int      years    = (zeroTime + age).Year - 1;

            string school_year;

            switch (schoolYear)
            {
            case SchoolYearType._2019_2020:
                school_year = "2019-2020";
                break;

            default:
                school_year = "2020-2021";
                break;
            }

            return(source.AddParagraph(WordFactory.Paragraph(
                                           HorizontalAlignmentType.Left,
                                           WordFactory.Text("Name: "),
                                           WordFactory.UnderlineText(name).AppendTab(),
                                           WordFactory.Text("\t DOB: "),
                                           WordFactory.UnderlineText(dob).AppendTab(),
                                           WordFactory.Text("\t ID#: "),
                                           WordFactory.UnderlineText(id).AppendTab(),
                                           WordFactory.Text("\t Age: "),
                                           WordFactory.UnderlineText(years.ToString()).AppendTab(),
                                           WordFactory.Text("\t Gender: "),
                                           WordFactory.UnderlineText(gender.ToString()).AppendTab(),
                                           WordFactory.Text("\t Grade: "),
                                           WordFactory.UnderlineText(grade).AppendTab().AppendCarriageReturn().AppendCarriageReturn(),
                                           WordFactory.Text("School Year: "),
                                           WordFactory.UnderlineText(school_year).AppendTab(),
                                           WordFactory.Text("\t Campus: "),
                                           WordFactory.UnderlineText(campus).AppendTab(),
                                           WordFactory.Text("\t Reviewer: "),
                                           WordFactory.UnderlineText(teacherName).AppendTab().AppendCarriageReturn().AppendCarriageReturn(),
                                           WordFactory.Text("Grading Period: "),
                                           WordFactory.UnderlineText(gradingPeriod).AppendTab(),
                                           WordFactory.Text("\t Documentation Date: "),
                                           WordFactory.UnderlineText("                   ").AppendTab(),
                                           WordFactory.Text("\t Goal Result: "),
                                           WordFactory.UnderlineText("                   ").AppendTab().AppendCarriageReturn()
                                           )));
        }