Esempio n. 1
0
        // To retrieve all candidates from database
        public List <ICandidateProfile> getCandidates()
        {
            List <ICandidateProfile> lstCandidateProfile = new List <ICandidateProfile>();
            SqlCommand    myCommand;
            SqlConnection myConnection = DBUtility.getConnection();

            try
            {
                using (myConnection)
                {
                    myCommand             = new SqlCommand("SP_getCandidates", myConnection);
                    myCommand.CommandType = CommandType.StoredProcedure;
                    myConnection.Open();
                    SqlDataReader objSqlDataReader = myCommand.ExecuteReader();
                    while (objSqlDataReader.Read())
                    {
                        int               CandidateProfileID = Convert.ToInt32(objSqlDataReader["CandidateProfileID"]);
                        int               VacancyID          = Convert.ToInt32(objSqlDataReader["VacancyID"]);
                        DateTime          DOB               = Convert.ToDateTime(objSqlDataReader["DOB"]);
                        string            Location          = Convert.ToString(objSqlDataReader["Location"]);
                        string            Gender            = Convert.ToString(objSqlDataReader["Gender"]);
                        float             Percentage_10     = Convert.ToSingle(objSqlDataReader["Percentage_10"]);
                        float             Percentage_12     = Convert.ToSingle(objSqlDataReader["Percentage_12"]);
                        int               GapInEducation    = Convert.ToInt32(objSqlDataReader["GapInEducation"]);
                        int               GapInExperience   = Convert.ToInt32(objSqlDataReader["GapInExperience"]);
                        string            ResumeFile        = Convert.ToString(objSqlDataReader["ResumeFile"]);
                        int               TestID            = Convert.ToInt32(objSqlDataReader["TestID"]);
                        int               TestStatus        = Convert.ToInt32(objSqlDataReader["TestStatus"]);
                        int               MedicalTestStatus = Convert.ToInt32(objSqlDataReader["MedicalTestStatus"]);
                        int               BGCTestID         = Convert.ToInt32(objSqlDataReader["BGCTestID"]);
                        bool              BGCTestStatus     = Convert.ToBoolean(objSqlDataReader["BGCTestStatus"]);
                        ICandidateProfile objcandidate      = CandidateProfileFactory.create_Candidate(VacancyID, CandidateProfileID, DOB, Location, Gender, Percentage_10, Percentage_12, GapInEducation, GapInExperience, TestID, TestStatus, MedicalTestStatus, BGCTestID, BGCTestStatus, ResumeFile);
                        lstCandidateProfile.Add(objcandidate);
                    }
                    objSqlDataReader.Close();
                }
                return(lstCandidateProfile);
            }
            catch (Exception EE)
            {
                Console.WriteLine(EE);
                Console.Read();
                return(null);
            }
            finally
            {
                myConnection.Close();
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public SortedList <int, ICandidateProfile> GetCandidateProfileList_TestStatus()
        {
            SortedList <int, ICandidateProfile> candidates = new SortedList <int, ICandidateProfile>();
            SqlConnection conn = DBUtility.getConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "sp_getcandidateprofile";
            cmd.Connection  = conn;
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                int cpid             = Convert.ToInt32(reader["CandidateProfileID"]);
                int teststatus       = Convert.ToInt32(reader["TestStatus"]);
                ICandidateProfile cp = new CandidateProfileFactory().CreateCandidateProfile1(cpid, teststatus);
                candidates.Add(cp.CandidateProfileID, cp);
            }
            conn.Close();
            return(candidates);
        }
    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. 4
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)
        {
        }
    }