protected void btn_JRReject_Click(object sender, EventArgs e) { try { if (RG_JRApproval.Items.Count == 0) { BLL.ShowMessage(this, "No Records to Reject"); return; } CheckBox chkBoxt = new CheckBox(); Label lblID = new Label(); string strg = ""; for (int index = 0; index <= RG_JRApproval.Items.Count - 1; index++) { chkBoxt = RG_JRApproval.Items[index].FindControl("chk_Choose") as CheckBox; lblID = RG_JRApproval.Items[index].FindControl("lbljrID") as Label; if (chkBoxt.Checked) { if (strg == "") { strg = "" + lblID.Text + ""; } else { strg = strg + "," + lblID.Text + ""; } } } if (string.IsNullOrEmpty(strg)) { BLL.ShowMessage(this, "Please Select Atleast one Record to Reject"); return; } CheckBox chkBox = new CheckBox(); Label lblempid = new Label(); Label lblstatus = new Label(); Label lblJRID = new Label(); bool status1 = false; string str = string.Empty; for (int index = 0; index <= RG_JRApproval.Items.Count - 1; index++) { chkBox = RG_JRApproval.Items[index].FindControl("chk_Choose") as CheckBox; lblempid = RG_JRApproval.Items[index].FindControl("lblempID") as Label; lblstatus = RG_JRApproval.Items[index].FindControl("lbljrstatus") as Label; lblJRID = RG_JRApproval.Items[index].FindControl("lbljrID") as Label; if (chkBox.Checked) { if (Convert.ToString(lblstatus.Text) == "PENDING") { bool status = false; _obj_Rec_JobRequisition = new RECRUITMENT_JOBREQUISITION(); _obj_Rec_JobRequisition.JOBREQ_APPROVALSTATUS = 4; _obj_Rec_JobRequisition.JOBREQ_LEVEL = 1; //Rejection level 1 _obj_Rec_JobRequisition.JOBREQ_APPROVEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Rec_JobRequisition.JOBREQ_APPROVEDDATE = Convert.ToDateTime(rdp_JRApprovalDate.SelectedDate.Value); _obj_Rec_JobRequisition.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]);; _obj_Rec_JobRequisition.LASTMDFDATE = DateTime.Now; _obj_Rec_JobRequisition.JOBREQ_ID = Convert.ToInt32(lblJRID.Text); _obj_Rec_JobRequisition.OPERATION = operation.Check1; status = Recruitment_BLL.set_JobRequisition(_obj_Rec_JobRequisition); if (status == true) { //BLL.ShowMessage(this, " selected Job Requisition Rejected by Approver1"); /* * if (Convert.ToString(RG_JRApproval.Items[index]["APPROVAR1_EMAIL"].Text) != string.Empty && Convert.ToString(RG_JRApproval.Items[index]["EMAIL"].Text) != string.Empty) * { * sendMail(Convert.ToString(RG_JRApproval.Items[index]["APPROVER1_EMAIL"].Text), Convert.ToString(RG_JRApproval.Items[index]["EMAIL"].Text), * Convert.ToString(RG_JRApproval.Items[index]["EMPNAME_APPROVER1"].Text), Convert.ToString(RG_JRApproval.Items[index]["EMPNAME"].Text), * Convert.ToString(RG_JRApproval.Items[index]["JOBREQ_REQCODE"].Text), "Rejected"); * status1 = true; * str = "Approver1"; * } */ //SMHR_LOGININFO _obj_Smhr_LoginInfo = new SMHR_LOGININFO(); //_obj_Smhr_LoginInfo.OPERATION = operation.Empty1; //_obj_Smhr_LoginInfo.LOGIN_USERNAME = Convert.ToString(Session["EMP_ID"]).Trim(); //_obj_Smhr_LoginInfo.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); //_obj_Rec_JobRequisition = new RECRUITMENT_JOBREQUISITION(); _obj_Rec_JobRequisition.JOBREQ_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_Rec_JobRequisition.JOBREQ_RAISEDBY = Convert.ToInt32(Session["USER_ID"]); //_obj_Rec_JobRequisition.JOBREQ_ID = Convert.ToInt32(lblJRID.Text); _obj_Rec_JobRequisition.MODE = 1; bool status2 = Recruitment_BLL.get_JobReqAprover(_obj_Rec_JobRequisition); if (status2) { BLL.ShowMessage(this, "A Mail has been sent to the user"); } //BLL.ShowMessage(this, "A Mail has been sent to the user"); //LoadData(); //RG_JRApproval.DataBind(); //return; } } else if (Convert.ToString(lblstatus.Text) == "APPROVED1") { bool status = false; _obj_Rec_JobRequisition = new RECRUITMENT_JOBREQUISITION(); _obj_Rec_JobRequisition.JOBREQ_APPROVALSTATUS = 4; _obj_Rec_JobRequisition.JOBREQ_LEVEL = 2; //Rejection level 2 _obj_Rec_JobRequisition.JOBREQ_APPROVEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Rec_JobRequisition.JOBREQ_APPROVEDDATE = Convert.ToDateTime(rdp_JRApprovalDate.SelectedDate.Value); _obj_Rec_JobRequisition.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_Rec_JobRequisition.LASTMDFDATE = DateTime.Now; _obj_Rec_JobRequisition.JOBREQ_ID = Convert.ToInt32(lblJRID.Text); _obj_Rec_JobRequisition.OPERATION = operation.Check1; status = Recruitment_BLL.set_JobRequisition(_obj_Rec_JobRequisition); if (status == true) { //BLL.ShowMessage(this, " selected Job Requisition Rejected by Approver2 "); /* * if (Convert.ToString(RG_JRApproval.Items[index]["APPROVAR2_EMAIL"].Text) != string.Empty && Convert.ToString(RG_JRApproval.Items[index]["EMAIL"].Text) != string.Empty) * { * sendMail(Convert.ToString(RG_JRApproval.Items[index]["APPROVER2_EMAIL"].Text), Convert.ToString(RG_JRApproval.Items[index]["EMAIL"].Text), * Convert.ToString(RG_JRApproval.Items[index]["EMPNAME_APPROVER2"].Text), Convert.ToString(RG_JRApproval.Items[index]["EMPNAME"].Text), * Convert.ToString(RG_JRApproval.Items[index]["JOBREQ_REQCODE"].Text), "Rejected"); * status1 = true; * str = "Approver2"; * } */ //_obj_Rec_JobRequisition = new RECRUITMENT_JOBREQUISITION(); _obj_Rec_JobRequisition.JOBREQ_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_Rec_JobRequisition.JOBREQ_RAISEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Rec_JobRequisition.MODE = 1; bool status2 = Recruitment_BLL.get_JobReqAprover(_obj_Rec_JobRequisition); if (status2) { BLL.ShowMessage(this, "A Mail has been sent to the user"); } //LoadData(); //RG_JRApproval.DataBind(); //return; } } else if (Convert.ToString(lblstatus.Text) == "APPROVED2") { bool status = false; _obj_Rec_JobRequisition = new RECRUITMENT_JOBREQUISITION(); _obj_Rec_JobRequisition.JOBREQ_APPROVALSTATUS = 4; _obj_Rec_JobRequisition.JOBREQ_LEVEL = 3; //Rejection level 3 _obj_Rec_JobRequisition.JOBREQ_APPROVEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Rec_JobRequisition.JOBREQ_APPROVEDDATE = Convert.ToDateTime(rdp_JRApprovalDate.SelectedDate.Value); _obj_Rec_JobRequisition.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]);; _obj_Rec_JobRequisition.LASTMDFDATE = DateTime.Now; _obj_Rec_JobRequisition.JOBREQ_ID = Convert.ToInt32(lblJRID.Text); _obj_Rec_JobRequisition.OPERATION = operation.Check1; status = Recruitment_BLL.set_JobRequisition(_obj_Rec_JobRequisition); if (status == true) { //BLL.ShowMessage(this, " selected Job Requisition Rejected by Approver3 "); /* * if (Convert.ToString(RG_JRApproval.Items[index]["APPROVER3_EMAIL"].Text) != string.Empty && Convert.ToString(RG_JRApproval.Items[index]["EMAIL"].Text) != string.Empty) * { * sendMail(Convert.ToString(RG_JRApproval.Items[index]["APPROVER3_EMAIL"].Text), Convert.ToString(RG_JRApproval.Items[index]["EMAIL"].Text), * Convert.ToString(RG_JRApproval.Items[index]["EMPNAME_APPROVER3"].Text), Convert.ToString(RG_JRApproval.Items[index]["EMPNAME"].Text), * Convert.ToString(RG_JRApproval.Items[index]["JOBREQ_REQCODE"].Text), "Rejected"); * status1 = true; * str = "Approver3"; * } */ //_obj_Rec_JobRequisition = new RECRUITMENT_JOBREQUISITION(); _obj_Rec_JobRequisition.JOBREQ_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_Rec_JobRequisition.JOBREQ_RAISEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Rec_JobRequisition.MODE = 1; bool status2 = Recruitment_BLL.get_JobReqAprover(_obj_Rec_JobRequisition); if (status2) { BLL.ShowMessage(this, "A Mail has been sent to the user"); } //LoadData(); //RG_JRApproval.DataBind(); //return; } } } } LoadData(); RG_JRApproval.DataBind(); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_JobRequisitionApproval", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }