Example #1
0
        public List <TwoColumn> SearchByTypeName(string type, string Query, int PageIndex, int PageSize)
        {
            string           procName = GetProcSearchName(type);
            List <TwoColumn> list     = null;

            _data.ExecuteCmd(procName
                             , inputParamMapper : delegate(SqlParameterCollection inputCollection)
            {
                inputCollection.AddWithValue("@PageIndex", PageIndex);
                inputCollection.AddWithValue("@PageSize", PageSize);
                inputCollection.AddWithValue("@Query", Query);
            }
                             , singleRecordMapper : delegate(IDataReader reader, short set)
            {
                TwoColumn twoColumn = MapTwoColumns(reader);

                if (list == null)
                {
                    list = new List <TwoColumn>();
                }

                list.Add(twoColumn);
            });

            return(list);
        }
Example #2
0
        private static TwoColumn MapTwoColumns(IDataReader reader)
        {
            TwoColumn twoColumn     = new TwoColumn();
            int       startingIndex = 0;

            twoColumn.Id   = reader.GetSafeInt32(startingIndex++);
            twoColumn.Name = reader.GetSafeString(startingIndex++);
            return(twoColumn);
        }
Example #3
0
        public Paged <Job> GetByCurrent(int createdBy, int pageIndex, int pageSize)
        {
            string             procName     = "[dbo].[Openings_Select_ByCreatedBy_V2]";
            Paged <Job>        pagedResult  = null;
            List <Job>         result       = null;
            Job                job          = null;
            OrganizationSelect organization = null;
            TwoColumn          jobType      = null;
            LocationInfo       location     = null;
            UserProfile        userProfile  = null;
            int                totalCount   = 0;

            _data.ExecuteCmd(procName,
                             inputParamMapper : delegate(SqlParameterCollection parameterCollection)
            {
                parameterCollection.AddWithValue("@CreatedBy", createdBy);
                parameterCollection.AddWithValue("@PageIndex", pageIndex);
                parameterCollection.AddWithValue("@PageSize", pageSize);
            },
                             singleRecordMapper : delegate(IDataReader reader, short set)
            {
                job          = new Job();
                organization = new OrganizationSelect();
                jobType      = new TwoColumn();
                location     = new LocationInfo();
                userProfile  = new UserProfile();
                MapJob(reader, job, organization, jobType, location, userProfile);

                if (totalCount == 0)
                {
                    totalCount = reader.GetSafeInt32(26);
                }

                if (result == null)
                {
                    result = new List <Job>();
                }

                if (job.CreatedBy.Id == createdBy)
                {
                    result.Add(job);
                }
            });

            if (result != null)
            {
                pagedResult = new Paged <Job>(result, pageIndex, pageSize, totalCount);
            }

            return(pagedResult);
        }
Example #4
0
        public List <TwoColumn> GetByTypeName(string type)
        {
            string           procName = GetProcName(type);
            List <TwoColumn> list     = null;

            _data.ExecuteCmd(procName, inputParamMapper : null
                             , singleRecordMapper : delegate(IDataReader reader, short set)
            {
                TwoColumn twoColumn = MapTwoColumns(reader);

                if (list == null)
                {
                    list = new List <TwoColumn>();
                }

                list.Add(twoColumn);
            });

            return(list);
        }
Example #5
0
        public Job Get(int Id)
        {
            string             procName     = "[dbo].[Openings_Details_ById]";
            Job                job          = null;
            OrganizationSelect organization = null;
            TwoColumn          jobType      = null;
            LocationInfo       location     = null;
            UserProfile        userProfile  = null;

            _data.ExecuteCmd(procName, delegate(SqlParameterCollection jobCol)
            {
                jobCol.AddWithValue("@Id", Id);
            }, delegate(IDataReader reader, short set)
            {
                job          = new Job();
                organization = new OrganizationSelect();
                jobType      = new TwoColumn();
                location     = new LocationInfo();
                userProfile  = new UserProfile();
                MapJob(reader, job, organization, jobType, location, userProfile);
            });

            return(job);
        }
Example #6
0
        private static void SwitchTypes(short set, IDataReader reader, ProviderTypes provider)
        {
            switch (set)
            {
            case 0:
                TwoColumn languages = MapTwoColumns(reader);

                if (provider.Languages == null)
                {
                    provider.Languages = new List <TwoColumn>();
                }

                provider.Languages.Add(languages);
                break;

            case 1:
                TwoColumn daysOfWeek = MapTwoColumns(reader);

                if (provider.DaysOfWeek == null)
                {
                    provider.DaysOfWeek = new List <TwoColumn>();
                }

                provider.DaysOfWeek.Add(daysOfWeek);
                break;

            case 2:
                TwoColumn concernTypes = MapTwoColumns(reader);

                if (provider.ConcernTypes == null)
                {
                    provider.ConcernTypes = new List <TwoColumn>();
                }

                provider.ConcernTypes.Add(concernTypes);
                break;

            case 3:

                TwoColumn expertiseTypes = MapTwoColumns(reader);

                if (provider.ExpertiseTypes == null)
                {
                    provider.ExpertiseTypes = new List <TwoColumn>();
                }

                provider.ExpertiseTypes.Add(expertiseTypes);
                break;

            case 4:
                TwoColumn licenseTypes = MapTwoColumns(reader);

                if (provider.LicenseTypes == null)
                {
                    provider.LicenseTypes = new List <TwoColumn>();
                }

                provider.LicenseTypes.Add(licenseTypes);
                break;

            case 5:
                TwoColumn careNeedsTypes = MapTwoColumns(reader);

                if (provider.CareNeedsTypes == null)
                {
                    provider.CareNeedsTypes = new List <TwoColumn>();
                }

                provider.CareNeedsTypes.Add(careNeedsTypes);
                break;

            case 6:
                TwoColumn certificateTypes = MapTwoColumns(reader);

                if (provider.CertificateTypes == null)
                {
                    provider.CertificateTypes = new List <TwoColumn>();
                }

                provider.CertificateTypes.Add(certificateTypes);
                break;

            case 7:
                TwoColumn helpNeedTypes = MapTwoColumns(reader);

                if (provider.HelpNeedTypes == null)
                {
                    provider.HelpNeedTypes = new List <TwoColumn>();
                }

                provider.HelpNeedTypes.Add(helpNeedTypes);
                break;

            case 8:
                TwoColumn states = MapTwoColumns(reader);

                if (provider.States == null)
                {
                    provider.States = new List <TwoColumn>();
                }

                provider.States.Add(states);
                break;

            case 9:
                TwoColumn providerTypes = MapTwoColumns(reader);

                if (provider.LocationTypes == null)
                {
                    provider.LocationTypes = new List <TwoColumn>();
                }

                provider.LocationTypes.Add(providerTypes);
                break;
            }
        }
Example #7
0
        private static Job MapJob(IDataReader reader, Job job, OrganizationSelect organization, TwoColumn jobType, LocationInfo location, UserProfile userProfile)
        {
            int indexer = 0;

            job.Id                     = reader.GetSafeInt32(indexer++);
            organization.Id            = reader.GetSafeInt32(indexer++);
            organization.OrgName       = reader.GetSafeString(indexer++);
            organization.SiteUrl       = reader.GetSafeString(indexer++);
            organization.Logo          = reader.GetSafeString(indexer++);
            job.Organization           = organization;
            jobType.Id                 = reader.GetSafeInt32(indexer++);
            jobType.Name               = reader.GetSafeString(indexer++);
            job.JobType                = jobType;
            location.Id                = reader.GetSafeInt32(indexer++);
            location.LineOne           = reader.GetSafeString(indexer++);
            location.City              = reader.GetSafeString(indexer++);
            location.Zip               = reader.GetSafeString(indexer++);
            location.StateName         = reader.GetSafeString(indexer++);
            location.StateProvinceCode = reader.GetSafeString(indexer++);
            job.Location               = location;
            userProfile.Id             = reader.GetSafeInt32(indexer++);
            userProfile.FirstName      = reader.GetSafeString(indexer++);
            userProfile.LastName       = reader.GetSafeString(indexer++);
            userProfile.AvatarUrl      = reader.GetSafeString(indexer++);
            job.CreatedBy              = userProfile;
            job.Title                  = reader.GetSafeString(indexer++);
            job.Description            = reader.GetSafeString(indexer++);
            job.Requirements           = reader.GetSafeString(indexer++);
            job.IsActive               = reader.GetSafeBool(indexer++);
            job.ContactName            = reader.GetSafeString(indexer++);
            job.ContactPhone           = reader.GetSafeString(indexer++);
            job.ContactEmail           = reader.GetSafeString(indexer++);
            job.DateCreated            = reader.GetSafeDateTime(indexer++);
            job.DateModified           = reader.GetSafeDateTime(indexer++);
            return(job);
        }