Ejemplo n.º 1
0
 /// <summary>
 /// Copies job information to the clipboard
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CopyJobInfo_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     try
     {
         if (DataContext == null)
         {
             return;
         }
         JobListVM     jobListVM     = (JobListVM)DataContext;
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendLine("CrypCloud – Job from " + DateTime.Now);
         stringBuilder.AppendLine("- Job ID: " + ByteArrayToString(jobListVM.SelectedJob.JobId.ToByteArray()));
         stringBuilder.AppendLine("- Job name: " + jobListVM.SelectedJob.JobName);
         stringBuilder.AppendLine("- Job size (bytes): " + jobListVM.SelectedJob.JobSize);
         stringBuilder.AppendLine("- Creation date: " + jobListVM.SelectedJob.CreationDate.ToLocalTime().ToString("g"));
         stringBuilder.AppendLine("- Creator name: " + jobListVM.SelectedJob.CreatorName);
         stringBuilder.AppendLine("- Job description: " + jobListVM.SelectedJob.JobDescription);
         stringBuilder.AppendLine("- Number of blocks: " + jobListVM.SelectedJob.NumberOfBlocks);
         stringBuilder.AppendLine("- Number of calculated blocks: " + jobListVM.SelectedJob.NumberOfCalculatedBlocks);
         Clipboard.SetText(stringBuilder.ToString());
     }
     catch (Exception)
     {
         //do nothing
     }
 }
Ejemplo n.º 2
0
        // GET: Admin/Jobs
        public async Task <ActionResult> Index(int?page, string keyword)
        {
            JobListVM pageListVM = await GetElementsAsync(page, keyword);

            ViewBag.PageSizes = new SelectList(Site.PageSizes());
            return(View(pageListVM));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Copies the list of jobs to the clipboard
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CopyJobList_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     try
     {
         StringBuilder stringBuilder = new StringBuilder();
         JobListVM     jobListVM     = (JobListVM)DataContext;
         stringBuilder.AppendLine("CrypCloud – Joblist from " + DateTime.Now);
         foreach (var job in jobListVM.RunningJobs)
         {
             stringBuilder.AppendLine("Job:");
             stringBuilder.AppendLine("- ID: " + ByteArrayToString(job.JobId.ToByteArray()));
             stringBuilder.AppendLine("- Name: " + job.JobName);
             stringBuilder.AppendLine("- Size (bytes): " + job.JobSize);
             stringBuilder.AppendLine("- Creation date: " + job.CreationDate.ToLocalTime().ToString("g"));
             stringBuilder.AppendLine("- Creator name: " + job.CreatorName);
             stringBuilder.AppendLine("- Job description: " + job.JobDescription);
             stringBuilder.AppendLine("- Number of blocks: " + job.NumberOfBlocks);
             stringBuilder.AppendLine("- Number of calculated blocks: " + job.NumberOfCalculatedBlocks);
         }
         Clipboard.SetText(stringBuilder.ToString());
     }
     catch (Exception)
     {
         //do nothing
     }
 }
Ejemplo n.º 4
0
        // GET: Admin/Jobs
        public async Task <IActionResult> Index(string keyword, string orderby, string sort, int?categoryId, int?page)
        {
            var vm = new JobListVM()
            {
                PageIndex  = page == null || page <= 0 ? 1 : page.Value,
                Keyword    = keyword,
                CategoryId = categoryId,
                PageSize   = SettingsManager.Job.PageSize,
                OrderBy    = orderby,
                Sort       = sort
            };

            //var pageSize = SettingsManager.Job.PageSize;
            var query = _context.Jobs.Include(d => d.Category).AsNoTracking().AsQueryable();

            if (!string.IsNullOrEmpty(keyword))
            {
                query = query.Where(d => d.Title.Contains(keyword));
            }

            if (categoryId > 0)
            {
                query = query.Where(d => d.CategoryId == categoryId);
            }


            var gosort = $"{orderby}_{sort}";

            query = gosort switch
            {
                "importance_asc" => query.OrderBy(s => s.Importance),
                "importance_desc" => query.OrderByDescending(s => s.Importance),
                "title_asc" => query.OrderBy(s => s.Title),
                "title_desc" => query.OrderByDescending(s => s.Title),
                "date_asc" => query.OrderBy(s => s.CreatedDate),
                "date_desc" => query.OrderByDescending(s => s.CreatedDate),

                _ => query.OrderByDescending(s => s.Id),
            };


            vm.TotalCount = await query.CountAsync();

            var clients = await query
                          .Skip((vm.PageIndex - 1) *vm.PageSize).Take(vm.PageSize).ProjectTo <JobBVM>(_mapper.ConfigurationProvider).ToListAsync();


            vm.Jobs = new StaticPagedList <JobBVM>(clients, vm.PageIndex, vm.PageSize, vm.TotalCount);

            var categories = await _context.JobCategories.AsNoTracking()
                             .OrderByDescending(d => d.Importance).ToListAsync();

            ViewData["Categories"] = new SelectList(categories, "Id", "Title");

            ViewBag.PageSizes = new SelectList(Site.PageSizes());

            return(View(vm));
        }
Ejemplo n.º 5
0
 public void DoAction(JobListVM vm)
 {
     if (vm.SelectedJob.Id != 0)
     {
         basicInfoController.ShowJobCustomFieldManageView(vm.SelectedJob, ActionType.ManageJobCustomFields);
     }
     else
     {
         basicInfoController.ShowJobCustomFieldManageView(vm.SelectedJob, ActionType.AssignJobCustomFields);
     }
 }
        public IActionResult StopJob(int jobId)
        {
            TimeRegister stop = new TimeRegister();

            stop      = _context.TimeRegisters.FirstOrDefault(e => e.Id == jobId);
            stop.Stop = DateTime.Now;
            _context.Entry(stop).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _context.SaveChanges();

            JobListVM jobListVm = new JobListVM();

            jobListVm.jobId = stop.JobLineId;

            return(View("JobReady", jobListVm));
        }
        public async Task <IActionResult> StartJobAsync(int jobId)
        {
            TimeRegister start = new TimeRegister();

            start.Start     = DateTime.Now;
            start.JobLineId = jobId;
            start.User      = await _userManager.GetUserAsync(User);

            _context.TimeRegisters.Add(start);
            _context.SaveChanges();

            JobListVM jobListVm = new JobListVM();


            jobListVm.jobId = start.Id;

            return(View("StartJob", jobListVm));
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Copies the list of contacts to the clipboard
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CopyConnectedContacts_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     try
     {
         StringBuilder stringBuilder = new StringBuilder();
         JobListVM     jobListVM     = (JobListVM)DataContext;
         stringBuilder.AppendLine("CrypCloud – Contactlist from " + DateTime.Now);
         foreach (var element in jobListVM.Contacts)
         {
             stringBuilder.AppendLine("Contact:");
             stringBuilder.AppendLine("- PeerId:" + ByteArrayToString(element.PeerId));
             stringBuilder.AppendLine("- IP:" + element.IPAddress);
             stringBuilder.AppendLine("- Port:" + element.Port);
             stringBuilder.AppendLine("- Last seen:" + element.LastSeen.ToLocalTime().ToString("g"));
         }
         Clipboard.SetText(stringBuilder.ToString());
     }
     catch (Exception)
     {
         //do nothing
     }
 }
Ejemplo n.º 9
0
        private async Task <JobListVM> GetElementsAsync(int?page, string keyword)
        {
            var vm = new JobListVM()
            {
                Keyword   = keyword,
                PageIndex = page ?? 1,
                PageSize  = SettingsManager.Job.PageSize
            };
            var query = _db.Jobs.AsQueryable();

            if (!string.IsNullOrEmpty(keyword))
            {
                query = query.Where(d => d.Post.Contains(keyword) || d.Description.Contains(keyword));
            }

            var pagelist = await query.OrderByDescending(d => d.Importance).Skip((vm.PageIndex - 1) * vm.PageSize).Take(vm.PageSize).ProjectTo <JobVM>().ToListAsync();

            //_jobServices.GetJobdElements(pageListVM.PageIndex - 1, pageListVM.PageSize, pageListVM.Keyword, out totalCount);

            vm.TotalCount = await query.CountAsync();

            vm.Jobs = new StaticPagedList <JobVM>(pagelist, vm.PageIndex, vm.PageSize, vm.TotalCount);;
            return(vm);
        }
Ejemplo n.º 10
0
        public ActionResult S(string o, string f, string s, string st, string ct, int?p, JobSearchViewModel jsmodelkk, JobListVM vm)
        {
            ViewBag.CurrentSort     = o;
            ViewBag.PopularSortParm = "popular";
            ViewBag.DateSortParm    = o == "Date" ? "date_desc" : "Date";
            ViewBag.SalarySortParm  = "salary_desc";

            if (s != null)
            {
                p = 1;
            }
            else
            {
                s = f;
            }
            ViewBag.CurrentFilter = s;

            var model   = uow.jobRepository.GetAll();
            var jsmodel = new JobSearchViewModel();

            if (vm != null)
            {
                if (vm.JobSearchViewModel != null)
                {
                    jsmodel = vm.JobSearchViewModel;
                }
            }
            ViewBag.Sstr = "";
            if (!String.IsNullOrEmpty(s))
            {
                jsmodel.SearchString = s;
                ViewBag.Sstr         = s;
            }

            ViewBag.Stt = "Job Location";
            if (!String.IsNullOrEmpty(st))
            {
                jsmodel.State = st;
                ViewBag.Stt   = st;
            }

            ViewBag.Cat = "Job Category";
            if (!String.IsNullOrEmpty(ct))
            {
                jsmodel.SearchString = ct;
                ViewBag.Cat          = ct;
            }


            Dictionary <string, object> searchObj = JobModelToDict(jsmodel);

            model = jobService.FindJob(searchObj);

            switch (o)
            {
            case "salary_desc":
                model = model.OrderByDescending(m => m.MaximumSalary);
                break;

            case "popular":
                model = model.OrderByDescending(m => m.NumberOfApplicants);
                break;

            case "Date":
                model = model.OrderBy(m => m.DatePosted);
                break;

            case "date_desc":
                model = model.OrderByDescending(m => m.DatePosted);
                break;

            default:      // Name ascending
                model = model.OrderByDescending(m => m.DatePosted);
                break;
            }

            int pageSize   = 10;
            int pageNumber = (p ?? 1);
            var mod        = new JobListVM
            {
                Jobs = model.ToPagedList(pageNumber, pageSize),
                JobSearchViewModel = jsmodel
            };


            int jobStartNum = GetJobStart(pageNumber, pageSize);
            int jobEndNum   = GetJobEnd(model.Count(), pageNumber, pageSize, jobStartNum);

            ViewBag.StartIndex = jobStartNum;
            ViewBag.EndIndex   = jobEndNum;
            ViewBag.ModelCount = model.Count();

            ViewBag.JobCatId = uow.jobCategoryRepository.GetAll().AsEnumerable()
                               .Select(j => new SelectListItem {
                Text = j.Name, Value = Convert.ToString(j.Jobs.Count())
            });
            ViewBag.State           = CountryStates.GetStates("Nigeria");
            ViewBag.Companies       = uow.companyRepository.GetAll().Select(c => c.Name);
            ViewBag.JobType         = Enum.GetValues(typeof(JobType));
            ViewBag.ExperienceLevel = Enum.GetValues(typeof(ExperienceLevel));
            return(View(mod));
        }
Ejemplo n.º 11
0
 public JobListView(JobListVM vm)
 {
     InitializeComponent();
     ViewModel = vm;
 }