Exemplo n.º 1
0
        private static List <WorkFlow.Models.Job> GetDBJobs()
        {
            List <WorkFlow.Models.Job> jobs = new List <WorkFlow.Models.Job>();

            DAL objDal = new DAL();

            object[][] objParam = new object[][]
            {
                new object[] { "@status", -1 }
            };

            DataSet dsResult = objDal.ExecuteDS("spGetJobList", objParam);

            if (dsResult != null && dsResult.Tables.Count > 0)
            {
                foreach (DataRow row in dsResult.Tables[0].Rows)
                {
                    WorkFlow.Models.Job j1 = new WorkFlow.Models.Job()
                    {
                        JobCode     = row["referenceid"].ToString(),
                        Title       = row["title"].ToString(),
                        Location    = row["location"].ToString(),
                        Description = row["description"].ToString(),
                        Link        = "",
                        PubDate     = row["publisheddate"].ToString(),
                        StartDate   = row["startdate"].ToString(),
                        EndDate     = row["enddate"].ToString(),
                        IsActive    = Convert.ToInt32(row["isactive"])
                    };
                    jobs.Add(j1);
                }
            }

            return(jobs);
        }
Exemplo n.º 2
0
        private static List <WorkFlow.Models.Job> GetXMLFeedJobs()
        {
            List <WorkFlow.Models.Job> jobs = new List <WorkFlow.Models.Job>();
            XmlDocument rssXmlDoc           = new XmlDocument();
            string      path = ConfigurationManager.AppSettings["XMLFeedPath"].ToString();

            /* Start - Below code is required for JobsDiva site. */
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(path);

            /* End - Above code is required for JobsDiva site. */

            rssXmlDoc.Load(path);

            // Parse the Items in the site
            XmlNodeList rssNodes = rssXmlDoc.SelectNodes("outertag/jobs/job");

            StringBuilder rssContent = new StringBuilder();

            // Iterate through the items in the RSS file
            foreach (XmlNode rssNode in rssNodes)
            {
                string  title, jobCode, location, description, pubDate, startDate, endDate, rateMin, rateMax;
                XmlNode rssSubNode = rssNode.SelectSingleNode("title");
                title = rssSubNode != null ? rssSubNode.InnerText : string.Empty;

                rssSubNode = rssNode.SelectSingleNode("jobdiva_no");
                jobCode    = rssSubNode != null ? rssSubNode.InnerText : string.Empty;

                rssSubNode = rssNode.SelectSingleNode("location");
                location   = rssSubNode != null ? rssSubNode.InnerText : string.Empty;

                rssSubNode  = rssNode.SelectSingleNode("jobdescription");
                description = rssSubNode != null ? rssSubNode.InnerText : string.Empty;

                rssSubNode = rssNode.SelectSingleNode("issuedate");
                pubDate    = rssSubNode != null ? rssSubNode.InnerText : string.Empty;

                rssSubNode = rssNode.SelectSingleNode("startdate");
                startDate  = rssSubNode != null ? rssSubNode.InnerText : string.Empty;

                rssSubNode = rssNode.SelectSingleNode("endddate");
                endDate    = rssSubNode != null ? rssSubNode.InnerText : string.Empty;

                rssSubNode = rssNode.SelectSingleNode("ratemin");
                rateMin    = rssSubNode != null ? rssSubNode.InnerText : null;

                rssSubNode = rssNode.SelectSingleNode("ratemax");
                rateMax    = rssSubNode != null ? rssSubNode.InnerText : null;

                WorkFlow.Models.Job job = new WorkFlow.Models.Job()
                {
                    Title       = title,
                    JobCode     = jobCode,
                    Location    = location,
                    Description = description,
                    PubDate     = pubDate,
                    StartDate   = startDate,
                    EndDate     = endDate,
                    RateMin     = rateMin,
                    RateMax     = rateMax
                };

                jobs.Add(job);
            }

            return(jobs);
        }
Exemplo n.º 3
0
        private static List <WorkFlow.Models.Job> GetRSSFeedJobs()
        {
            XmlDocument rssXmlDoc = new XmlDocument();

            // Load the RSS file from the RSS URL
            rssXmlDoc.Load(ConfigurationManager.AppSettings["RSSFeedPath"].ToString());

            // Parse the Items in the RSS file
            XmlNodeList rssNodes = rssXmlDoc.SelectNodes("rss/channel/item");

            StringBuilder rssContent = new StringBuilder();

            List <WorkFlow.Models.Job> jobs = new List <WorkFlow.Models.Job>();

            // Iterate through the items in the RSS file
            foreach (XmlNode rssNode in rssNodes)
            {
                XmlNode rssSubNode = rssNode.SelectSingleNode("title");
                string  title      = rssSubNode != null ? rssSubNode.InnerText : "";

                rssSubNode = rssNode.SelectSingleNode("link");
                string link = rssSubNode != null ? rssSubNode.InnerText : "";

                rssSubNode = rssNode.SelectSingleNode("description");
                string description = rssSubNode != null ? rssSubNode.InnerText : "";

                rssSubNode = rssNode.SelectSingleNode("pubDate");
                //string pubDate = rssSubNode != null ? rssSubNode.InnerText : "";
                string pubDate = rssSubNode != null?getDateTime(rssSubNode.InnerText) : "";

                rssContent.Append("<a href='" + link + "'>" + title + "</a><br>" + description);

                string loc = string.Empty, jobCode = string.Empty;

                if (!string.IsNullOrWhiteSpace(title))
                {
                    loc = title.Substring(title.IndexOf(") -") + 3);

                    if (!string.IsNullOrWhiteSpace(loc))
                    {
                        title = title.Replace(loc, "").Trim();
                        loc   = loc.Trim();
                    }

                    string data = title.Substring(title.LastIndexOf("(") + 1);

                    title = title.Replace(data, "").Trim();
                    title = title.Substring(0, title.Length - 1).Trim();

                    if (!string.IsNullOrWhiteSpace(data))
                    {
                        jobCode = data.Substring(0, data.LastIndexOf(")"));
                    }
                }

                WorkFlow.Models.Job job = new WorkFlow.Models.Job()
                {
                    Title       = title,
                    JobCode     = jobCode,
                    Location    = loc,
                    Link        = link,
                    Description = description,
                    PubDate     = pubDate
                };

                jobs.Add(job);
            }

            return(jobs);
        }