protected void OnBtnSaveClicked(object sender, EventArgs e) { ParamNationaliteRepository repo = new ParamNationaliteRepository(); ParamNationalite saveItem = new ParamNationalite(); saveItem.NationaliteID = txtNationalityID.Text; saveItem.Label = txtLabel.Text; if (Request.QueryString["NationalityID"] == null) { //Insert new record ParamNationalite oldItem = repo.GetNationalityByID(txtNationalityID.Text); if (oldItem == null) repo.InserNewNationality(saveItem); else { string message = ResourceManager.GetString("itemAlreadyExist"); string script1 = "<script type=\"text/javascript\">"; script1 += " alert(\"" + message + "\");"; script1 += " </script>"; if (!ClientScript.IsClientScriptBlockRegistered("redirectUser")) ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script1); } } else { if (Request.QueryString["NationalityID"] == txtNationalityID.Text) { repo.Update(saveItem); } else { ParamNationalite oldItem = repo.GetNationalityByID(Request.QueryString["NationalityID"]); if (oldItem.NumberIDUsed <= 0) { repo.Delete(oldItem); repo.InserNewNationality(saveItem); } else { string message = ResourceManager.GetString("messageNationalityBeingUsed"); string script1 = "<script type=\"text/javascript\">"; script1 += " alert(\"" + message + "\");"; script1 += " </script>"; if (!ClientScript.IsClientScriptBlockRegistered("redirectUser")) ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script1); } } } string script = "<script type=\"text/javascript\">"; script += " OnBtnSaveClientClicked();"; script += " </script>"; if (!ClientScript.IsClientScriptBlockRegistered("redirectUser")) ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script); }
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; } } }
protected void OnNationalityDeleteClicked(object sender, EventArgs e) { LinkButton lnkItem = (LinkButton)sender; string nationalityID = lnkItem.CommandArgument; ParamNationalite deleteItem = new ParamNationalite(nationalityID); ParamNationaliteRepository repo = new ParamNationaliteRepository(); repo.Delete(deleteItem); BindGridData(); gridNationality.DataBind(); }