Пример #1
0
        public string GetHostelBoardersInformationBySchoolID(int schoolID)
        {
            string results          = string.Empty;
            JavaScriptSerializer js = new JavaScriptSerializer();

            try
            {
                SurveyRepository   _repo = new SurveyRepository();
                HostelBoarderModel data  = _repo.GetHostelBoarderInformationBySchoolID(schoolID);

                results = js.Serialize(new { Message = "Success", Data = data });
            }
            catch (Exception ex)
            {
                results = js.Serialize(new { Message = string.Format("Error - {0}", ex.Message) });
            }

            return(results);
        }
        public static HostelBoarderModel Map(this HostelBoarder original)
        {
            if (original == null)
            {
                return(null);
            }

            var row = new HostelBoarderModel()
            {
                ID = original.ID,
                NoOfLearnersAdmittedToTheHostelInJanuary2020Male          = original.NoOfLearnersAdmittedToTheHostelInJanuary2020Male,
                NoOfLearnersAdmittedToTheHostelInJanuary2020Female        = original.NoOfLearnersAdmittedToTheHostelInJanuary2020Female,
                DidTheSchoolApplyTheRelevantPhysicalDistancingMealTime    = original.DidTheSchoolApplyTheRelevantPhysicalDistancingMealTime,
                DidTheSchoolApplyTheRelevantPhysicalDistancingStudyTime   = original.DidTheSchoolApplyTheRelevantPhysicalDistancingStudyTime,
                DidTheSchoolApplyTheRelevantPhysicalDistancingLeisureTime = original.DidTheSchoolApplyTheRelevantPhysicalDistancingLeisureTime,
                DidTheSchoolIncreaseTheFrequencyOfCleaningAtTheHostel     = original.DidTheSchoolIncreaseTheFrequencyOfCleaningAtTheHostel,
                WereTheLearnersProvidedWithAdequatePPEs          = original.WereTheLearnersProvidedWithAdequatePPEs,
                WereTheLearnersProvidedWithAdequateHandSanitiser = original.WereTheLearnersProvidedWithAdequateHandSanitiser,
                SchoolID   = original.SchoolID,
                DateLogged = original.DateLogged
            };

            return(row);
        }
Пример #3
0
        public string SaveHostelBoardersInformation(HostelBoarderModel hostelBoarderInformation)
        {
            string               results    = string.Empty;
            List <string>        resultList = new List <string>();
            JavaScriptSerializer js         = new JavaScriptSerializer();

            try
            {
                SurveyRepository   repo = new SurveyRepository();
                HostelBoarderModel data = repo.SaveHostelBoarderInformation(hostelBoarderInformation);

                if (data.ID > 0)
                {
                    resultList.Add("Success");
                }
            }
            catch (Exception ex)
            {
                resultList.Add(string.Format("Error - {0}", ex.Message));
            }

            results = js.Serialize(resultList);
            return(results);
        }