protected void submit_Click1(object sender, EventArgs e)
    {
        //dateinfo.ShortDatePattern = "DD/MM/YYYY";

        ICandidateProfile objCandidateProfile = CandidateProfileFactory.create_Candidates();

        objCandidateProfile.get_CandidateProfileID = (Int32)Session["CandidateProfileID"];
        try
        {
            objCandidateProfile.get_DOB = Convert.ToDateTime(dob.Text);
        }
        catch (Exception)
        {
            string script = "alert('please enter date of birth in DD/MM/YYYY');";
            ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script);
        }


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

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

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

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


        ICandidateManager objCandidateManager = CandidateManagerFactory.Candidate_Manager();

        if (objCandidateManager.candidate_update(objCandidateProfile) == 1)
        {
            DialogResult result = MessageBox.Show(" Do you want to edit more candidates? ", "Success:", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                Response.Redirect("Edit_Candidates_byPC.aspx");
            }
            else
            {
                Response.Redirect("Home_PlacementConsultant.aspx");
            }
        }
    }
Esempio n. 2
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)
        {
        }
    }