コード例 #1
0
 public Rec_InterviewCampaignModel Post([Bind]Rec_InterviewCampaignModel model)
 {
     #region Validate
     string message = string.Empty;
     var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Rec_InterviewCampaignModel>(model, "Rec_InterviewCampaign", ref message);
     if (!checkValidate)
     {
         model.ActionStatus = message;
         return model;
     }
     #endregion
     ActionService service = new ActionService(UserLogin);
     var result = service.UpdateOrCreate<Rec_InterviewCampaignEntity, Rec_InterviewCampaignModel>(model);
     if (model.listCandidateGuidIds != null)
     {
         List<Guid> listId = model.listCandidateGuidIds;
         Rec_InterviewCampaignDetailEntity OjbInterviewDetail = null;
         Rec_InterviewCampaignDetailServices InterviewCampaignDetailService = new Rec_InterviewCampaignDetailServices();
         string status = string.Empty;
         foreach (Guid item in listId)
         {
             var RecruitmentHisService = new Rec_RecruitmentHistoryServices(); 
             var ilistRecruitmentHistory = RecruitmentHisService.GetData<Rec_RecruitmentHistoryEntity>(item, ConstantSql.hrm_rec_sp_get_RecruitmentHistoryIdByCandidateId, UserLogin,ref status).ToList();
             Guid? RecruitmentHistoryId = ilistRecruitmentHistory.Where(s => s.Status != HRM.Infrastructure.Utilities.Interview.E_FAIL.ToString() 
                                                                        && s.Status != HRM.Infrastructure.Utilities.Interview.E_PASS.ToString() && s.Status != null).Select(s => s.ID).FirstOrDefault();
             OjbInterviewDetail = new Rec_InterviewCampaignDetailEntity();
             OjbInterviewDetail.InterviewCampaignID = result.ID;
             OjbInterviewDetail.CandidateID = item;
             OjbInterviewDetail.DateInterview = model.DateInterviewFrom;
             OjbInterviewDetail.RecruitmentHistoryID = RecruitmentHistoryId;
             OjbInterviewDetail.LevelInterview = model.LevelInterview;
             InterviewCampaignDetailService.Add(OjbInterviewDetail);
         }
     }
     return result;
 }