Example #1
0
        public IQueryable <RenwebFamilyResult> ParentsWebFamilySearch(
            int userId = 15328,
            RenwebUserType userType           = RenwebUserType.Parent,
            RenwebDirectoryType directoryType = RenwebDirectoryType.Parent,
            string nameFilter   = "",
            string gradeFilter  = "",
            string classFilter  = "",
            string schoolCode   = "",
            string districtCode = "DIS-TX"
            )
        {
            var request = new pw_sch_directory_familyRequest
            {
                UserID        = userId,
                UserType      = EnumHelper.GetDescription(userType),
                DirectoryType = EnumHelper.GetDescription(directoryType),
                District      = districtCode,
                SchoolCode    = schoolCode,
                Criteria      = gradeFilter,
                FilterName    = nameFilter,
                classCriteria = classFilter
            };

            var client = new pw_sch_directorySoapClient();

            var results = client.pw_sch_directory_family(request)
                          .pw_sch_directory_familyResult
                          .CreateDataReader()
                          .DataReaderMapToList <RenwebFamilyResult>()
                          .AsQueryable();

            return(results);
        }
Example #2
0
        public ActionResult PullFamilyResults(RenwebDirectoryType directoryType = RenwebDirectoryType.Parent, int page = 1, int pageSize = 3)
        {
            var results           = _renwebService.ParentsWebFamilySearch(15328, RenwebUserType.Parent, directoryType).ToList();
            var successfulLoads   = new List <RenwebFamilyResult>();
            var unsuccessfulLoads = new List <RenwebFamilyResult>();

            results.ForEach(x =>
            {
                try
                {
                    var existingResult = _service.RenwebFamilyResults.Get(y => y.personID.Equals(x.personID));
                    if (existingResult == null)
                    {
                        _service.RenwebFamilyResults.Insert(x);
                    }
                    else
                    {
                        Mapper.Map(x, existingResult);
                        _service.RenwebFamilyResults.Update(existingResult);
                    }
                    successfulLoads.Add(x);
                }
                catch
                {
                    unsuccessfulLoads.Add(x);
                }
            });

            var viewModel = new Tuple <IPagedList <RenwebFamilyResult>, List <RenwebFamilyResult> >(
                successfulLoads.OrderBy(x => x.Parents).ToPagedList(page, pageSize),
                unsuccessfulLoads.OrderBy(x => x.Parents).ToList()
                );

            return(View(viewModel));
        }
Example #3
0
        public static void BuildFamilySearch(
            StringBuilder payload,
            RenwebUserType userType           = RenwebUserType.Parent,
            RenwebDirectoryType directoryType = RenwebDirectoryType.Parent,
            int userId          = 15328,
            string nameFilter   = "",
            string gradeFilter  = "",
            string classFilter  = "",
            string schoolCode   = "",
            string districtCode = "DIS-TX"
            )
        {
            var sb = new StringBuilder();

            sb.AppendFormat(@"<ns0:UserType>{0}</ns0:UserType>", EnumHelper.GetDescription(userType));
            sb.AppendFormat(@"<ns0:UserID>{0}</ns0:UserID>", userId);
            sb.AppendFormat(@"<ns0:FilterName>{0}</ns0:FilterName>", nameFilter);
            sb.AppendFormat(@"<ns0:DirectoryType>{0}</ns0:DirectoryType>", EnumHelper.GetDescription(directoryType));
            sb.AppendFormat(@"<ns0:Criteria>{0}</ns0:Criteria>", gradeFilter); // Grade string i.e., CP
            sb.AppendFormat(@"<ns0:classCriteria>{0}</ns0:classCriteria>", classFilter);
            sb.AppendFormat(@"<ns0:SchoolCode>{0}</ns0:SchoolCode>", schoolCode);
            sb.AppendFormat(@"<ns0:District>{0}</ns0:District>", districtCode);

            payload.AppendFormat(@"<ns0:pw_sch_directory_family>{0}</ns0:pw_sch_directory_family>", sb.ToString());
        }
Example #4
0
        public ActionResult FamilyResultsLocal(RenwebDirectoryType directoryType = RenwebDirectoryType.Parent, int page = 1, int pageSize = 50)
        {
            var results = _service.RenwebFamilyResults.GetAll()
                          .OrderBy(x => x.Parents)
                          .ToPagedList(page, pageSize);

            return(View(results));
        }