Exemple #1
0
 public static SchoolTerm ToModel(this attendance_term row)
 {
     return(new SchoolTerm()
     {
         id = row.id.ToString(),
         startDayList = DateHelper.GetDayList(row.startdate.Day),
         startMonthList = DateHelper.GetMonthList(row.startdate.Month),
         endDayList = DateHelper.GetDayList(row.enddate.Day),
         endMonthList = DateHelper.GetMonthList(row.enddate.Month),
         schooldays = row.days,
         year = row.year,
         termid = row.termid,
         term = row.school_term.name
     });
 }
Exemple #2
0
        public ActionResult TermsSave(SchoolTermJSON[] schools)
        {
            foreach (var school in schools)
            {
                foreach (var entry in school.terms)
                {
                    var term = new attendance_term();
                    if (entry.entryid.HasValue)
                    {
                        term = db.attendance_terms.Single(x => x.id == entry.entryid.Value);
                    }
                    else
                    {
                        term.schoolid = school.id;
                        term.year     = school.year;
                        db.attendance_terms.InsertOnSubmit(term);
                    }

                    term.termid    = entry.termid;
                    term.startdate = new DateTime(school.year, entry.startmonth, entry.startday);
                    term.enddate   = new DateTime(school.year, entry.endmonth, entry.endday);
                    term.days      = entry.total;
                }
            }

            try
            {
                repository.Save();
            }
            catch (Exception ex)
            {
                return(SendJsonErrorResponse(ex));
            }

            return(Json("Attendance Days saved successfully".ToJsonOKMessage()));
        }