Example #1
0
        /*
         *    NotificationsController nc = new NotificationsController();
         *    ProjectsController pc = new ProjectsController();
         *    JobsController jc = new JobsController();
         *
         *    IEnumerable<Notification> notifications = nc.GetNotifications();
         *
         *    var sb = new StringBuilder();
         *
         *    foreach (var n in notifications)
         *    {
         *        System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var n.id = " + n.id);
         *        System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var n.jobUuid = " + n.jobUuid);
         *        System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var n.projectUuid = " + n.projectUuid);
         *
         *        if (!string.IsNullOrWhiteSpace(n.jobUuid))
         *        {
         *
         *            Job j = jc.GetJobByUuid(n.jobUuid);
         *            List<Company> jCompanies = jc.GetAllCompaniesRelatedToJob(j);
         *
         *            System.Diagnostics.Debug.WriteLine(
         *            "ViktorTestView - NotificationsFromDb_OnClicked: companies.Count = " + jCompanies.Count());
         *            j.companies = jCompanies;
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var n.projectUuid = " + n.projectUuid);
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.uuid = " + j.uuid);
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.title = " + j.title);
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.webpage = " + j.webpage);
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: p.companies.Count = " + j.companies.Count);
         *
         *            try
         *            {
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.companies[0].name = " + j.companies[0].name);
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.companies[0].logo " + j.companies[0].logo);
         *
         *                var text = string.Format("title: {0}, company: {1}, published: {2}, webpage: {3}, logo: {4}, expiryDate: {5}",
         *                    j.title, j.companies[0].name, j.published,
         *                    j.webpage, j.companies[0].logo, j.expiryDate);
         *
         *
         *                //job.companies.Select(c => new { c.id }));
         *                sb.AppendLine(text);
         *            }
         *            catch (Exception ex)
         *            {
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: Exception msg: " + ex.Message);
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: Stack Trace: \n" + ex.StackTrace);
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: End Of Stack Trace");
         *            }
         *
         *        }
         *
         *        else
         *        {
         *            Project p = pc.GetProjectByUuid(n.projectUuid);
         *            List<Company> pCompanies = pc.GetAllCompaniesRelatedToProject(p);
         *            System.Diagnostics.Debug.WriteLine(
         *                "ViktorTestView - NotificationsFromDb_OnClicked: companies.Count = " + pCompanies.Count());
         *            p.companies = pCompanies;
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var n.projectUuid = " + n.projectUuid);
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.uuid = " + p.uuid);
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.title = " + p.title);
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.webpage = " + p.webpage);
         *            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: p.companies.Count = " + p.companies.Count);
         *
         *            try
         *            {
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.companies[0].name = " + p.companies[0].name);
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: var p.companies[0].logo " + p.companies[0].logo);
         *
         *                //var text = string.Format("title: {0}, published: {1}, webpage: {2}", p.title,  p.published, p.webpage);
         *
         *                var text = string.Format("title: {0}, company: {1}, published: {2}, webpage: {3}, logo: {4}",
         *                    p.title, p.companies[0].name, p.published,
         *                    p.webpage, p.companies[0].logo);
         *                //job.companies.Select(c => new { c.id }));
         *
         *                sb.AppendLine(text);
         *            }
         *            catch (Exception ex)
         *            {
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: Exception msg: " + ex.Message);
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: Stack Trace: \n" + ex.StackTrace);
         *                System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: End Of Stack Trace");
         *            }
         *        }
         *
         *
         *
         *
         *    }
         *    TextBox.Text = sb.ToString();
         *    }
         */
        private async void GetAllJobsFromWebApi_OnClicked(object sender, EventArgs e)
        {
            JobsController    jc   = new JobsController();
            IEnumerable <Job> jobs = await jc.GetJobsBasedOnFilter();

            if (!Authenticater.Authorized)
            {
                GoToLogin();
            }
            if (jobs != null)
            {
                System.Diagnostics.Debug.WriteLine("GetJobsBasedOnFilter: jobs.Count(): " +
                                                   jobs.Count());
            }
        }
        private async Task AddData()
        {
            //Dictionary<string, string> filter = new Dictionary<string, string>(); //contains only one item from each group
            //filter.Add("courses", "DAT-304");
            //filter.Add("types", "virksomhet");

            //if (pullList == false)
            //{
            //}
            //else if (pullList == true)
            //{
            JobsController jc = new JobsController();

            IEnumerable <Job> jobs = await jc.GetJobsBasedOnFilter(LISTINIT.GetSettings(), null);

            HashSet <Job> newJobs  = new HashSet <Job>(jobs);
            HashSet <Job> oldJobs  = new HashSet <Job>(JOBS);
            bool          sameJobs = newJobs.SetEquals(oldJobs);

            if (!sameJobs)
            {
                StillingList.ItemsSource = null;
                JOBS.Clear();
                foreach (Job p in jobs)
                {
                    //JOBS.Clear();
                    JOBS.Add(p);
                }
                Sort(sort);
                //StillingList.ItemsSource = JOBS;
            }

            if (!Authenticater.Authorized)
            {
                GoToLogin();
            }

            //    pullList = false;
            //}
        }
Example #3
0
        private async void TestJobsFilterWeb_OnClicked(object sender, EventArgs e)
        {
            List <string> studyGroups   = new List <string>();
            string        helse         = Hasher.Base64Encode("helse");
            string        datateknologi = Hasher.Base64Encode("datateknologi");

            studyGroups.Add(helse);
            studyGroups.Add(datateknologi);
            //LEGG FAGOMRÅDER TIL AKTIVT FILTER HER MED EN SWITCH ELLER LIGNENDE


            Dictionary <string, string> filter = new Dictionary <string, string>();
            string vestagder = Hasher.Base64Encode("vestagder");
            string heltid    = Hasher.Base64Encode("heltid");

            filter.Add("locations", vestagder);
            filter.Add("types", heltid);

            JobsController    jc   = new JobsController();
            IEnumerable <Job> jobs = await jc.GetJobsBasedOnFilter(studyGroups, filter);

            if (!Authenticater.Authorized)
            {
                GoToLogin();
            }
            if (jobs != null)
            {
                System.Diagnostics.Debug.WriteLine("GetJobsBasedOnFilter: jobs.Count(): " +
                                                   jobs.Count());
                foreach (var job in jobs)
                {
                    System.Diagnostics.Debug.WriteLine("Companies is not null: " + job.companies[0].id);
                    System.Diagnostics.Debug.WriteLine("Companies is not null: " + job.companies[0].name);
                    System.Diagnostics.Debug.WriteLine("Companies is not null: " + job.companies[0].logo);
                }
            }
        }