예제 #1
0
    protected void submit_Click1(object sender, EventArgs e)
    {
        //  date.ShortDatePattern="dd-MM-yyyy";
        try
        {
            Session["VacancyID"] = ddl_vacancy.SelectedItem.Text;
            ICandidateProfile candidate = CandidateProfileFactory.create_Candidates();


            candidate.get_DOB = Convert.ToDateTime(dob.Text);

            //catch (Exception)
            //{

            //    DialogResult result = MessageBox.Show(" Date of birth should be in the MM/DD/YYYY format.  ", "Failure:", MessageBoxButtons.OK);
            //}

            candidate.get_Gender        = gender.Text;
            candidate.get_Location      = location.Text;
            candidate.get_Percentage_10 = Convert.ToSingle(tenth.Text);
            candidate.get_Percentage_12 = Convert.ToSingle(twelfth.Text);

            if (gapsedu.SelectedItem.Text == "No")
            {
                candidate.get_GapInEducation = 0;
            }
            else
            {
                candidate.get_GapInEducation = Convert.ToInt32(gapsedu_months.SelectedItem.Text);
            }

            if (gapsexp.SelectedItem.Text == "No")
            {
                candidate.get_GapInExperience = 0;
            }
            else
            {
                candidate.get_GapInExperience = Convert.ToInt32(gapsexp_months.SelectedItem.Text);
            }

            int intvacancyid = Convert.ToInt32(Convert.ToString(Session["VacancyID"]));
            candidate.get_VacancyID         = intvacancyid;
            candidate.get_TestID            = 0;
            candidate.get_TestStatus        = 0;
            candidate.get_MedicalTestStatus = 0;
            candidate.get_BGCTestID         = 0;
            candidate.get_BGCTestStatus     = false;

            ICandidateManager objCandidateManager = CandidateManagerFactory.Candidate_Manager();
            int inti = objCandidateManager.AddCandidateProfile(candidate);
            List <ICandidateProfile> lstCandidateProfile = new List <ICandidateProfile>();
            lstCandidateProfile = objCandidateManager.display_candidate_toPC();
            int CandidateID = 0;
            foreach (ICandidateProfile objCandidateProfile in lstCandidateProfile)
            {
                CandidateID = objCandidateProfile.get_CandidateProfileID;
            }
            string          Requirebydate     = "";
            IVacancyManager objVacancyManager = VacancyManagerFactory.Create_VacancyManager();
            List <IVacancy> lstVacancy        = new List <IVacancy>();
            foreach (IVacancy element in lstVacancy)
            {
                if (element.get_VacancyID == intvacancyid)
                {
                    Requirebydate = Convert.ToString(element.get_RequiredByDate);
                    break;
                }
            }
            if (inti == 1)
            {
                DialogResult result = MessageBox.Show(" Candidate with ID:" + CandidateID + " is Successfully added", "Success:", MessageBoxButtons.OK);
                Response.Redirect("Add_Candidates_byPC.aspx");
            }
            else if (inti == 2)
            {
                DialogResult result = MessageBox.Show(" All candidates for Vacancy ID:" + intvacancyid + " are filled", "Failure:", MessageBoxButtons.OK);
                Response.Redirect("Add_Candidates_byPC.aspx");
            }
            else if (inti == 3)
            {
                DialogResult result = MessageBox.Show(" Date has been expired for this vacancy ", "Failure:", MessageBoxButtons.OK);
                Response.Redirect("Add_Candidates_byPC.aspx");
            }
        }
        catch (Exception)
        {
        }
    }