public ActionResult<Api<CandidateDTO>> New([FromForm] CandidateForm canForm) { CandidateDTO dto = _candidateService.Save(canForm); Api<CandidateDTO> result = new Api<CandidateDTO>(200, dto, "Add Success"); return Ok(result); }
public CandidateDTO Save(CandidateForm canForm) { CandidateEntity entity = null; NoteDTO note = new NoteDTO(); note.Content = ""; note.Id = 0; canForm.Note = note; note = _noteService.Save(_mapper.Map <NoteEntity>(canForm.Note)); canForm.Note = note; var transaction = _humanManagerContext.Database.BeginTransaction(); try { string folderName = SystemContant.Candidate_Uploading_Path; string uploadPath = _hostingEnvironment.ContentRootPath; string newPath = Path.Combine(uploadPath, folderName); UploadUtil.Uploader uploader = _uploadUtil.DoFileUploading(newPath, canForm.UploadedFile); CandidateEntity newEntity = _mapper.Map <CandidateEntity>(canForm); newEntity.ImageName = uploader.fileName; entity = _humanManagerContext.Candidates.Add(newEntity).Entity; _humanManagerContext.SaveChanges(); transaction.Commit(); CandidateDTO dto = _mapper.Map <CandidateDTO>(entity); return(dto); } catch { transaction.Rollback(); return(null); } }
public ActionResult ConfirmBid(Candidate candidate, string message) { var form = new CandidateForm { Candidate = candidate, Message = message }; return(View(form)); }
public ActionResult Show(int id) { Candidate candidate = Get <ICandidateRepository>().GetById(id); var form = new CandidateForm { Candidate = candidate }; return(View(form)); }
public void Execute(IEnumerable <string> args) { var arg = args.ToList()[0]; var regex = _migmemo.GetRegex(arg); foreach (var s in GetRegistlations()) { Debug.WriteLine(s); var t = regex.Match(s).ToString(); regex.IsMatch(s); } string[] matches = GetRegistlations().Select(s => s).Where(s => s.Contains(regex.Match(s).ToString()) && !string.IsNullOrEmpty(regex.Match(s).ToString()) || s.IndexOf(arg, StringComparison.OrdinalIgnoreCase) >= 0).ToArray(); using (var form = new CandidateForm(matches)) { form.ShowDialog(); } }
public static extern bool ImmSetCandidateWindow(IntPtr hIMC, ref CandidateForm candidateForm);
internal static extern bool ImmSetCandidateWindow(IntPtr hIMC, ref CandidateForm form);
internal static extern bool ImmGetCandidateWindow(IntPtr hIMC, int dwIndex, out CandidateForm form);
private async void btnAddCandidate_Click(object sender, RoutedEventArgs e) { btnAddCandidate.Cursor = Cursors.Wait; var parentWindow = Window.GetWindow(this); var window = parentWindow as MaintenanceWindow; G.WaitLang(window); window.Opacity = 0.5; _hOffset = svrCandidate.HorizontalOffset; var candidateForm = new CandidateForm(); candidateForm.EditingCandidate = null; candidateForm.SetParty(_party); var helper = new WindowInteropHelper(window); SetWindowLong(new HandleRef(candidateForm, candidateForm.Handle), -8, helper.Handle.ToInt32()); G.EndWait(window); btnAddCandidate.Cursor = Cursors.Hand; candidateForm.ShowDialog(); G.WaitLang(window); if (candidateForm.IsLoadPosition) { G.WaitLang(window); var form = new PositionForm(); form.Tag = window; G.EndWait(window); form.ShowDialog(); } else if (!candidateForm.IsCanceled) { try { stkCandidate.Children.Clear(); var candidateParty = await _candidateService.GetCandidateDetailsListByPartyAsync(_party.Id); stkCandidate.Visibility = candidateParty.Any() ? Visibility.Visible : Visibility.Collapsed; foreach (var candidate in candidateParty) { var candidateControl = new CandidateControl(); candidateControl.DataContext = candidate; stkCandidate.Children.Add(candidateControl); } lblCount.Content = candidateParty.Count().ToString("n0"); if (_hOffset != -1) { svrCandidate.ScrollToHorizontalOffset(_hOffset); } } catch (Exception ex) { Logger.LogError(ex); G.EndWait(window); MessageBox.Show(ex.GetBaseException().Message, "PROGRAM ERROR: " + ex.Source, MessageBoxButton.OK, MessageBoxImage.Stop); } } G.EndWait(window); window.Opacity = 1; }
public static extern bool ImmSetCandidateWindow(int hImc, ref CandidateForm frm);