コード例 #1
0
 private void SaveCandidateExpectancies(Candidate candidate)
 {
     CandidateExpectancyRepository candidateExpectRepo = new CandidateExpectancyRepository();
     IList<CandidateExpectancy> oldExpectList = candidateExpectRepo.GetCandidateExpectancyOfCandidate(candidate.CandidateId);
     foreach (CandidateExpectancy newIem in SessionManager.CanExpectOldList)
     {
         bool isNew = true;
         foreach (CandidateExpectancy oldItem in oldExpectList)
         {
             if (oldItem.FunctionID.Value == newIem.FunctionID.Value)
             {
                 isNew = false;
                 break;
             }
         }
         if (isNew)
         {
             newIem.CandidatID = candidate.CandidateId;
             candidateExpectRepo.Insert(newIem);
         }
     }
     foreach (CandidateExpectancy oldItem in oldExpectList)
     {
         bool isDelete = true;
         foreach (CandidateExpectancy deleteItem in SessionManager.CanExpectOldList)
         {
             if (deleteItem.FunctionID.Value == oldItem.FunctionID.Value)
             {
                 isDelete = false;
                 break;
             }
         }
         if (isDelete)
             candidateExpectRepo.Delete(oldItem);
     }
 }
コード例 #2
0
    private void BindExpectacyOfCandidate(Candidate candidate)
    {
        int candidateID = -1;
        if (!string.IsNullOrEmpty(Request.QueryString["CandidateId"]))
            candidateID = Int32.Parse(Request.QueryString["CandidateId"]);
        else if (SessionManager.CurrentCandidate != null)
            candidateID = SessionManager.CurrentCandidate.CandidateId;
        else if (candidate != null)
            candidateID = candidate.CandidateId;

        if (candidateID != -1)
        {
            CandidateExpectancyRepository candExpectRepo = new CandidateExpectancyRepository();
            SessionManager.CanExpectOldList = candExpectRepo.GetCandidateExpectancyOfCandidate(candidate.CandidateId);
            expectancyGrid.DataSource = SessionManager.CanExpectOldList;
        }
        else
            expectancyGrid.DataSource = new List<CandidateExpectancy>();
        expectancyGrid.DataBind();
    }