public ActionResult ChoosePage(string catchAllRoute)
        {
            string[] routeValues = catchAllRoute.Split('/');

            // career name - look at blob storage for that name, if found display career page
            if (routeValues[0] != null)
            {
                //Regex reg = new Regex(@"[^a-zA-Z0-9]+");
                string Profession = routeValues[0].ToLower();
                //Profession = reg.Replace(Profession, "-");
                BlobJsonResourceManager blobManager = new BlobJsonResourceManager();
                string str = blobManager.GetJsonResource("careers", "dolcodes", Profession + ".js");
                if (!string.IsNullOrEmpty(str))
                {
                    Regex  regex   = new Regex(@"\d{2}-\d{4}");
                    string dolcode = regex.Match(str).ToString();
                    ViewBag.Dolcode    = dolcode;
                    ViewBag.profession = Profession;
                    string descriptionBlog = blobManager.GetJsonResource("careers", "bydolcode/" + dolcode, "description.js");
                    regex = new Regex(@"\{([^}]+)\}");
                    string description = regex.Match(descriptionBlog).ToString().Substring(8);
                    description           = description.Substring(0, description.Length - 2).Replace("|", " ");
                    ViewBag.OgDescription = description;
                    string ogTitle = Profession.Replace("-", " ");
                    ViewBag.OgTitle = ogTitle.Substring(0, 1).ToUpper() + ogTitle.Substring(1).ToLower();
                    ViewBag.Title   = ogTitle.Substring(0, 1).ToUpper() + ogTitle.Substring(1).ToLower();
                    return(View("Career"));
                }
            }


            // if nothing else found show 404 error
            return(View("Error"));
        }
        //
        // GET: /Career/

        public ActionResult Index(string Profession)
        {
            if (Profession != null)
            {
                BlobJsonResourceManager blobManager = new BlobJsonResourceManager();
                string str = blobManager.GetJsonResource("careers", "dolcodes", Profession + ".js");
                if (str != "")
                {
                    Regex  regex   = new Regex(@"\d{2}-\d{4}");
                    string dolcode = regex.Match(str).ToString();
                    ViewBag.Dolcode    = dolcode;
                    ViewBag.profession = Profession;
                    string descriptionBlog = blobManager.GetJsonResource("careers", "bydolcode/" + dolcode, "description.js");
                    regex = new Regex(@"\{([^}]+)\}");
                    string description = regex.Match(descriptionBlog).ToString().Substring(8);
                    description           = description.Substring(0, description.Length - 2).Replace("|", " ");
                    ViewBag.OgDescription = description;
                    string ogTitle = Profession.Replace("-", " ");
                    ViewBag.OgTitle = ogTitle.Substring(0, 1).ToUpper() + ogTitle.Substring(1).ToLower();
                    return(View());
                }
            }
            return(RedirectToAction("Index", "Careers"));
        }
Exemple #3
0
        public List <object> FindPositions(HttpRequestBase Request, string zipcode, string attributes, string things, string gender, string programid)
        {
            bool demomode = Request["demo"] != null && Request["demo"] == "1";

            LeadCounterClient  leadcounterclient = new LeadCounterClient();
            List <LeadCounter> leadcounters      = null;

            LeadCapClient  leadcapclient = new LeadCapClient();
            List <LeadCap> leadcaps      = null;

            List <object> results = new List <object>();

            bool validprogramcategoryid = false;

            if (programid != "" && !programid.StartsWith("c"))
            {
                validprogramcategoryid = true;
            }

            //ZipCodeClient zipclient = new ZipCodeClient();
            //ZipCode zipobject = zipclient.GetByRowKey(zipcode);
            BlobJsonResourceManager blobmgr = new BlobJsonResourceManager();
            string  zipjson = blobmgr.GetJsonResource("skillcow", "zipcodes", zipcode);
            JObject jzip    = null;

            if (zipjson != "")
            {
                jzip = JObject.Parse(zipjson);
            }

            GeoIndexNationalClient      nclient             = new GeoIndexNationalClient();
            GeoIndexAddStateClient      addstateclient      = new GeoIndexAddStateClient();
            GeoIndexAddZipClient        addzipclient        = new GeoIndexAddZipClient();
            GeoIndexSubtractStateClient subtractstateclient = new GeoIndexSubtractStateClient();
            GeoIndexSubtractZipClient   subtractzipclient   = new GeoIndexSubtractZipClient();

            List <IGeoIndex> allresults   = new List <IGeoIndex>();
            List <IGeoIndex> subtractions = new List <IGeoIndex>();

            //By program id
            if (validprogramcategoryid)
            {
                allresults.AddRange(nclient.GetAllByPartition(programid));
                if (jzip != null)
                {
                    //allresults.AddRange(addstateclient.GetAllByPartition(zipobject.StateCode + "-" + programid));
                    allresults.AddRange(addstateclient.GetAllByPartition(jzip["statecode"].ToString() + "-" + programid));
                    allresults.AddRange(addzipclient.GetAllByPartition(zipcode + "-" + programid));
                }

                if (jzip != null)
                {
                    //subtractions.AddRange(subtractstateclient.GetAllByPartition(zipobject.StateCode + "-" + programid));
                    subtractions.AddRange(subtractstateclient.GetAllByPartition(jzip["statecode"].ToString() + "-" + programid));
                    subtractions.AddRange(subtractzipclient.GetAllByPartition(zipcode + "-" + programid));
                }
            }
            else
            {
                allresults.AddRange(nclient.GetAllByPartition("attr"));
                if (jzip != null)
                {
                    //allresults.AddRange(addstateclient.GetAllByPartition(zipobject.StateCode));
                    allresults.AddRange(addstateclient.GetAllByPartition(jzip["statecode"].ToString()));
                    allresults.AddRange(addzipclient.GetAllByPartition(zipcode));
                }

                if (jzip != null)
                {
                    //subtractions.AddRange(subtractstateclient.GetAllByPartition(zipobject.StateCode));
                    subtractions.AddRange(subtractstateclient.GetAllByPartition(jzip["statecode"].ToString()));
                    subtractions.AddRange(subtractzipclient.GetAllByPartition(zipcode));
                }
            }

            IEnumerable <IGeoIndex> difference = allresults.Except(subtractions, new CompareGeoIndexResults());

            DirectEmployerClientClient              clientclient  = new DirectEmployerClientClient();
            DirectEmployerClientCampusClient        campusclient  = new DirectEmployerClientCampusClient();
            DirectEmployerClientCampusProgramClient programclient = new DirectEmployerClientCampusProgramClient();

            JObject oattributes = null;
            JObject othings     = null;

            long attributemask       = 0;
            long importantthingsmask = 0;

            if (attributes != null && attributes != "")
            {
                oattributes = JObject.Parse(attributes);
                AttributeMaskCalculator amc = new AttributeMaskCalculator();
                attributemask = amc.GetMask(oattributes);
            }
            if (things != null && things != "")
            {
                othings = JObject.Parse(things);
                ImportantThingsMaskCalculator itmc = new ImportantThingsMaskCalculator();
                importantthingsmask = itmc.GetMask(othings);
            }

            foreach (IGeoIndex geoindex in allresults)
            {
                if (geoindex.AttributeMask != null && (geoindex.AttributeMask & attributemask) == attributemask)
                {
                    DirectEmployerClientCampusProgram job = programclient.GetByRowKey(geoindex.RowKey);

                    if (job.Status == "Live" || (demomode == true && job.Status == "Demo"))
                    {
                        bool filtered = false;
                        //Apply other filters
                        if (gender != "" && job.Gender != null && job.Gender != "")
                        {
                            if (job.Gender != gender)
                            {
                                filtered = true;
                            }
                        }

                        if (!filtered)
                        {
                            DirectEmployerClientCampus campus   = campusclient.GetByRowKey(geoindex.CampusRowKey);
                            DirectEmployerClient       employer = clientclient.GetByRowKey(geoindex.ClientRowKey);

                            bool acceptingleads = false;

                            if (employer.Status == "Live" || (demomode == true && employer.Status == "Demo"))
                            {
                                if (campus.Status == "Live" || (demomode == true && campus.Status == "Demo"))
                                {
                                    //List<DirectEmployerClientCampusProgram> campusprograms = new List<DirectEmployerClientCampusProgram>(programclient.GetAllByClientId(employer.RowKey).Where(x => x.CampusRowKey == campus.RowKey));
                                    if (leadcounters == null)
                                    {
                                        leadcounters = new List <LeadCounter>(leadcounterclient.GetAll());
                                        leadcaps     = new List <LeadCap>(leadcapclient.GetAll());
                                    }

                                    LeadCap     schoolcap      = leadcaps.Find(x => x.RowKey == employer.RowKey);
                                    LeadCap     programcap     = leadcaps.Find(x => x.RowKey == job.RowKey);
                                    LeadCounter schoolcounter  = leadcounters.Find(x => x.RowKey == employer.RowKey);
                                    LeadCounter programcounter = leadcounters.Find(x => x.RowKey == job.RowKey);

                                    acceptingleads = AcceptingLeads(schoolcap, programcap, schoolcounter, programcounter);
                                    if (acceptingleads)
                                    {
                                        results.Add(new
                                        {
                                            clienttype   = employer.ClientType,
                                            clientid     = employer.ClientId,
                                            clientsetid  = employer.ClientId,
                                            logoclientid = employer.ClientId,
                                            program      = programid,
                                            formid       = employer.FormId,
                                            distance     = 0,
                                            campustype   = campus.CampusType,
                                            campuskey    = campus.CampusId,
                                            programkey   = geoindex.RowKey,
                                            clientrowkey = employer.RowKey,

                                            jobkey      = job.RowKey,
                                            jobtitle    = job.JobTitle,
                                            company     = employer.Name.ToJSONSafeString(),
                                            companylogo = "https://chaindate.blob.core.windows.net/resources/employerlogos/" + employer.ClientType + employer.RowKey,
                                            city        = campus.City,
                                            state       = campus.State,
                                            date        = job.PostedDateTime.ToString("ddd, dd MMM yyyy HH:mm:ss") + " GMT",
                                            snippet     = job.Description,

                                            attributescore       = oattributes != null ? job.GetAttributeScore(oattributes) : 0,
                                            importantthingsscore = othings != null ? job.GetImportantThingsScore(othings) : 0
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(results);
        }