Esempio n. 1
0
        public void OnGet(int JobLeadId, string TemplateName)
        {
            Template = _docProvider.GetTemplateDocs().Where(t => t.Name == TemplateName).SingleOrDefault();
            JobLead JobLead = _jobLeadService.GetById(JobLeadId);

            Template.Content = _jobLeadService.CompileTemplate(Template.Content, JobLead);
        }
Esempio n. 2
0
        public IActionResult OnGet(int?id)
        {
            JobLead = new JobLead()
            {
                JobLeadId  = 0
                , Password = Utils.GeneratePassword(16)
            };
            if (id != null && id > 0)
            {
                JobLead = _jobLeadService.GetAll()
                          .Where(o => o.JobLeadId == id.GetValueOrDefault())
                          .SingleOrDefault();
            }
            Templates = new List <Template>();
            foreach (Template template in _docProvider.GetTemplateDocs())
            {
                template.Content = _jobLeadService.CompileTemplate(template.Content, JobLead);
                Templates.Add(template);
            }

            selectList =
                new SelectList(Templates.ToList(), nameof(Template.Name), nameof(Template.Name));
            SelectedItems = new string[] { "resume.html", "cover.html" };
            return(Page());
        }
        private void CreateJobLead(Guid jobListingId, JobInfo jobInfo)
        {
            var newLead = new JobLead(jobListingId, jobInfo);

            newLead.DisplayOrder = leadManager.GetNumberOfJobLeads;
            leadManager.AddJobLead(newLead);
        }
Esempio n. 4
0
 public virtual void Delete(JobLead instance)
 {
     if (instance == null)
     {
         throw new ArgumentNullException(this.ToString());
     }
     _repository.Delete(instance);
 }
 private void Delete_Button_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("Delete Job Lead?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
     {
         leadManager.RemoveJobLead(selectedJobLead);
         selectedJobLead = null;
     }
 }
Esempio n. 6
0
        public virtual JobLead GetById(int id)
        {
            JobLead instance = _repository.GetById(id);

            if (instance.Password != null)
            {
                instance.Password = _encryptionService.Decrypt(instance.Password, instance.PasswordSalt);
            }
            return(instance);
        }
 public void RemoveJobLead(JobLead existingJobLead)
 {
     if (jobLeads.Contains(existingJobLead))
     {
         jobLeads.Remove(existingJobLead);
         uiCallback(jobLeads);
         SaveJobLeads();
     }
     else
     {
         // add logging and/or throw exception here...
     }
 }
Esempio n. 8
0
        public virtual string CompileTemplate(string TemplateContent, JobLead item)
        {
            var props = typeof(JobLead).GetProperties();

            foreach (var prop in props)
            {
                string val = prop.GetValue(item) == null ? "" : prop.GetValue(item).ToString();
                TemplateContent = TemplateContent.Replace(
                    string.Format("#{0}#", prop.Name.ToString()), val
                    );
            }
            return(TemplateContent);
        }
Esempio n. 9
0
 public virtual void Update(JobLead instance)
 {
     if (instance == null)
     {
         throw new ArgumentNullException(this.ToString());
     }
     instance.PasswordSalt = DbUtil.GetSaltById(instance.JobLeadId);
     if (instance.Password != null)
     {
         instance.Password = _encryptionService.Encrypt(instance.Password, instance.PasswordSalt);
     }
     _repository.Update(instance);
 }
Esempio n. 10
0
 public virtual void Insert(JobLead instance)
 {
     if (instance == null)
     {
         throw new ArgumentNullException(this.ToString());
     }
     instance.PasswordSalt = _encryptionService.CreateSalt(24);
     if (instance.Password != null)
     {
         instance.Password = _encryptionService.Encrypt(instance.Password, instance.PasswordSalt);
     }
     _repository.Insert(instance);
 }
Esempio n. 11
0
        public void DecreaseJobLeadDisplayOrder(JobLead leadToDecrease)
        {
            var sortedLeads = jobLeads.OrderBy(lead => lead.DisplayOrder).ToArray();

            for (int i = 0; i < sortedLeads.Length; i++)
            {
                var leadAtIndex = sortedLeads[i];
                if (leadAtIndex == leadToDecrease && i > 0)
                {
                    var leadToIncrease = sortedLeads[i - 1];
                    leadToDecrease.DisplayOrder--;
                    leadToIncrease.DisplayOrder++;
                    SaveJobLeads();
                    uiCallback(jobLeads);
                }
            }
        }
 private void JobLeads_ListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
 {
     if (JobLeads_ListBox.SelectedItem != null)
     {
         var listBoxItem = (ListBoxItem)JobLeads_ListBox.SelectedItem;
         selectedJobLead         = (JobLead)listBoxItem.Content;
         Edit_Button.IsEnabled   = true;
         Delete_Button.IsEnabled = true;
         IncreaseDisplayOrder_Button.IsEnabled = JobLeads_ListBox.SelectedIndex < JobLeads_ListBox.Items.Count - 1;
         DecreaseDisplayOrder_Button.IsEnabled = JobLeads_ListBox.SelectedIndex > 0;
     }
     else
     {
         Edit_Button.IsEnabled   = false;
         Delete_Button.IsEnabled = false;
         IncreaseDisplayOrder_Button.IsEnabled = false;
         DecreaseDisplayOrder_Button.IsEnabled = false;
     }
 }
        private void UpdateDisplayList(IEnumerable <JobLead> leads)
        {
            JobLeads_ListBox.Items.Clear();
            Edit_Button.IsEnabled   = false;
            Delete_Button.IsEnabled = false;
            selectedJobLead         = null;
            var leadsList = leads
                            .ToList()
                            .OrderBy(lead => lead.DisplayOrder);

            foreach (var lead in leadsList)
            {
                var listBoxItem = new ListBoxItem
                {
                    Content    = lead,
                    FontWeight = lead.JobInfo.IsFavorite ? FontWeights.Bold : FontWeights.Normal,
                    Foreground = lead.JobInfo.IsFavorite ? Brushes.DarkGoldenrod : Brushes.Black,
                };
                JobLeads_ListBox.Items.Add(listBoxItem);
            }
        }
Esempio n. 14
0
 public void AddJobLead(JobLead newJobLead)
 {
     jobLeads.Add(newJobLead);
     uiCallback(jobLeads);
     SaveJobLeads();
 }