protected void OnKnowFuncFamItemChanged(object sender, EventArgs e) { string family = (string)((RadComboBox)sender).SelectedValue; if (lblKnowFuncDestination.Text == ResourceManager.GetString("lblCanFunctionGrid")) { listKnowFuncOriginal.DataTextField = "Code"; listKnowFuncOriginal.DataValueField = "FunctionID"; CandidateFunctionRepository repo = new CandidateFunctionRepository(); listKnowFuncOriginal.DataSource = repo.GetAllParamFunctionByFuntionFamID(family); listKnowFuncOriginal.DataBind(); } else { listKnowFuncOriginal.DataTextField = "Code"; listKnowFuncOriginal.DataValueField = "KnowledgeID"; CandidateKnowledgeRepository repo = new CandidateKnowledgeRepository(); listKnowFuncOriginal.DataSource = repo.GetAllParamKnowledgeByKnowledgeFamID(family); listKnowFuncOriginal.DataBind(); } }
protected void OnExpectFamItemChanged(object sender, EventArgs e) { string family = (string)((RadComboBox)sender).SelectedValue; listExpectOriginal.DataTextField = "Code"; listExpectOriginal.DataValueField = "FunctionID"; CandidateFunctionRepository repo = new CandidateFunctionRepository(); listExpectOriginal.DataSource = repo.GetAllParamFunctionByFuntionFamID(family); listExpectOriginal.DataBind(); }
protected void OnFuncFamItemChanged(object sender, EventArgs e) { string family = (string)((RadComboBox)sender).SelectedValue; ddlFunction.DataValueField = "FunctionID"; ddlFunction.DataTextField = "Code"; CandidateFunctionRepository repo = new CandidateFunctionRepository(); IList<CandidateFunction> list = new List<CandidateFunction>(); list = repo.GetAllParamFunctionByFuntionFamID(family); CandidateFunction firstItem = new CandidateFunction(); firstItem.FunctionID = -1; firstItem.Code = string.Empty; list.Insert(0, firstItem); ddlFunction.Text = null; ddlFunction.DataSource = list; ddlFunction.DataBind(); }
/// <summary> /// Save candidate knowledge and experience. /// </summary> /// <param name="candidate"></param> private void SaveCandidateKnowledgeFunction(Candidate candidate) { //With knowledge list. CandidateKnowledgeRepository candidateKnowRepo = new CandidateKnowledgeRepository(); IList<CandidateKnowledge> oldKnowledgeList = candidateKnowRepo.GetCandidateKnowledgeByCandidateID(candidate.CandidateId); foreach (CandidateKnowledge newItem in SessionManager.CanKnowledgeOldList) { bool isNew = true; foreach (CandidateKnowledge oldItem in oldKnowledgeList) { if (oldItem.KnowledgeID.Value == newItem.KnowledgeID.Value) { isNew = false; break; } } if (isNew) { newItem.CandidateID = candidate.CandidateId; candidateKnowRepo.Insert(newItem); } } foreach (CandidateKnowledge oldItem in oldKnowledgeList) { bool isDelete = true; foreach (CandidateKnowledge deleteItem in SessionManager.CanKnowledgeOldList) { if (deleteItem.KnowledgeID.Value == oldItem.KnowledgeID.Value) { isDelete = false; break; } } if (isDelete) candidateKnowRepo.Delete(oldItem); } //With Function list. CandidateFunctionRepository candidateFuncRepo = new CandidateFunctionRepository(); IList<CandidateFunction> oldFunctList = candidateFuncRepo.GetCandidateFunctionByCandidateID(candidate.CandidateId); foreach (CandidateFunction newIem in SessionManager.CanFunctionOldList) { bool isNew = true; foreach (CandidateFunction oldItem in oldFunctList) { if (oldItem.FunctionID.Value == newIem.FunctionID.Value) { isNew = false; break; } } if (isNew) { newIem.CandidateID = candidate.CandidateId; candidateFuncRepo.Insert(newIem); } } foreach (CandidateFunction oldItem in oldFunctList) { bool isDelete = true; foreach (CandidateFunction deleteItem in SessionManager.CanFunctionOldList) { if (deleteItem.FunctionID.Value == oldItem.FunctionID.Value) { isDelete = false; break; } } if (isDelete) candidateFuncRepo.Delete(oldItem); } }
protected void Page_Load(object sender, EventArgs e) { if (SessionManager.CurrentUser == null) { Common.RedirectToLoginPage(this); return; } else if (!IsPostBack) { FillLabelLanguage(); InitControls(); //Fill data for combobox ddlPeriodeMonthFrom.Items.Add(new RadComboBoxItem(string.Empty, string.Empty)); ddlPeriodeMonthTo.Items.Add(new RadComboBoxItem(string.Empty, string.Empty)); ddlPeriodeYearFrom.Items.Add(new RadComboBoxItem(string.Empty, string.Empty)); ddlPeriodeYearTo.Items.Add(new RadComboBoxItem(string.Empty, string.Empty)); for (int i = 1; i <= 12; i++) { string text = i.ToString(); if (i < 10) text = "0" + text; ddlPeriodeMonthFrom.Items.Add(new RadComboBoxItem(text, text)); ddlPeriodeMonthTo.Items.Add(new RadComboBoxItem(text, text)); } int nowYear = DateTime.Today.Year; for (int i = nowYear; i >= 1900; i--) { ddlPeriodeYearFrom.Items.Add(new RadComboBoxItem(i.ToString(), i.ToString())); ddlPeriodeYearTo.Items.Add(new RadComboBoxItem(i.ToString(), i.ToString())); } ddlSalary.Items.Add(new RadComboBoxItem("1500-1999")); ddlSalary.Items.Add(new RadComboBoxItem("2000-2999")); ddlSalary.Items.Add(new RadComboBoxItem("3000-3999")); ddlSalary.Items.Add(new RadComboBoxItem("4000-4999")); ddlSalary.Items.Add(new RadComboBoxItem(">5000")); ParamKnowledgeFamRepository repo = new ParamKnowledgeFamRepository(); ddlFuncUnit.DataSource = repo.GetKnowledgeFamGenreList(); ddlFuncUnit.DataBind(); OnFuncUnitItemChanged(ddlFuncUnit, null); } if (!string.IsNullOrEmpty(Request.QueryString["ExperienceID"])) { if (!IsPostBack) { int experienceID = int.Parse(Request.QueryString["ExperienceID"]); CandidateExperienceRepository repo = new CandidateExperienceRepository(); CandidateExperience experience = repo.FindOne(new CandidateExperience(experienceID)); if (!string.IsNullOrEmpty(experience.Period)) { txtPeriodeString.Text = experience.Period; string expression = @"\d{2}/\d{4}\s*-\s*\d{2}/\d{4}"; if (Regex.IsMatch(experience.Period, expression)) { string[] fromTo = experience.Period.Split('-'); string[] from = fromTo[0].Trim().Split('/'); string[] to = fromTo[1].Trim().Split('/'); if (1 <= int.Parse(from[0]) && int.Parse(from[0]) <= 12) ddlPeriodeMonthFrom.SelectedValue = from[0]; else ddlPeriodeMonthFrom.SelectedValue = string.Empty; if (1900 <= int.Parse(from[1]) && int.Parse(from[1]) <= DateTime.Now.Year) ddlPeriodeYearFrom.SelectedValue = from[1]; else ddlPeriodeYearFrom.SelectedValue = string.Empty; if (1 <= int.Parse(to[0]) && int.Parse(to[0]) <= 12) ddlPeriodeMonthTo.SelectedValue = to[0]; else ddlPeriodeMonthTo.SelectedValue = string.Empty; if (1900 <= int.Parse(to[1]) && int.Parse(to[1]) <= DateTime.Now.Year) ddlPeriodeYearTo.SelectedValue = to[1]; else ddlPeriodeYearTo.SelectedValue = string.Empty; } else { ddlPeriodeMonthFrom.SelectedValue = string.Empty; ddlPeriodeYearFrom.SelectedValue = string.Empty; ddlPeriodeMonthTo.SelectedValue = string.Empty; ddlPeriodeYearTo.SelectedValue = string.Empty; } } txtCompany.Text = experience.Company; ddlSalary.Text = experience.Salary; txtSalaryPackage.Text = experience.ExtraAdvantage; txtJobTitle.Text = experience.FunctionDesc; txtQuitReason.Text = experience.LeftReason; if (experience.FunctionID.HasValue && experience.FunctionID.Value > 0) { CandidateFunction canFunc = new CandidateFunctionRepository().GetFunctionByFunctionID(experience.FunctionID.Value); ddlFuncUnit.SelectedValue = canFunc.Type; OnFuncUnitItemChanged(ddlFuncUnit, null); ddlFuncFam.SelectedValue = canFunc.Group; OnFuncFamItemChanged(ddlFuncFam, null); ddlFunction.SelectedValue = experience.FunctionID.Value.ToString(); } else ddlFunction.SelectedValue = "-1"; } } }