コード例 #1
0
        public async Task <IHttpActionResult> creatCandidate(CandidateCreateModel data)
        {
            try
            {
                var user = new ApplicationUser()
                {
                    UserName = data.Candidate.Email, Email = data.Candidate.Email
                };

                IdentityResult result = await UserManager.CreateAsync(user, AppConstant.AppPassword);

                string userId = User.Identity.GetUserId();

                Helpers.Helpers.AddBaseProperties(data.Candidate, "create", userId);
                foreach (var con in data.CandidateContact)
                {
                    Helpers.Helpers.AddBaseProperties(con, "create", userId);
                }

                foreach (var con in data.CandidateFile)
                {
                    Helpers.Helpers.AddBaseProperties(con, "create", userId);
                }



                return(Ok(await CandidateService.CreateCandidate(data)));
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
ファイル: ManageCandidate.cs プロジェクト: chandusekhar/eMSP
        internal static async Task <CandidateCreateModel> Update(CandidateCreateModel model)
        {
            try
            {
                tblFile file = null;


                await UpdateCandidate(model.Candidate.ConvertTotblCandidate());

                await UpdateContacts(model.CandidateContact, model.Candidate.ConvertTotblCandidate());

                await UpdateCandidateFiles(model.CandidateFile, model.Candidate.ConvertTotblCandidate());


                await UpdateCandidateIndustries(model.CandidateIndustries.Select(a => Convert.ToInt32(a)).ToList(), model.Candidate.ConvertTotblCandidate());
                await UpdateCandidateSkills(model.CandidateSkills.Select(a => Convert.ToInt32(a)).ToList(), model.Candidate.ConvertTotblCandidate());

                tblCandidate t = await Task.Run(() => Get(Convert.ToInt64(model.Candidate.id)));

                return(t.ConvertToCandidateCreateModel());
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        public IActionResult CreateOrUpdate(CandidateCreateModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.Foto != null)
                {
                    var uniqueFileName = GetUniqueFileName(model.Foto.FileName);
                    var uploads        = Path.Combine(appEnvironment.WebRootPath, "uploads");
                    var filePath       = Path.Combine(uploads, uniqueFileName);
                    model.Foto.CopyTo(new FileStream(filePath, FileMode.Create));
                    model.FotoURL = filePath;
                }

                var entity = mapper.Map <Candidate>(model);
                foreach (var item in model.SkillsId)
                {
                    var skill = skillManager.Get(item);
                    (entity.Skills as List <Skill>).Add(skill);
                }
                entity.Creator = userManager.GetByLogin(User.Identity.Name);
                if (entity.Id == 0)
                {
                    candidateManager.Create(entity);
                }
                else
                {
                    candidateManager.Update(entity);
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
コード例 #4
0
        public async Task <CandidateSubmissionCreateModel> UpdateCandidateSubmission(CandidateSubmissionCreateModel data)
        {
            try
            {
                CandidateSubmissionCreateModel model = null;

                if (data.IsNewCustomer)
                {
                    CandidateCreateModel candidate = await Task.Run(() => CreateCandidate(data.Candidate));

                    data.CandidateSubmission.CandidateId = candidate.Candidate.id;
                }

                if (data.IsCustomerEdited)
                {
                    await Task.Run(() => UpdateCandidate(data.Candidate));
                }

                await Task.Run(() => ManageCandidate.UpdateCandidateSubmissions(data.CandidateSubmission.ConverToTblCandidateSubmission()));

                await Task.Run(() => ManageCandidateSubmissionsQuestionsResponses.DeleteCandidateSubmissionsQuestionsRespons(data.CandidateSubmission.ID));

                foreach (VacancyQuestionViewModel vq in data.Questions)
                {
                    vq.CandidateSubmissionsQuestionsResponse.All(re =>
                    {
                        re.createdTimestamp = data.CandidateSubmission.createdTimestamp;
                        re.createdUserID    = data.CandidateSubmission.createdUserID;
                        re.updatedUserID    = data.CandidateSubmission.updatedUserID;
                        re.updatedTimestamp = data.CandidateSubmission.updatedTimestamp;
                        return(true);
                    });
                    await Task.Run(() => ManageCandidateSubmissionsQuestionsResponses.InsertCandidateSubmissionsQuestionsRespons(vq.CandidateSubmissionsQuestionsResponse.Select(re => re.ConvertTotblCandidateSubmissionsQuestionsRespons()).ToList()));
                }

                await Task.Run(() => ManageCandidateSubmissionDocumentResponses.DeleteCandidateSubmissionDocumentRespons(data.CandidateSubmission.ID));

                foreach (VacancyRequiredDocumentViewModel rd in data.RequiredDocument)
                {
                    rd.CandidateSubmissionDocumentResponse.All(re => {
                        re.createdTimestamp = data.CandidateSubmission.createdTimestamp;
                        re.createdUserID    = data.CandidateSubmission.createdUserID;
                        re.updatedUserID    = data.CandidateSubmission.updatedUserID;
                        re.updatedTimestamp = data.CandidateSubmission.updatedTimestamp;
                        return(true);
                    });

                    await Task.Run(() => ManageCandidateSubmissionDocumentResponses.InsertCandidateSubmissionDocumentRespons(rd.CandidateSubmissionDocumentResponse.Select(res => res.ConvertTotblCandidateSubmissionsQuestionsResponses()).ToList()));
                }

                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #5
0
 public async Task <CandidateCreateModel> UpdateCandidate(CandidateCreateModel data)
 {
     try
     {
         return(await Task.Run(() => ManageCandidate.Update(data)));
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #6
0
ファイル: ManageCandidate.cs プロジェクト: chandusekhar/eMSP
        internal static async Task <CandidateCreateModel> Insert(CandidateCreateModel model)
        {
            try
            {
                int        x       = 0;
                tblContact contact = null;
                tblFile    file    = null;

                tblCandidate candidate = await Task.Run(() => InsertCandidate(model.Candidate.ConvertTotblCandidate()));

                x = await Task.Run(() => InsertSupplierCandidate(candidate, model.SupplierId));

                if (model.CandidateContact.Count > 0)
                {
                    foreach (CandidateContactModel a in model.CandidateContact)
                    {
                        contact = await Task.Run(() => InsertContacts(a.ConvertTotblContact()));

                        x = await Task.Run(() => InsertCandidateContacts(candidate, contact, a.IsPrimary));
                    }
                }

                if (model.CandidateFile.Count > 0)
                {
                    foreach (FileModel a in model.CandidateFile)
                    {
                        file = await Task.Run(() => InsertFiles(a.ConvertTotblFile()));

                        x = await Task.Run(() => InsertCandidateFiles(candidate, file, Convert.ToInt64(a.FileTypeId), a.ExpiryDate));
                    }
                }

                if (model.CandidateIndustries != null)
                {
                    x = await Task.Run(() => InsertCandidateIndustries(model.CandidateIndustries.Select(a => Convert.ToInt32(a)).ToList(), candidate));
                }

                if (model.CandidateSkills != null)
                {
                    x = await Task.Run(() => InsertCandidateSkills(model.CandidateSkills.Select(a => Convert.ToInt32(a)).ToList(), candidate));
                }


                candidate = await Task.Run(() => Get(candidate.ID));

                return(candidate.ConvertToCandidateCreateModel());
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #7
0
        public ActionResult Create(CandidateCreateModel candidateCreateModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(candidateCreateModel));
            }
            var dto        = mapper.Map <CreateCandidateDTO>(candidateCreateModel);
            int fileLength = candidateCreateModel.Photo.ContentLength;

            dto.Photo = new byte[fileLength];
            candidateCreateModel.Photo.InputStream.Read(dto.Photo, 0, fileLength);
            dto.UserName = User.Identity.Name;
            candidateAppService.Create(dto);
            return(RedirectToAction(ControllerStrings.ResumeMethod, ControllerStrings.Candidate));
        }
コード例 #8
0
        public async Task <CandidateCreateModel> CreateCandidate(CandidateCreateModel data)
        {
            try
            {
                CandidateCreateModel model = null;


                CandidateCreateModel res = await Task.Run(() => ManageCandidate.Insert(data));

                // model = res.ConvertToCandidateCreateModel();


                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #9
0
        public async Task <IHttpActionResult> UpdateCandidate(CandidateCreateModel data)
        {
            try
            {
                string userId = User.Identity.GetUserId();
                Helpers.Helpers.AddBaseProperties(data.Candidate, "update", userId);
                foreach (var con in data.CandidateContact)
                {
                    Helpers.Helpers.AddBaseProperties(con, "create", userId);
                }

                foreach (var con in data.CandidateFile)
                {
                    Helpers.Helpers.AddBaseProperties(con, "create", userId);
                }

                return(Ok(await CandidateService.UpdateCandidate(data)));
            }
            catch (Exception)
            {
                throw;
            }
        }