Exemplo n.º 1
0
    /// <summary>
    /// Save candidate expectation
    /// </summary>
    /// <param name="candidate"></param>
    private void SaveCandidateExpect(Candidate candidate)
    {
        bool isNew = false;
        CandidateExpectation expect = null;
        if (SessionManager.CandidateExpectation != null)
        {
            expect = SessionManager.CandidateExpectation;
        }
        else
        {
            isNew = true;
            expect = new CandidateExpectation();
            expect.CandidateID = candidate.CandidateId;
        }

        //expect.Region = txtArea.Text.Trim();
        if (!string.IsNullOrEmpty(hiddenCanAreaList.Value))
            expect.Region = hiddenCanAreaList.Value as string;
        else
            expect.Region = null;
        expect.Company = ddlCompanyWish.Text.Trim();
        expect.Function = txtFunction.Text.Trim();
        expect.SalaryLevel = ddlSalaryWish.Text.Trim();
        expect.TypeofContract = ddlContractTypeWish.Text.Trim();
        expect.Motivation = txtMotivation.Text.Trim();
        CandidateExpectationRepository repo = new CandidateExpectationRepository();
        if (isNew)
            //Use the specific insert function.
            repo.InsertNewExpect(expect);
        else
            repo.Update(expect);
        SessionManager.CandidateExpectation = expect;
        listCanArea.Items.Clear();
        if (!string.IsNullOrEmpty(expect.Region))
        {
            string[] areaArray = expect.Region.Split(';');
            for (int i = 0; i < areaArray.Length; i++)
            {
                listCanArea.Items.Add(new ListItem(areaArray[i].Trim(), areaArray[i].Trim()));
            }
        }
    }
Exemplo n.º 2
0
    private void LoadGeneralTabData(Candidate candidate)
    {
        ParamPaysRepository paramPaysRepo = new ParamPaysRepository();
        ddlCountry.DataValueField = "PaysID";
        ddlCountry.DataTextField = "Pays";
        ddlCountry.DataSource = paramPaysRepo.FindAll();
        ddlCountry.DataBind();

        ddlGenre.Items.Add(new RadComboBoxItem("M", "M"));
        ddlGenre.Items.Add(new RadComboBoxItem("F", "F"));
        ddlStatus.Items.Add(new RadComboBoxItem("", ""));
        ddlStatus.Items.Add(new RadComboBoxItem("actif", "False"));
        ddlStatus.Items.Add(new RadComboBoxItem("inactif", "True"));

        ParamNationaliteRepository nationalityRepo = new ParamNationaliteRepository();
        ddlNationality.DataValueField = "NationaliteID";
        ddlNationality.DataTextField = "NationaliteID";
        ParamNationalite emptyNation = new ParamNationalite();
        emptyNation.NationaliteID = string.Empty;
        emptyNation.Label = string.Empty;
        IList<ParamNationalite> nationList = nationalityRepo.FindAll();
        nationList.Insert(0, emptyNation);
        ddlNationality.DataSource = nationList;
        ddlNationality.DataBind();

        ddlCanArea.DataValueField = "Location";
        ddlCanArea.DataTextField = "Location";
        ParamLocationsRepository locationRepo = new ParamLocationsRepository();
        ddlCanArea.DataSource = locationRepo.GetAllLocations();
        ddlCanArea.DataBind();

        ddlSalaryWish.Items.Add(new RadComboBoxItem("1500-1999"));
        ddlSalaryWish.Items.Add(new RadComboBoxItem("2000-2999"));
        ddlSalaryWish.Items.Add(new RadComboBoxItem("3000-3999"));
        ddlSalaryWish.Items.Add(new RadComboBoxItem("4000-4999"));
        ddlSalaryWish.Items.Add(new RadComboBoxItem(">5000"));

        ddlCompanyWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("notImportantCompaniesText")));
        ddlCompanyWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("smallAndMediumCompaniesText")));
        ddlCompanyWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("bigCompaniesText")));
        ddlCompanyWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("groupCompaniesText")));
        ddlCompanyWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("multinationalCompaniesText")));

        ddlContractTypeWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("notImportantContractText")));
        ddlContractTypeWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("permanentContractText")));
        ddlContractTypeWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("fixedPeriodeContractText")));
        ddlContractTypeWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("projectMissionContractText")));
        ddlContractTypeWish.Items.Add(new RadComboBoxItem(ResourceManager.GetString("freelanceContractText")));

        if (candidate != null)
        {
            txtAddress.Text = !string.IsNullOrEmpty(candidate.Address) ? candidate.Address : "";
            txtZip.Text = !string.IsNullOrEmpty(candidate.ZipCode) ? candidate.ZipCode : "";
            txtCity.Text = !string.IsNullOrEmpty(candidate.City) ? candidate.City : "";
            datDateOfBirth.SelectedDate = candidate.BirthDate;
            if (candidate.BirthDate.HasValue)
            {
                DateTime today = DateTime.Today;
                DateTime birthDay = candidate.BirthDate.Value;
                int age = today.Year - birthDay.Year;
                if ((today.Month < birthDay.Month) || (today.Month == birthDay.Month) && (today.Day < birthDay.Day))
                    age = age - 1;

                txtAge.Text = age.ToString();
            }

            ddlCountry.SelectedValue = candidate.CountryCode;
            if (candidate.Gender != null)
                ddlGenre.SelectedValue = candidate.Gender.ToUpper();
            ddlNationality.SelectedValue = candidate.Nationlity;
            datCreationDate.SelectedDate = candidate.CreationDate;
            ddlStatus.SelectedValue = candidate.Inactive.ToString();
            txtInactivityReason.Text = candidate.ReasonDesactivation;
            txtRemarkGeneral.Text = candidate.Remark;

            //Tab General : Candidate Wishes :
            CandidateExpectationRepository candidateExpectRepo = new CandidateExpectationRepository();
            CandidateExpectation expect = candidateExpectRepo.GetCandidateExpectation(candidate.CandidateId);
            if (expect != null)
            {
                SessionManager.CandidateExpectation = expect;
                //txtArea.Text = expect.Region;
                if (!string.IsNullOrEmpty(expect.Region))
                {
                    string[] areaArray = expect.Region.Split(';');
                    for (int i = 0; i < areaArray.Length; i++)
                    {
                        listCanArea.Items.Add(new ListItem(areaArray[i].Trim(), areaArray[i].Trim()));
                    }
                }
                hiddenCanAreaList.Value = expect.Region;
                ddlCompanyWish.Text = expect.Company;
                txtFunction.Text = expect.Function;
                ddlSalaryWish.Text = expect.SalaryLevel;
                ddlContractTypeWish.Text = expect.TypeofContract;
                txtMotivation.Text = expect.Motivation;
            }
        }
    }