protected void grdpc_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridViewRow row   = grdpc.Rows[e.RowIndex];
            HiddenField hdnID = (HiddenField)row.FindControl("hdnID");


            PlacementConsultantBL del = new PlacementConsultantBL();
            RecruitmentRequestBL  rbl = new RecruitmentRequestBL();
            RecruitmentRequestBO  rbo = new RecruitmentRequestBO();

            rbo.pcid = Convert.ToInt32(hdnID.Value);
            int Associated = rbl.CheckPC(rbo);

            if (Associated != 0)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Placement Consultant can't be deleted as " + Associated + "  recruitment requests are associated with him/her.');window.location='HDeletePC.aspx';", true);
                return;
            }
            int result = del.DeletePC(Convert.ToInt32(hdnID.Value));

            ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancy deleted successfully');", true);
            //Move to normal mode
            grdpc.EditIndex = -1;
            bind();
        }
Beispiel #2
0
        public int CheckPC(RecruitmentRequestBO rbo)
        {
            //Create Connection object
            SqlConnection conn = null;

            try
            {
                conn = new SqlConnection();
                conn.ConnectionString = "Data Source=ingnrilpsql02;" + "Initial Catalog=AHD13_AMS60;" + "User id=a36;" + "Password=a36;";
                //Query Command details
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "sp_Group4CheckPC";
                cmd.Parameters.AddWithValue("@PlacementConsultantID", rbo.pcid);
                //Open Connection
                conn.Open();
                int RecAssociated = Convert.ToInt32(cmd.ExecuteScalar());
                return(RecAssociated);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    //Close the Connection
                    conn.Close();
                }
            }
            //return the list of Department
        }
Beispiel #3
0
        public int DeleteRecReq(RecruitmentRequestBO bo)
        {
            //Create Connection object
            SqlConnection conn = null;

            try
            {
                conn = new SqlConnection();
                conn.ConnectionString = "Data Source=ingnrilpsql02;" + "Initial Catalog=AHD13_AMS60;" + "User id=a36;" + "Password=a36;";
                //Query Command details
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "sp_Group4DeleteRecReq";
                cmd.Parameters.AddWithValue("@RecruitmentRequestID", bo.recid);
                //Open Connection
                conn.Open();
                int rowsAffected = cmd.ExecuteNonQuery();
                return(rowsAffected);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    //Close the Connection
                    conn.Close();
                }
            }
            //return the list of Department
        }
Beispiel #4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int result = 0;
            int pcid   = Convert.ToInt32(ddlpcid.SelectedValue.ToString());

            RecruitmentRequestBO rbo = new RecruitmentRequestBO();

            rbo.pcid           = pcid;
            rbo.Requested_Date = DateTime.Now;

            RecruitmentRequestBL rbl = new RecruitmentRequestBL();

            result = rbl.AddRecruitmentRequest(rbo);
            if (result == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('Failure');window.location='HRHome.aspx';", true);
            }
            else
            {
                int rec     = result;
                int flag    = 0;
                int result1 = 0;

                //int[] vacids;


                foreach (GridViewRow gvr in gv1.Rows)
                {
                    CheckBox chk = (CheckBox)gvr.FindControl("chk_select");


                    if (chk.Checked)
                    {
                        flag = 1;
                        Label     vacidLabel = (Label)gvr.FindControl("lblname");
                        int       vacids     = Convert.ToInt32(vacidLabel.Text);
                        int       HRID       = Convert.ToInt32(Session["UserID"].ToString());
                        VacancyBO vbo        = new VacancyBO();
                        vbo.RecruitmentRequestID = rec;
                        vbo.VacancyID            = vacids;

                        VacancyBL bl1 = new VacancyBL();
                        result1 = bl1.UpdateRecInVacancy(vbo);
                    }
                }
                if (flag == 0)
                {
                    ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Select atleast 1 vacancy.');window.location='HAddRecReq.aspx';", true);
                }
                else if (result1 == 0)
                {
                    ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Failed to add Vacancy.');window.location='HRHome.aspx';", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Recruitment Request added successfully');window.location='HRHome.aspx';", true);
                }
            }
        }
Beispiel #5
0
        public int AddRecruitmentRequest(RecruitmentRequestBO rbo)
        {
            string ConnectionString = "Data Source=ingnrilpsql02;" + "Initial Catalog=AHD13_AMS60;" + "User id=a36;" + "Password=a36;";

            SqlConnection connection = new SqlConnection(ConnectionString);
            //Connection is opened using Open method

            //create command object
            SqlCommand command = new SqlCommand();

            //Set command type as stored procedure
            command.CommandType = CommandType.StoredProcedure;
            //Command text is stored procedure name if command type is stored

            command.CommandText = "sp_Group4AddRecruitmentRequest";
            //Used to relate command object to connection
            command.Connection = connection;
            //Used to pass parameter to procedure
            command.Parameters.AddWithValue("@PlacementConsultantID", rbo.pcid);
            command.Parameters.AddWithValue("@Requested_Date", rbo.Requested_Date);


            SqlParameter outputparameter = new SqlParameter();

            outputparameter.ParameterName = "@RecruitmentRequestID";
            outputparameter.SqlDbType     = System.Data.SqlDbType.Int;
            outputparameter.Direction     = System.Data.ParameterDirection.Output;
            command.Parameters.Add(outputparameter);
            try
            {
                connection.Open();
                int rowAffected = command.ExecuteNonQuery();
                if (rowAffected > 0)
                {
                    return(Convert.ToInt32(command.Parameters["@RecruitmentRequestID"].Value));
                }
                else
                {
                    //returntype = false;
                    return(0);
                }
            }
            catch (SqlException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                command.Dispose();
                connection.Dispose();
                connection.Close();
            }
            return(0);
        }
        protected void btndelete_Click(object sender, EventArgs e)
        {
            int flag    = 0;
            int count   = gv1.Rows.Count;
            int result1 = 0;
            int res     = 0;

            foreach (GridViewRow gvr in gv1.Rows)
            {
                CheckBox chk = (CheckBox)gvr.FindControl("chk_select");


                if (chk.Checked)
                {
                    flag = flag + 1;

                    Label vacidLabel = (Label)gvr.FindControl("lblname");
                    int   vacids     = Convert.ToInt32(vacidLabel.Text);

                    VacancyBO vbo = new VacancyBO();

                    vbo.VacancyID = vacids;

                    VacancyBL bl1 = new VacancyBL();
                    result1 = bl1.DeleteRecInVacancy(vbo);
                }
            }
            if (flag == 0)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Select atleast 1 Vacancy.')", true);
            }
            else if (count == flag)
            {
                RecruitmentRequestBO bo = new RecruitmentRequestBO();
                bo.recid = Convert.ToInt32(ddlRecID.SelectedValue.ToString());
                RecruitmentRequestBL bl = new RecruitmentRequestBL();
                res = bl.DeleteRecReq(bo);
            }

            if (result1 == 1 && res == 1)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Recruitment Request is deleted successfully');window.location='HRHome.aspx';", true);
            }
            else if (result1 == 1)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancies from Recruitment Request deleted successfully');window.location='HRHome.aspx';", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Error Occured');window.location='HRHome.aspx';", true);
            }
        }
Beispiel #7
0
 protected void ddlReqDate_SelectedIndexChanged(object sender, EventArgs e)
 {
     ddlPCID.Visible   = false;
     lblSelect.Visible = false;
     if (ddlReqDate.SelectedIndex != 0)
     {
         RecruitmentRequestBL bl1 = new RecruitmentRequestBL();
         RecruitmentRequestBO bo  = new RecruitmentRequestBO();
         bo.Requested_Date = Convert.ToDateTime(ddlReqDate.SelectedValue.ToString());
         DataTable result = bl1.GetRecReqDetailsByRD(bo);
         gv1.Visible    = true;
         gv1.DataSource = result;
         gv1.DataBind();
     }
 }
Beispiel #8
0
        public DataTable GetRecReqDetailsByRD(RecruitmentRequestBO bo)
        {
            DataTable dt = new DataTable();
            //Create Connection object
            SqlConnection conn = null;

            try
            {
                conn = new SqlConnection();
                conn.ConnectionString = "Data Source=ingnrilpsql02;" + "Initial Catalog=AHD13_AMS60;" + "User id=a36;" + "Password=a36;";
                //Query Command details
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "sp_Group4GetRecReqDetailsOnRD";
                cmd.Parameters.AddWithValue("@Requested_Date", bo.Requested_Date);
                //Open Connection
                conn.Open();
                //SQLDataReader for Reading the Values
                SqlDataReader sdr = cmd.ExecuteReader();
                //Read the Values fetched.
                dt.Load(sdr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    //Close the Connection
                    conn.Close();
                }
            }
            //return the list of Department
            return(dt);
        }
        public int CheckPC(RecruitmentRequestBO rbo)
        {
            RecruitmentRequestDB rdb = new RecruitmentRequestDB();

            return(rdb.CheckPC(rbo));
        }
        public int DeleteRecReq(RecruitmentRequestBO bo)
        {
            RecruitmentRequestDB db = new RecruitmentRequestDB();

            return(db.DeleteRecReq(bo));
        }
        public DataTable GetRecReqDetailsByRD(RecruitmentRequestBO bo)
        {
            RecruitmentRequestDB db = new RecruitmentRequestDB();

            return(db.GetRecReqDetailsByRD(bo));
        }
        public int AddRecruitmentRequest(RecruitmentRequestBO rbo)
        {
            RecruitmentRequestDB rdb = new RecruitmentRequestDB();

            return(rdb.AddRecruitmentRequest(rbo));
        }