private void SendInitiationMail(List <ProbableList> lstAppr) { try { EmailActivityBOL objEmailActivityBOL = new EmailActivityBOL(); DataSet dsGetMailInfo = new DataSet(); EmailActivityBLL objEmailActivityBLL = new EmailActivityBLL(); EmailActivity objEmailActivity = new EmailActivity(); char[] separator = new char[] { ';' }; string failureMsg = "\r\nCandidates initiated but mail sending failed for : "; foreach (ProbableList itemAppr in lstAppr) { objEmailActivityBOL.ToID = objEmailActivityBOL.ToID + itemAppr.EID.ToString() + ";"; //objApr.getMailID(itemAppr.EID); } objEmailActivityBOL.FromAddress = "*****@*****.**"; objEmailActivityBOL.CCID = ConfigurationManager.AppSettings["HR-ADMIN"].ToString(); objEmailActivityBOL.EmailTemplateName = "Appraisal Initiate"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); try { objEmailActivity.SendMail(objEmailActivityBOL); } catch (System.Exception ex) { failureMsg = failureMsg + objEmailActivityBOL.ToAddress; } } catch (Exception ex) { throw ex; } }
//private List<KeyValuePair<int, string>> GetHistory() //{ // try // { // dsRRFDetails = objHRMBLL.GetRRFToApprove(objHRMBOL); // dsRecruiterNames = objHRMBLL.GetRecruiterNames(); // string RecruiterName = dsRRFDetails.Tables[0].Rows[0]["Recruiter"].ToString(); // List<KeyValuePair<int, string>> listRRFHistory = new List<KeyValuePair<int, string>>(); // listRRFHistory.Add(new KeyValuePair<int, string>(Convert.ToInt32("0"), Convert.ToString(dsRRFDetails.Tables[0].Rows[0]["Approver"].ToString() + " " + "RRF Approved"))); // foreach (DataRow rs in dsRecruiterNames.Tables[0].Rows) // { // if (rs[0].ToString() == RecruiterName) // { // listRRFHistory.Add(new KeyValuePair<int, string>(Convert.ToInt32("1"), Convert.ToString("RRF Assigned To" + " " + rs[1].ToString()))); // } // } // //foreach (DataRow courseType in dsCandidateHistory.Tables[0].Rows) // //{ // // DateTime dt = Convert.ToDateTime(courseType[13]); // // listOfCandidateHistory.Add(new KeyValuePair<int, string>(Convert.ToInt32(courseType[0].ToString()), Convert.ToString(Convert.ToDateTime(courseType[13]).ToString("dd/MM/yyyy") + " " + (courseType[14]).ToString().Trim() + " " + courseType[6].ToString().Trim() + " " + courseType[8].ToString().Trim()))); // //} // return listRRFHistory; // } // catch (System.Exception ex) // { // throw new MyException(" Message:" + ex.Message, ex.InnerException); // } //} protected void btnConfirmAndAssign_Click(object sender, EventArgs e) { objHRMBOL.RecruiterID = Convert.ToInt32(lstRecruiterName.SelectedItem.Value); //DateTime currentTime = DateTime.Now; //String date = currentTime.ToString("MM/dd/yyyy"); objHRMBOL.SLAType = Convert.ToInt32(ddlSLATypeName.SelectedItem.Value); objHRMBOL.AssignedDate = DateTime.Now; objHRMBOL.ModifiedDate = DateTime.Now; objHRMBOL.ModifiedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name.ToString()); int TimesReassigned = Convert.ToInt32(dsRRFDetails.Tables[0].Rows[0]["TimesReassigned"]); if (TimesReassigned == 1) { objHRMBLL.SetRecruiterToRRF(objHRMBOL); lblSuccess.Visible = true; lblSuccess.Text = "This RRF has been successfully assigned."; pnlHRM.Visible = false; btnBack.Visible = false; btnRedirect.Visible = true; btnConfirmAndAssign.Visible = false; btnCancel.Visible = false; //Mailing Activity objEmailActivityBOL.ToID = Convert.ToString(lstRecruiterName.SelectedItem.Value) + ";"; //recruiter objEmailActivityBOL.CCID = Convert.ToString(HttpContext.Current.User.Identity.Name) + ";"; //hrm objEmailActivityBOL.FromID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); //hrm objEmailActivityBOL.EmailTemplateName = "Confirm And Assign Recruiter"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string body; body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", txtRRFNo.Text); //body = body.Replace("##skills##", txtKeySkills.Text); //body = body.Replace("##designation##", txtDesignation.Text); body = body.Replace("##ProjectName##", txtProjectName.Text.Trim()); body = body.Replace("##Budget##", txtBudget.Text.Trim()); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##RRFNO##", txtRRFNo.Text); objEmailActivityBOL.Body = body; // (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = txtRRFNo.Text; objEmailActivityBOL.skills = txtKeySkills.Text; objEmailActivityBOL.Position = txtDesignation.Text; try { objEmailActivity.SendMail(objEmailActivityBOL); } catch (System.Exception ex) { lblSuccess.Text = "RRF assigned Successfully ,but e-mails could not be sent."; } } else if (TimesReassigned < 6) { objHRMBLL.SetRecruiterToRRF(objHRMBOL); lblSuccess.Visible = true; lblSuccess.Text = "This RRF has been successfully re-assigned."; pnlHRM.Visible = false; btnBack.Visible = false; btnRedirect.Visible = true; btnConfirmAndAssign.Visible = false; btnCancel.Visible = false; //Mailing Activity objEmailActivityBOL.ToID = Convert.ToString(lstRecruiterName.SelectedItem.Value) + ";"; //recruiter objEmailActivityBOL.CCID = Convert.ToString(HttpContext.Current.User.Identity.Name) + ";" + Session["OldRecruiterID"].ToString() + ";"; //hrm objEmailActivityBOL.FromID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); //hrm objEmailActivityBOL.EmailTemplateName = "Reassign Recruiter"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string body; body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", txtRRFNo.Text); //body = body.Replace("##skills##", txtKeySkills.Text); //body = body.Replace("##designation##", txtDesignation.Text); body = body.Replace("##ProjectName##", txtProjectName.Text.Trim()); body = body.Replace("##Budget##", txtBudget.Text.Trim()); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##RRFNO##", txtRRFNo.Text); objEmailActivityBOL.Body = body;//(dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = txtRRFNo.Text; objEmailActivityBOL.skills = txtKeySkills.Text; objEmailActivityBOL.Position = txtDesignation.Text; try { objEmailActivity.SendMail(objEmailActivityBOL); } catch (System.Exception ex) { lblSuccess.Text = "RRF re-assigned Successfully ,but e-mails could not be sent."; } } else { lblError.Visible = true; lblError.Text = "This RRF cannot be re-assigned as it has already been re-assigned 5 times."; } }
//public void BindPeriod() //{ // List<int> probationPeriod = new List<int>(); // for (int i = 1; i < 100; i++) // { // ddlProbationPeriod.Items.Add(Convert.ToString(i)); // } //} protected void btnSave_Click(object sender, EventArgs e) { string CTCForMail, CommentforMail; objSelectedCandidateBOL.CandidateID = Convert.ToInt32(CandidateID); objSelectedCandidateBOL.RRFNo = Convert.ToInt32(RRFID); objSelectedCandidateBOL.StageID = StageID; objSelectedCandidateBOL.Action = Convert.ToInt32(ddlAction.SelectedItem.Value); objSelectedCandidateBOL.FeedBackBy = Convert.ToInt32(User.Identity.Name); if (ddlAction.SelectedItem.Value.ToString() == "7") { decimal CTC = Convert.ToDecimal(txtCTC.Text); if (CTC != null) { objSelectedCandidateBOL.CTC = CTC; } CTCForMail = Convert.ToString(CTC); } else { objSelectedCandidateBOL.CTC = 0; CTCForMail = "0"; } string expireOnDate = txtJoiningDate.Text; if (!string.IsNullOrEmpty(expireOnDate)) { int pos1 = expireOnDate.IndexOf("/"); int pos2 = expireOnDate.IndexOf("/", pos1 + 1); int strDay; int strMonth; if (Convert.ToInt32(expireOnDate.Substring(0, (pos1 - 1))) == 0) { strMonth = Convert.ToInt32(expireOnDate.Substring(1, (pos1 - 1))); } else { strMonth = Convert.ToInt32(expireOnDate.Substring(0, (pos1))); } if (Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 1)) == 0) { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 2), 1)); } else { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 2)); } int strYear = Convert.ToInt32(expireOnDate.Substring((pos2 + 1))); DateTime expectedClosureDate = new DateTime(strYear, strMonth, strDay); objSelectedCandidateBOL.JoiningDate = expectedClosureDate; } else { objSelectedCandidateBOL.JoiningDate = System.DateTime.Now; } if (string.IsNullOrEmpty(txtProbationPeriod.Text)) { objSelectedCandidateBOL.ProbationPeriod = 0; } else { objSelectedCandidateBOL.ProbationPeriod = Convert.ToInt32(txtProbationPeriod.Text); } objSelectedCandidateBOL.SelectedComment = txtComment.Text; CommentforMail = txtComment.Text; objSelectedCandidateBOL.Grade = ddlGrade.SelectedItem.ToString(); objSelectedCandidateBOL.OfferedPosition = Convert.ToInt32(ddlOfferedPosition.SelectedItem.Value); objSelectedCandidateBOL.OfferedEmployementType = Convert.ToInt32(ddlEmploymentType.SelectedItem.Value); objSelectedCandidateBOL.ScheduleId = Convert.ToInt32(Session["MainScheduleID"]); objSelectedCandidateBLL.SetSelectedCandidate(objSelectedCandidateBOL); ClearValues(); int i = 1; //Mailing Activity objRRFApproverBOL.Role = "HRM"; dsGetEmployeeFromRole = objRRFApproverBLL.GetEmployeeFromRole(objRRFApproverBOL); string toID = dsGetEmployeeFromRole.Tables[0].Rows[0]["UserId"].ToString(); for (int j = 1; j < dsGetEmployeeFromRole.Tables[0].Rows.Count; j++) { toID = toID + ';' + dsGetEmployeeFromRole.Tables[0].Rows[j]["UserId"].ToString(); } objEmailActivityBOL.ToID = Convert.ToString(toID) + ";";//candidate //objEmailActivityBOL.CCID = Convert.ToString(recruiterid) + ";" + Convert.ToString(toID) + ";";//recruiter,HRM objEmailActivityBOL.CCID = Convert.ToString(recruiterid) + ";" + Convert.ToString(HttpContext.Current.User.Identity.Name) + ";"; //recruiter,HRM objEmailActivityBOL.FromID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); //Interviewer if (ddlAction.SelectedItem.Text == "Generate offer") { objEmailActivityBOL.EmailTemplateName = "Offer Issued"; } else if (ddlAction.SelectedItem.Text == "On Hold") { objEmailActivityBOL.EmailTemplateName = "On Hold"; } else if (ddlAction.SelectedItem.Text == "Rejected") { objEmailActivityBOL.EmailTemplateName = "Rejected"; } dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); DataSet dsmaildetails = new DataSet(); dsmaildetails = objSelectedCandidateBLL.GetDetailsformail(objSelectedCandidateBOL); string body; body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); body = body.Replace("##amount##", CTCForMail); //body = body.Replace("##designation##", ddlOfferedPosition.SelectedItem.ToString()); body = body.Replace("##Candidate Name##", lblCandidate.Text); body = body.Replace("##InterviewDate##", (dsmaildetails.Tables[0].Rows[0]["ScheduledDatetime"].ToString())); body = body.Replace("##comment##", CommentforMail); char[] separator = new char[] { ';' }; try { //candidateemailid = candidateemailid + ";"; //objEmailActivityBOL.ToAddress = Convert.ToString(candidateemailid).Split(separator); objEmailActivityBOL.CandidateName = Session["CandidateName"].ToString(); objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString().Split(separator)); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Body = body; // (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = ddlOfferedPosition.SelectedItem.ToString(); objEmailActivity.SendMail(objEmailActivityBOL); ScriptManager.RegisterStartupScript(this, typeof(string), "SelectedCandidate", "javascript:SelectedCandidateLoader();", true); } catch (System.Exception ex) { mailFlag = 1; lblMessage.Text = "Feedback entered successfully,but e-mails could not be sent."; lblMessage.Visible = true; } finally { Session["Mode"] = "Read"; Session["StageID"] = StageID; Session["CandidateID"] = CandidateID; Session["RRFID"] = RRFID; Session["Flag"] = Convert.ToString(i); Session["ScheduleID"] = Session["MainScheduleID"]; Session["StageName"] = lblStage.Text; Session["DesignationName"] = offerdPosition; Session["RRFNumber"] = lblRRFNo.Text; if (mailFlag == 1) { Session["Message"] = "Feedback entered successfully,but e-mails could not be sent to the candidate"; Response.Redirect("SelectedCandidate.aspx"); //Response.Redirect("SelectedCandidate.aspx?Mode=Read&StageID=" + StageID + "&CandidateID=" + CandidateID + "&RRFID=" + RRFID + "&Flag=" + i + "&ScheduleID=" + ScheduleID + "&StageName=" + lblStage.Text + "&DesignationName=" + offerdPosition + "&RRFNumber=" + lblRRFNo.Text + "&Message=Feedback entered successfully,but e-mails could not be sent to the candidate"); } else { Session["Message"] = ""; // Response.Redirect("SelectedCandidate.aspx?Mode=Read&StageID=" + StageID + "&CandidateID=" + CandidateID + "&RRFID=" + RRFID + "&Flag=" + i + "&ScheduleID=" + ScheduleID + "&StageName=" + lblStage.Text + "&DesignationName=" + offerdPosition + "&RRFNumber=" + lblRRFNo.Text); Response.Redirect("SelectedCandidate.aspx"); } } }
protected void btnSendForApproval_Click(object sender, EventArgs e) { lblIndicativePanel1.Visible = false; lblIndicativePanel2.Visible = false; lblIndicativePanel3.Visible = false; lblReplacement.Visible = false; // get login Id of current user. objRRFRequestorBOL.RequestedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); objRRFRequestorBOL.RequestDate = DateTime.Now; if (txtExpectedClosureDate.Text == "") { objRRFRequestorBOL.ExpectedClosureDate = Convert.ToDateTime("1900-01-01 00:00:00.000"); } else { string expireOnDate = txtExpectedClosureDate.Text; int pos1 = expireOnDate.IndexOf("/"); int pos2 = expireOnDate.IndexOf("/", pos1 + 1); int strDay; int strMonth; if (Convert.ToInt32(expireOnDate.Substring(0, (pos1 - 1))) == 0) { strMonth = Convert.ToInt32(expireOnDate.Substring(1, (pos1 - 1))); } else { strMonth = Convert.ToInt32(expireOnDate.Substring(0, (pos1))); } if (Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 1)) == 0) { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 2), 1)); } else { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 2)); } int strYear = Convert.ToInt32(expireOnDate.Substring((pos2 + 1))); DateTime expectedClosureDate = new DateTime(strYear, strMonth, strDay); objRRFRequestorBOL.ExpectedClosureDate = expectedClosureDate; } objRRFRequestorBOL.RRFForDU = Convert.ToInt32(ddlForDU.SelectedItem.Value); objRRFRequestorBOL.DUName = Convert.ToString(ddlForDU.SelectedItem.Text); if (ddlForDT.SelectedItem.Value == "") { objRRFRequestorBOL.RRFForDT = 0; } else { objRRFRequestorBOL.RRFForDT = Convert.ToInt32(ddlForDT.SelectedItem.Value); } if (txtProjectName.Text == "") { objRRFRequestorBOL.ProjectName = ""; } else { objRRFRequestorBOL.ProjectName = Convert.ToString(txtProjectName.Text); } objRRFRequestorBOL.Designation = Convert.ToInt32(ddlDesignation.SelectedItem.Value); if (txtIndicativePanel1.Text == "") { objRRFRequestorBOL.IndicativePanel1 = 0; } else { int isIndicativePanel1Empty = 1; int employeeID1 = 0; if (dsIndicativePanel1 != null) { if (dsIndicativePanel1.Tables.Count > 0 && dsIndicativePanel1.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsIndicativePanel1.Tables[0].Rows.Count; i++) { if (txtIndicativePanel1.Text == dsIndicativePanel1.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeID1 = Convert.ToInt32(dsIndicativePanel1.Tables[0].Rows[i]["UserID"]); isIndicativePanel1Empty = 1; break; } else { isIndicativePanel1Empty = 0; } } } else { lblIndicativePanel1.Visible = true; return; } } if (isIndicativePanel1Empty == 1) { objRRFRequestorBOL.IndicativePanel1 = employeeID1; } else { lblIndicativePanel1.Visible = true; return; } } if (txtIndicativePanel2.Text == "") { objRRFRequestorBOL.IndicativePanel2 = 0; } else { int isIndicativePanel2Empty = 1; int employeeID2 = 0; if (dsIndicativePanel2 != null) { if (dsIndicativePanel2.Tables.Count > 0 && dsIndicativePanel2.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsIndicativePanel2.Tables[0].Rows.Count; i++) { if (txtIndicativePanel2.Text == dsIndicativePanel2.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeID2 = Convert.ToInt32(dsIndicativePanel2.Tables[0].Rows[i]["UserID"]); isIndicativePanel2Empty = 1; break; } else { isIndicativePanel2Empty = 0; } } } else { lblIndicativePanel2.Visible = true; return; } } if (isIndicativePanel2Empty == 1) { objRRFRequestorBOL.IndicativePanel2 = employeeID2; } else { lblIndicativePanel2.Visible = true; return; } } if (txtIndicativePanel3.Text == "") { objRRFRequestorBOL.IndicativePanel3 = 0; } else { int isIndicativePanel3Empty = 1; int employeeID3 = 0; if (dsIndicativePanel3 != null) { if (dsIndicativePanel3.Tables.Count > 0 && dsIndicativePanel3.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsIndicativePanel3.Tables[0].Rows.Count; i++) { if (txtIndicativePanel3.Text == dsIndicativePanel3.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeID3 = Convert.ToInt32(dsIndicativePanel3.Tables[0].Rows[i]["UserID"]); isIndicativePanel3Empty = 1; break; } else { isIndicativePanel3Empty = 0; } } } else { lblIndicativePanel3.Visible = true; return; } } if (isIndicativePanel3Empty == 1) { objRRFRequestorBOL.IndicativePanel3 = employeeID3; } else { lblIndicativePanel3.Visible = true; return; } } if (ddlResourcePool.SelectedItem.Value == "") { objRRFRequestorBOL.ResourcePool = 0; } else { objRRFRequestorBOL.ResourcePool = Convert.ToInt32(ddlResourcePool.SelectedItem.Value); } objRRFRequestorBOL.PositionsRequired = Convert.ToInt32(txtPositionsRequired.Text); if (ddlEmploymentType.SelectedItem.Value == "") { objRRFRequestorBOL.EmployeementType = 0; } else { objRRFRequestorBOL.EmployeementType = Convert.ToInt32(ddlEmploymentType.SelectedItem.Value); } if (rdobtnIsReplacement.SelectedItem.Text == "Yes") { objRRFRequestorBOL.IsReplacement = true; int isReplacementForEmpty = 1; int employeeID4 = 0; if (dsReplacementFor != null) { if (dsReplacementFor.Tables.Count > 0 && dsReplacementFor.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsReplacementFor.Tables[0].Rows.Count; i++) { if (txtReplacementFor.Text == dsReplacementFor.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeID4 = Convert.ToInt32(dsReplacementFor.Tables[0].Rows[i]["UserID"]); isReplacementForEmpty = 1; break; } else { isReplacementForEmpty = 0; } } } else { lblReplacement.Visible = true; return; } } if (isReplacementForEmpty == 1) { objRRFRequestorBOL.ReplacementFor = employeeID4; } else { lblReplacement.Visible = true; return; } } else if (rdobtnIsReplacement.SelectedItem.Text == "No") { objRRFRequestorBOL.IsReplacement = false; objRRFRequestorBOL.ReplacementFor = 0; } if (rdobtnIsBillable.SelectedItem.Text == "Yes") { objRRFRequestorBOL.IsBillable = true; } else if (rdobtnIsBillable.SelectedItem.Text == "No") { objRRFRequestorBOL.IsBillable = false; } objRRFRequestorBOL.KeySkills = Convert.ToString(txtKeySkills.Text); objRRFRequestorBOL.Experience = Convert.ToInt32(txtExperience.Text); objRRFRequestorBOL.BusinessJustification = Convert.ToString(txtBuisnessJustification.Text); if (txtAdditionalInformation.Text == "") { objRRFRequestorBOL.AdditionalInfo = ""; } else { objRRFRequestorBOL.AdditionalInfo = Convert.ToString(txtAdditionalInformation.Text); } objRRFRequestorBOL.ApprovedBy = Convert.ToInt32(ddlApproverName.SelectedItem.Value); objRRFRequestorBOL.SLAForSkill = Convert.ToInt32(ddlSLAForTechnology.SelectedItem.Value); DataSet dsmaildetails = new DataSet(); dsmaildetails = objRRFRequestorBLL.AddRRF(objRRFRequestorBOL); //Mailing Activity string body; objEmailActivityBOL.ToID = Convert.ToString(ddlApproverName.SelectedItem.Value) + ";"; objEmailActivityBOL.CCID = Convert.ToString(HttpContext.Current.User.Identity.Name) + ";"; objEmailActivityBOL.FromID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); objEmailActivityBOL.EmailTemplateName = "Send For Approval"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); MasterPage objMaster = new MasterPage(); body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //get name of Requestor body = body.Replace("##EmployeeName##", (dsGetMailInfo.Tables[1].Rows[0]["firstname"].ToString())); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", txtKeySkills.Text.Trim()); //body = body.Replace("##designation##", (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString())); body = body.Replace("##ProjectName##", txtProjectName.Text.Trim()); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); objEmailActivityBOL.Body = body; objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = txtKeySkills.Text.Trim(); objEmailActivityBOL.Position = (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString()); try { objEmailActivity.SendMail(objEmailActivityBOL); lblSuccessMessage.Text = "RRF sent for Approval Successfully"; // lblSuccessMessage.Visible = true; } catch (System.Exception ex) { lblSuccessMessage.Text = "RRF sent for Approval Successfully ,but e-mails could not be sent."; } btnBack.Enabled = true; btnCancel.Enabled = true; btnRedirect.Enabled = true; btnSendForApproval.Enabled = true; lblSuccessMessage.Visible = true; pnlRRFRequestor.Visible = false; btnBack.Visible = false; btnRedirect.Visible = true; btnSendForApproval.Visible = false; btnCancel.Visible = false; //System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "", "javascript:MessageTextResult();", true); }
protected void btnCloseRRRF_Click(object sender, EventArgs e) { string RRFID = string.Empty; lblMessage.Visible = false; foreach (GridViewRow gvRow in grdRRF.Rows) { CheckBox chkSelect = (CheckBox)gvRow.FindControl("chkSelect"); if (chkSelect.Checked == true) { Label lblRRFID = (Label)gvRow.FindControl("lblRRFID"); RRFID = Convert.ToString(lblRRFID.Text).Trim(); Label lblRRFStatus = (Label)gvRow.FindControl("lblRRFStatus"); rrfStatus = Convert.ToString(lblRRFStatus.Text).Trim(); } } if (RRFID != string.Empty) { if (rrfStatus == "Yet To Begin" || rrfStatus == "In Progress") { objRRFListBOL.RRFID = Convert.ToInt32(RRFID); OfferIssedToAnyCandidate = objRRFListBLL.CheckOfferIssedToAnyCandidate(objRRFListBOL); //first check whether offer is issued to any candidate if (!string.IsNullOrEmpty(OfferIssedToAnyCandidate.Tables[0].Rows[0]["countCandidate"].ToString()) && (OfferIssedToAnyCandidate.Tables[0].Rows[0]["countCandidate"].ToString() != "0")) { Session["RRFID"] = Convert.ToString(RRFID); objRRFListBLL.CloseRRF(objRRFListBOL); objRRFListBOL.RRFStatus = 3; objRRFListBOL.ApprovalStatus = 0; objRRFListBOL.ModifiedDate = DateTime.Now; objRRFListBLL.UdateRRFValuesToApprove(objRRFListBOL); String toid = Convert.ToString(dsRRfList.Tables[0].Rows[0]["ApprovedById"]);//approver String fromid = Convert.ToString(HttpContext.Current.User.Identity.Name); String ccid = String.Empty; if (string.IsNullOrEmpty(dsRRfList.Tables[0].Rows[0]["RecruiterId"].ToString())) { ccid = fromid; } else { ccid = fromid + ";" + Convert.ToString(dsRRfList.Tables[0].Rows[0]["RecruiterId"].ToString()); } //Mailing Activity objEmailActivityBOL.ToID = Convert.ToString(toid) + ";"; //requestor objEmailActivityBOL.CCID = Convert.ToString(ccid) + ";"; //approver objEmailActivityBOL.FromID = Convert.ToInt32(fromid); //approver objEmailActivityBOL.EmailTemplateName = "Close RRF"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); if (OfferIssedToAnyCandidate.Tables[1].Rows.Count != 0) { objEmailActivityBOL.skills = (OfferIssedToAnyCandidate.Tables[1].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = (OfferIssedToAnyCandidate.Tables[1].Rows[0]["Designationname"].ToString()); objEmailActivityBOL.CandidateName = (OfferIssedToAnyCandidate.Tables[1].Rows[0]["FirstName"].ToString()); objEmailActivityBOL.RRFNo = (OfferIssedToAnyCandidate.Tables[1].Rows[0]["RRFNo"].ToString()); } try { objEmailActivity.SendMail(objEmailActivityBOL); } catch (System.Exception ex) { lblSuccessMessage.Text = "RRF Closed Successfully ,but e-mails could not be sent."; } BindData(); lblSuccessMessage.Visible = true; lblSuccessMessage.Text = "RRF Closed Successfully"; } else if (checkOfferIssedToAnyCandidate > 1) { lblMessage.Visible = true; lblMessage.Text = "Offer is issued to more than one Candidates against this RRF, so can not Close this RRF.\nView Candidate Status for this RRF to view the Candidate."; } else { lblMessage.Visible = true; lblMessage.Text = "Offer is not issued to a single candidate on this RRF, so can not Close this RRF."; } } else { lblMessage.Visible = true; lblMessage.Text = "This action is not allowed"; } } }
protected void btnApproveandSendtoHR_Click(object sender, EventArgs e) { // for mail activity.. variables string designationmail; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOWNew", "javascript:HideImageloader();", true); // for mail activity.. variables lblIndicativePanel1.Visible = false; lblIndicativePanel2.Visible = false; lblIndicativePanel3.Visible = false; lblReplacement.Visible = false; //objRRFApproverBOL.RRFID = Convert.ToInt32(Request.QueryString["RRFID"].ToString()); objRRFApproverBOL.RRFID = Convert.ToInt32(Session["RRFID"].ToString()); dsGetRRFValuesToApprove = objRRFApproverBLL.GetRRFValuesToApprove(objRRFApproverBOL); objRRFApproverBOL.RequestedBy = Convert.ToInt32(dsGetRRFValuesToApprove.Tables[0].Rows[0]["RequestedByID"]); objRRFApproverBOL.RRFNo = txtRRFNo.Text; objRRFApproverBOL.RequestDate = requestDate; if (txtExpectedClosureDate.Text == "") { objRRFApproverBOL.ExpectedClosureDate = Convert.ToDateTime("1900-01-01 00:00:00.000"); } else { string expireOnDate = txtExpectedClosureDate.Text; int pos1 = 0; int pos2 = 0; if (expireOnDate.Contains("/")) { pos1 = expireOnDate.IndexOf("/"); pos2 = expireOnDate.IndexOf("/", pos1 + 1); } else if (expireOnDate.Contains("-")) { pos1 = expireOnDate.IndexOf("-"); pos2 = expireOnDate.IndexOf("-", pos1 + 1); } int strDay; int strMonth; if (Convert.ToInt32(expireOnDate.Substring(0, (pos1 - 1))) == 0) { strMonth = Convert.ToInt32(expireOnDate.Substring(1, (pos1 - 1))); } else { strMonth = Convert.ToInt32(expireOnDate.Substring(0, (pos1))); } if (Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 1)) == 0) { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 2), 1)); } else { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 2)); } int strYear = Convert.ToInt32(expireOnDate.Substring((pos2 + 1))); DateTime expectedClosureDate = new DateTime(strYear, strMonth, strDay); objRRFApproverBOL.ExpectedClosureDate = expectedClosureDate; } objRRFApproverBOL.RRFForDU = Convert.ToInt32(ddlForDU.SelectedItem.Value); if (ddlForDT.SelectedItem.Value == "") { objRRFApproverBOL.RRFForDT = 0; } else { objRRFApproverBOL.RRFForDT = Convert.ToInt32(ddlForDT.SelectedItem.Value); } if (txtProjectName.Text == "") { objRRFApproverBOL.ProjectName = ""; } else { objRRFApproverBOL.ProjectName = Convert.ToString(txtProjectName.Text); } objRRFApproverBOL.Designation = Convert.ToInt32(ddlDesignation.SelectedItem.Value); designationmail = ddlDesignation.SelectedItem.ToString(); if (txtIndicativePanel1.Text == "") { objRRFApproverBOL.IndicativePanel1 = 0; } else { if (txtIndicativePanel1.Text == Convert.ToString(dsGetRRFValuesToApprove.Tables[0].Rows[0]["Ind1"])) { objRRFApproverBOL.IndicativePanel1 = Convert.ToInt32(dsGetRRFValuesToApprove.Tables[0].Rows[0]["Ind1ID"]); } else { int isIndicativePanel1Empty = 1; int employeeID1 = 0; if (dsIndicativePanel1 != null) { if (dsIndicativePanel1.Tables.Count > 0 && dsIndicativePanel1.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsIndicativePanel1.Tables[0].Rows.Count; i++) { if (txtIndicativePanel1.Text == dsIndicativePanel1.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeID1 = Convert.ToInt32(dsIndicativePanel1.Tables[0].Rows[i]["UserID"]); isIndicativePanel1Empty = 1; break; } else { isIndicativePanel1Empty = 0; } } } else { lblIndicativePanel1.Visible = true; return; } } if (isIndicativePanel1Empty == 1) { objRRFApproverBOL.IndicativePanel1 = employeeID1; } else { lblIndicativePanel1.Visible = true; return; } } } if (txtIndicativePanel2.Text == "") { objRRFApproverBOL.IndicativePanel2 = 0; } else { if (txtIndicativePanel2.Text == Convert.ToString(dsGetRRFValuesToApprove.Tables[0].Rows[0]["Ind2"])) { objRRFApproverBOL.IndicativePanel2 = Convert.ToInt32(dsGetRRFValuesToApprove.Tables[0].Rows[0]["Ind2ID"]); } else { int isIndicativePanel2Empty = 1; int employeeID2 = 0; if (dsIndicativePanel2 != null) { if (dsIndicativePanel2.Tables.Count > 0 && dsIndicativePanel2.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsIndicativePanel2.Tables[0].Rows.Count; i++) { if (txtIndicativePanel2.Text == dsIndicativePanel2.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeID2 = Convert.ToInt32(dsIndicativePanel2.Tables[0].Rows[i]["UserID"]); isIndicativePanel2Empty = 1; break; } else { isIndicativePanel2Empty = 0; } } } else { lblIndicativePanel2.Visible = true; return; } } if (isIndicativePanel2Empty == 1) { objRRFApproverBOL.IndicativePanel2 = employeeID2; } else { lblIndicativePanel2.Visible = true; return; } } } if (txtIndicativePanel3.Text == "") { objRRFApproverBOL.IndicativePanel3 = 0; } else { if (txtIndicativePanel3.Text == Convert.ToString(dsGetRRFValuesToApprove.Tables[0].Rows[0]["Ind3"])) { objRRFApproverBOL.IndicativePanel3 = Convert.ToInt32(dsGetRRFValuesToApprove.Tables[0].Rows[0]["Ind3ID"]); } else { int isIndicativePanel3Empty = 1; int employeeID3 = 0; if (dsIndicativePanel3 != null) { if (dsIndicativePanel3.Tables.Count > 0 && dsIndicativePanel3.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsIndicativePanel3.Tables[0].Rows.Count; i++) { if (txtIndicativePanel3.Text == dsIndicativePanel3.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeID3 = Convert.ToInt32(dsIndicativePanel3.Tables[0].Rows[i]["UserID"]); isIndicativePanel3Empty = 1; break; } else { isIndicativePanel3Empty = 0; } } } else { lblIndicativePanel3.Visible = true; return; } } if (isIndicativePanel3Empty == 1) { objRRFApproverBOL.IndicativePanel3 = employeeID3; } else { lblIndicativePanel3.Visible = true; return; } } } if (ddlResourcePool.SelectedItem.Value == "") { objRRFApproverBOL.ResourcePool = 0; } else { objRRFApproverBOL.ResourcePool = Convert.ToInt32(ddlResourcePool.SelectedItem.Value); } objRRFApproverBOL.PositionsRequired = Convert.ToInt32(txtPositionsRequired.Text); if (ddlEmploymentType.SelectedItem.Value == "") { objRRFApproverBOL.EmployeementType = 0; } else { objRRFApproverBOL.EmployeementType = Convert.ToInt32(ddlEmploymentType.SelectedItem.Value); } if (rdobtnIsReplacement.SelectedItem.Text == "Yes") { if (txtReplacementFor.Text == Convert.ToString(dsGetRRFValuesToApprove.Tables[0].Rows[0]["ReplacementFor"])) { objRRFApproverBOL.ReplacementFor = Convert.ToInt32(dsGetRRFValuesToApprove.Tables[0].Rows[0]["ReplacementForID"]); objRRFApproverBOL.IsReplacement = true; } else { objRRFApproverBOL.IsReplacement = true; int isReplacementForEmpty = 1; int employeeID4 = 0; if (dsReplacementFor != null) { if (dsReplacementFor.Tables.Count > 0 && dsReplacementFor.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsReplacementFor.Tables[0].Rows.Count; i++) { if (txtReplacementFor.Text == dsReplacementFor.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeID4 = Convert.ToInt32(dsReplacementFor.Tables[0].Rows[i]["UserID"]); isReplacementForEmpty = 1; break; } else { isReplacementForEmpty = 0; } } } else { lblReplacement.Visible = true; return; } } if (isReplacementForEmpty == 1) { objRRFApproverBOL.ReplacementFor = employeeID4; } else { lblReplacement.Visible = true; return; } } } else if (rdobtnIsReplacement.SelectedItem.Text == "No") { objRRFApproverBOL.IsReplacement = false; objRRFApproverBOL.ReplacementFor = 0; } if (rdobtnIsBillable.SelectedItem.Text == "Yes") { objRRFApproverBOL.IsBillable = true; } else if (rdobtnIsBillable.SelectedItem.Text == "No") { objRRFApproverBOL.IsBillable = false; } objRRFApproverBOL.KeySkills = Convert.ToString(txtKeySkills.Text); objRRFApproverBOL.Experience = Convert.ToInt32(txtExperience.Text); objRRFApproverBOL.BusinessJustification = Convert.ToString(txtBuisnessJustification.Text); if (txtAdditionalInformation.Text == "") { objRRFApproverBOL.AdditionalInfo = ""; } else { objRRFApproverBOL.AdditionalInfo = Convert.ToString(txtAdditionalInformation.Text); } objRRFApproverBOL.BudgetPerVacancy = Convert.ToDecimal(txtBudgetPerVacancy.Text); DateTime currentDate = DateTime.Now; objRRFApproverBOL.ApproveDate = currentDate; objRRFApproverBOL.ApprovedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); objRRFApproverBOL.SLAForSkill = Convert.ToInt32(ddlSLAForTechnology.SelectedItem.Value); objRRFApproverBLL.AddRRF(objRRFApproverBOL); //Mailing Activity objRRFApproverBOL.Role = "HRM"; dsGetEmployeeFromRole = objRRFApproverBLL.GetEmployeeFromRole(objRRFApproverBOL); string toID = dsGetEmployeeFromRole.Tables[0].Rows[0]["UserId"].ToString(); for (int i = 1; i < dsGetEmployeeFromRole.Tables[0].Rows.Count; i++) { toID = toID + ';' + dsGetEmployeeFromRole.Tables[0].Rows[i]["UserId"].ToString(); } objEmailActivityBOL.ToID = Convert.ToString(toID) + ";"; //hrm objEmailActivityBOL.CCID = Convert.ToString(Session["Requestor"]) + ";" + Convert.ToString(HttpContext.Current.User.Identity.Name) + ";"; //requestor,approver objEmailActivityBOL.FromID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); //approver objEmailActivityBOL.EmailTemplateName = "Approve RRF"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string body; body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", objRRFApproverBOL.RRFNo); //body = body.Replace("##skills##", objRRFApproverBOL.KeySkills); //body = body.Replace("##designation##", designationmail); body = body.Replace("##ProjectName##", txtProjectName.Text); body = body.Replace("##comment##", txtAdditionalInformation.Text); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##RRFNO##", objRRFApproverBOL.RRFNo); objEmailActivityBOL.Body = body;//(dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = objRRFApproverBOL.RRFNo; objEmailActivityBOL.skills = objRRFApproverBOL.KeySkills; objEmailActivityBOL.Position = designationmail; try { objEmailActivity.SendMail(objEmailActivityBOL); } catch (System.Exception ex) { lblSuccessMessage.Text = "RRF successfully sent,but e-mails could not be sent."; } btnApproveandSendtoHR.Enabled = true; btnBack.Enabled = true; btnPushbackRRF.Enabled = true; btnRedirect.Enabled = true; btnRejectRRF.Enabled = true; btnResendForApproval.Enabled = true; lblSuccessMessage.Visible = true; pnlRRFApprover.Visible = false; btnBack.Visible = false; lblTitle.Visible = false; btnRedirect.Visible = true; txtExpectedClosureDate.Text = ""; txtAdditionalInformation.Text = ""; txtBuisnessJustification.Text = ""; txtExperience.Text = ""; txtIndicativePanel1.Text = ""; txtIndicativePanel2.Text = ""; txtIndicativePanel3.Text = ""; txtKeySkills.Text = ""; txtPositionsRequired.Text = ""; txtProjectName.Text = ""; txtReplacementFor.Text = ""; //BindData(); //ddlDesignation.SelectedIndex = 0; //ddlEmploymentType.SelectedIndex = 0; //ddlForDU.SelectedIndex = 0; //ddlResourcePool.SelectedIndex = 0; }
protected void btnSendToAddComment_Click(object sender, EventArgs e) { int RRFID = Convert.ToInt32(Session["RRFID"]); objRRFApproverBOL.RRFID = RRFID; objRRFApproverBOL.ModifiedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); objRRFApproverBOL.ModifiedDate = DateTime.Now; DataSet dsmaildetails = new DataSet(); dsmaildetails = objRRFApproverBLL.getmaildetails(RRFID); if (lblTitle.Text == "Reject RRF") { //toid = Request.QueryString["toid"]; //fromid = Request.QueryString["fromid"]; //ccid = Request.QueryString["ccid"]; toid = Convert.ToString(Session["toid"]); fromid = Convert.ToString(Session["fromid"]); ccid = Convert.ToString(Session["ccid"]); objRRFApproverBOL.RRFStatus = 0; objRRFApproverBOL.ApprovalStatus = 4; lblSuccess.Text = "RRF Rejected Successfully"; objRRFApproverBOL.Comments = txtReasonFor.Text; objRRFApproverBLL.UdateRRFValuesToApprove(objRRFApproverBOL); //Mailing Activity objEmailActivityBOL.ToID = Convert.ToString(toid) + ";"; //requestor objEmailActivityBOL.CCID = Convert.ToString(ccid) + ";"; //approver objEmailActivityBOL.FromID = Convert.ToInt32(fromid); //approver objEmailActivityBOL.EmailTemplateName = "Reject RRF"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string body; body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); //body = body.Replace("##designation##", (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString())); body = body.Replace("##ProjectName##", (dsmaildetails.Tables[0].Rows[0]["ProjectName"].ToString())); body = body.Replace("##comment##", txtReasonFor.Text); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); objEmailActivityBOL.Body = body;//(dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString()); try { objEmailActivity.SendMail(objEmailActivityBOL); } catch (System.Exception ex) { lblSuccess.Text = "RRF rejected successfully,but e-mails could not be sent."; } } else if (lblTitle.Text == "Push Back RRF") { //toid = Request.QueryString["toid"]; //fromid = Request.QueryString["fromid"]; //ccid = Request.QueryString["ccid"]; toid = Convert.ToString(Session["toid"]); fromid = Convert.ToString(Session["fromid"]); ccid = Convert.ToString(Session["ccid"]); objRRFApproverBOL.RRFStatus = 0; objRRFApproverBOL.ApprovalStatus = 3; lblSuccess.Text = "RRF sent for Clarification"; objRRFApproverBOL.Comments = txtReasonFor.Text; objRRFApproverBLL.UdateRRFValuesToApprove(objRRFApproverBOL); //Mailing Activity string role; role = Session["Role"].ToString(); if (role == "Approver") { objEmailActivityBOL.ToID = Convert.ToString(toid) + ";"; //requestor objEmailActivityBOL.CCID = Convert.ToString(ccid) + ";"; //approver objEmailActivityBOL.FromID = Convert.ToInt32(fromid); //approver //objEmailActivityBOL.EmailTemplateName = "Resend For Approval Approver"; objEmailActivityBOL.EmailTemplateName = "Pushback RRF"; } else { objEmailActivityBOL.ToID = Convert.ToString(toid) + ";"; //requestor objEmailActivityBOL.CCID = Convert.ToString(ccid) + ";"; //approver objEmailActivityBOL.FromID = Convert.ToInt32(fromid); //approver objEmailActivityBOL.EmailTemplateName = "Resend For Approval"; } dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string body; body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); //body = body.Replace("##designation##", (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString())); body = body.Replace("##ProjectName##", (dsmaildetails.Tables[0].Rows[0]["ProjectName"].ToString())); body = body.Replace("##comment##", txtReasonFor.Text); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); objEmailActivityBOL.Body = body; // (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString()); try { objEmailActivity.SendMail(objEmailActivityBOL); } catch (System.Exception ex) { lblSuccess.Text = "RRF sent for Clarification ,but e-mails could not be sent."; } } else if (lblTitle.Text == "Cancel RRF") { //toid = Request.QueryString["toid"]; //fromid = Request.QueryString["fromid"]; //ccid = Request.QueryString["ccid"]; toid = Convert.ToString(Session["toid"]); fromid = Convert.ToString(Session["fromid"]); ccid = Convert.ToString(Session["ccid"]); objRRFApproverBOL.RRFStatus = 4; objRRFApproverBOL.ApprovalStatus = 0; objRRFListBLL.CancelRRF(objRRFApproverBOL); lblSuccess.Text = "RRF Cancelled Successfully"; objRRFApproverBOL.Comments = txtReasonFor.Text; objRRFApproverBLL.UdateRRFValuesToApprove(objRRFApproverBOL); objEmailActivityBOL.ToID = Convert.ToString(toid) + ";"; //hrm objEmailActivityBOL.CCID = Convert.ToString(ccid) + ";"; //hrm,recruiter objEmailActivityBOL.FromID = Convert.ToInt32(fromid); //approver objEmailActivityBOL.EmailTemplateName = "Cancel RRF"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string body; body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); //body = body.Replace("##designation##", (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString())); body = body.Replace("##ProjectName##", (dsmaildetails.Tables[0].Rows[0]["ProjectName"].ToString())); body = body.Replace("##comment##", txtReasonFor.Text); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); objEmailActivityBOL.Body = body; // (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString()); try { objEmailActivity.SendMail(objEmailActivityBOL); } catch (System.Exception ex) { lblSuccess.Text = "RRF Cancelled Successfully ,but e-mails could not be sent."; } } lblSuccess.Visible = true; btnRedirect.Visible = true; btnBack.Visible = false; pnlRRFComments.Visible = false; }
protected void InsertFeedbackData(Button btn, string Feedback) { Button btnTemp = btn; string RadioButtonID = ""; for (int i = 1; i <= 7; i++) { for (int j = 1; j <= 5; j++) { RadioButtonID = "RadioButton" + (i).ToString() + (j).ToString(); RadioButton rb = (RadioButton)btnTemp.Parent.FindControl(RadioButtonID); if (rb.Checked) { string grp = rb.GroupName; switch (grp) { case "rdoPersonalityGroup": objHRInterviewAssessmentBOL.Personality = j; break; case "rdoClarityGroup": objHRInterviewAssessmentBOL.Clarity = j; break; case "rdoLeadershipGroup": objHRInterviewAssessmentBOL.Leadership = j; break; case "rdoInterPersonalGroup": objHRInterviewAssessmentBOL.Interpersonal = j; break; case "rdoCommunicationGroup": objHRInterviewAssessmentBOL.Communication = j; break; case "rdoInitiativeGroup": objHRInterviewAssessmentBOL.Initiative = j; break; case "rdoCareerGroup": objHRInterviewAssessmentBOL.Career = j; break; } } } } objHRInterviewAssessmentBOL.StageID = stageID; //HR round objHRInterviewAssessmentBOL.ScheduleID = ScheduleID; objHRInterviewAssessmentBOL.CandidateID = CandidateID; objHRInterviewAssessmentBOL.RRFID = RRFID; objHRInterviewAssessmentBOL.SrNo = SrNo; objHRInterviewAssessmentBOL.FeedbackBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); objHRInterviewAssessmentBOL.Mode = "Write"; dsCandidateDetails = objHRInterviewAssessmentBLL.GetCandidateDetails(objHRInterviewAssessmentBOL); if (dsCandidateDetails != null && dsCandidateDetails.Tables[0].Rows.Count > 0) { objHRInterviewAssessmentBOL.Department = Convert.ToInt32(dsCandidateDetails.Tables[0].Rows[0]["DepartmentID"]); objHRInterviewAssessmentBOL.Position = Convert.ToInt32(dsCandidateDetails.Tables[0].Rows[0]["DesignationID"]); } objHRInterviewAssessmentBOL.Feedback = Feedback; objHRInterviewAssessmentBOL.HRMComments = txtComments.Text; objHRInterviewAssessmentBLL.HRInterviewAssessment(objHRInterviewAssessmentBOL); btnApprove.Visible = false; btnReject.Visible = false; //btnPrint.Visible = true; //Mailing Activity objRRFApproverBOL.Role = "HRM"; dsGetEmployeeFromRole = objRRFApproverBLL.GetEmployeeFromRole(objRRFApproverBOL); string toID = dsGetEmployeeFromRole.Tables[0].Rows[0]["UserId"].ToString(); for (int i = 1; i < dsGetEmployeeFromRole.Tables[0].Rows.Count; i++) { toID = toID + ';' + dsGetEmployeeFromRole.Tables[0].Rows[i]["UserId"].ToString(); } if (dsCandidateDetails.Tables[0].Rows.Count > 0 && dsCandidateDetails != null) { objEmailActivityBOL.ToID = dsCandidateDetails.Tables[0].Rows[0]["RecruiterID"].ToString() + ";"; //recruiter } objEmailActivityBOL.CCID = toID + ";" + Convert.ToString(HttpContext.Current.User.Identity.Name) + ";"; //HRM,Interviewer objEmailActivityBOL.FromID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); //Interviewer objEmailActivityBOL.EmailTemplateName = "Interview Feedback"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); DataSet dsmaildetails = new DataSet(); dsmaildetails = objHRInterviewAssessmentBLL.GetDetailsformail(objHRInterviewAssessmentBOL); string body, RRFNomail; RRFNomail = Convert.ToString(objHRInterviewAssessmentBOL.RRFID); body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); body = body.Replace("##comment##", txtComments.Text); body = body.Replace("##Candidate Name##", lblCandidateName.Text); body = body.Replace("##InterviewDate##", (dsmaildetails.Tables[0].Rows[0]["ScheduledDatetime"].ToString())); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Body = body; // (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString()); try { objEmailActivity.SendMail(objEmailActivityBOL); lblSuccess.Text = "Interview Feedback submitted successfully."; lblSuccess.Visible = true; } catch (System.Exception ex) { lblSuccess.Text = "Interview Feedback submitted successfully,but e-mails could not be sent."; lblSuccess.Visible = true; } }
protected void grdCandidateSchedule_RowCommand(object sender, GridViewCommandEventArgs e) { //ScriptManager.RegisterStartupScript(this, typeof(string), "CandidateReSchedule", "javascript:CandidatescheduleLoader();", true); // ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOWNew", "javascript:CandidatescheduleLoader();", true); candidateId = Convert.ToInt32(Session["CandidateID"].ToString()); RRFID = Convert.ToInt32(Session["RRFID"].ToString()); DropDownList ddlStage = grdCandidateSchedule.FooterRow.FindControl("ddlStage") as DropDownList; LinkButton lnkbtnInsert = grdCandidateSchedule.FooterRow.FindControl("lnkbtnInsert") as LinkButton; string stageName = ddlStage.SelectedItem.Value; Session["stageName"] = stageName; TextBox txtInterviewerName = grdCandidateSchedule.FooterRow.FindControl("txtInterviewerName") as TextBox; Label lblInterviewerName = grdCandidateSchedule.FooterRow.FindControl("lblInterviewerName") as Label; if (txtInterviewerName.Text == "") { objCandidateInterviewScheduleBOL.InterviewerName = 0; } else { int isInterviewerNameEmpty = 1; if (dsCandidate != null) { if (dsCandidate.Tables.Count > 0 && dsCandidate.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsCandidate.Tables[0].Rows.Count; i++) { if (txtInterviewerName.Text == dsCandidate.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeId = Convert.ToInt32(dsCandidate.Tables[0].Rows[i]["UserID"]); Session["InterviewerName"] = employeeId; Session["InterviewerID"] = employeeId; isInterviewerNameEmpty = 1; break; } else { isInterviewerNameEmpty = 0; } } } else { lblInterviewerName.Visible = true; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOWNew", "javascript:HideImageloader();", true); return; } } if (isInterviewerNameEmpty == 1) { objCandidateInterviewScheduleBOL.InterviewerName = employeeId; } else { lblInterviewerName.Visible = true; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOWNew", "javascript:HideImageloader();", true); lblInterviewerName.Visible = true; loadImage.Visible = false; return; } } if (ddlStage.SelectedItem.Text != "Final Stage") { if (e.CommandName == "Insert") { int RowNumberForReschedule = 0; objCandidateInterviewScheduleBOL.CandidateID = Convert.ToInt32(Session["CandidateID"]); objCandidateInterviewScheduleBOL.RRFNo = Convert.ToInt32(Session["RRFID"]); objCandidateInterviewScheduleBOL.Stage = Convert.ToString(ddlStage.SelectedItem.Text); Session["StageName"] = Convert.ToString(ddlStage.SelectedItem.Value); DropDownList ddlTimeHours = grdCandidateSchedule.FooterRow.FindControl("ddlTimeHours") as DropDownList; DropDownList ddlTimeMinutes = grdCandidateSchedule.FooterRow.FindControl("ddlTimeMinutes") as DropDownList; TextBox txtDate = grdCandidateSchedule.FooterRow.FindControl("txtDate") as TextBox; string expireOnDate = txtDate.Text; int pos1 = expireOnDate.IndexOf("/"); int pos2 = expireOnDate.IndexOf("/", pos1 + 1); int strDay; int strMonth; if (Convert.ToInt32(expireOnDate.Substring(0, (pos1 - 1))) == 0) { strMonth = Convert.ToInt32(expireOnDate.Substring(1, (pos1 - 1))); } else { strMonth = Convert.ToInt32(expireOnDate.Substring(0, (pos1))); } if (Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 1)) == 0) { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 2), 1)); } else { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 2)); } int strYear = Convert.ToInt32(expireOnDate.Substring((pos2 + 1))); DateTime expectedClosureDate = new DateTime(strYear, strMonth, strDay); objCandidateInterviewScheduleBOL.ScheduledDateTime = expectedClosureDate.AddHours(Convert.ToDouble(ddlTimeHours.SelectedValue.ToString())).AddMinutes(Convert.ToDouble(ddlTimeMinutes.SelectedItem.Value.ToString())); objCandidateInterviewScheduleBOL.ScheduledBy = Convert.ToInt32(recruiterid); interviewerid = employeeId.ToString(); objCandidateInterviewScheduleBOL.RescheduleReason = ""; objCandidateInterviewScheduleBLL.SetCandidateSchecule(objCandidateInterviewScheduleBOL, RowNumberForReschedule); grdCandidateSchedule.EditIndex = -1; BindData(candidateId, RRFID); GetStageDetails(); lnkbtnInsert.Enabled = false; ////Mailing Activity objRRFApproverBOL.Role = "HRM"; dsGetEmployeeFromRole = objRRFApproverBLL.GetEmployeeFromRole(objRRFApproverBOL); string toID = dsGetEmployeeFromRole.Tables[0].Rows[0]["UserId"].ToString(); for (int i = 1; i < dsGetEmployeeFromRole.Tables[0].Rows.Count; i++) { toID = toID + ';' + dsGetEmployeeFromRole.Tables[0].Rows[i]["UserId"].ToString(); } objEmailActivityBOL.ToID = Convert.ToString(interviewerid) + ";"; //interviewer objEmailActivityBOL.CCID = Convert.ToString(recruiterid) + ";" + Convert.ToString(toID) + ";"; //recruiter,HRM objEmailActivityBOL.FromID = Convert.ToInt32(recruiterid); //recruiter objEmailActivityBOL.EmailTemplateName = "Schedule Interview"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string interviewTime, interviewDate, body, bodyForCandidate; interviewDate = String.Format("{0:dddd, MMMM d, yyyy}", expectedClosureDate); interviewTime = String.Format("{0:t}", objCandidateInterviewScheduleBOL.ScheduledDateTime); DataSet dsmaildetails = new DataSet(); dsmaildetails = objCandidateInterviewScheduleBLL.GetDetailsformail(objCandidateInterviewScheduleBOL); body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); body = body.Replace("##InterviewTime##", interviewTime); body = body.Replace("##InterviewDate##", interviewDate); // body = body.Replace("##comment##", txtReason.Text); bodyForCandidate = body; //String.Format("{0:dddd, MMMM d, yyyy}", dt); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##CandidateName##", lblCandidateName.Text); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("\r\n", " "); objEmailActivityBOL.Body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString()); objEmailActivityBOL.CandidateName = Convert.ToString(Session["CandidateName"].ToString()); try { body = body.Replace("##Candidate Name##", lblCandidateName.Text); objEmailActivityBOL.Body = body; objEmailActivity.SendMail(objEmailActivityBOL); //for (int i = 0; i < objEmailActivityBOL.ToAddress.Length; i++) // objEmailActivityBOL.ToAddress[i] = string.Empty; //objEmailActivityBOL.ToAddress[0] = Convert.ToString(Session["EmailId"].ToString()); //objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); ////objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); //bodyForCandidate = bodyForCandidate.Replace(" for <b>##CandidateName##</b>", string.Empty); //objEmailActivityBOL.Body = bodyForCandidate; //objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); //objEmailActivity.SendMail(objEmailActivityBOL); ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOWNew", "javascript:CandidatescheduleLoader();", true); } catch (System.Exception ex) { lblMessage.Text = "Interview Scheduled,but e-mails could not be sent."; lblMessage.Visible = true; mailFlag = 1; } finally { if (mailFlag == 1) { lblErrorMsg.Text = "Interview Scheduled,but e-mails could not be sent."; lblErrorMsg.Visible = true; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOWNew", "javascript:CandidatescheduleLoader();", true); Session["CandidateID"] = Convert.ToString(candidateId); Session["RRFID"] = Convert.ToString(RRFID); Session["Message"] = "Email could not be send to the candidate"; //Response.Redirect("~/CandidateInterviewSchedule.aspx?CandidateID=" + candidateId + "&RRFID=" + RRFID + "&Message=Email could not be send to the candidate"); Response.Redirect("~/Recruitment/CandidateInterviewSchedule.aspx"); } } } else if (e.CommandName == "Reschedule") { DataSet DS = new DataSet(); int index = Convert.ToInt32(e.CommandArgument); GridViewRow grdrow = grdCandidateSchedule.Rows[index]; GridViewRow grdView = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); TextBox txtStage = (TextBox)grdrow.FindControl("txtEditStageName"); //TextBox txtInterviewerName = (TextBox)grdrow.FindControl("txtEditInterviewer"); TextBox txtDate = (TextBox)grdrow.FindControl("txtEditScheduledDate"); TextBox txtTime = (TextBox)grdrow.FindControl("txtEditddlTimeHours"); Label lblStageName = (Label)grdrow.FindControl("lblStageName"); Label lblScheduleDate = (Label)grdrow.FindControl("lblScheduleDate"); Label lblTime = (Label)grdrow.FindControl("lblTime"); Label lblInterviewer = (Label)grdrow.FindControl("lblInterviewer"); Label lblCandidateID = (Label)grdrow.FindControl("lblCandidateID"); Label lblroundNumber = (Label)grdrow.FindControl("lblroundNumber"); DS = objCandidateInterviewScheduleBLL.GetCandidateReScheduleRoundNumber(Convert.ToInt32(Session["CandidateID"]), Convert.ToInt32(Session["RRFID"]), Convert.ToInt32(lblroundNumber.Text)); if (DS != null) { if (DS.Tables.Count > 0) { int MaxRescheduleCount = Convert.ToInt32(DS.Tables[0].Rows[0]["MaxRescheduleCount"]); if (MaxRescheduleCount > 5) { // this.ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript: show_confirm(); ", true); ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "javascript:show_confirm();", true); } else { Session["RRFNo"] = Convert.ToString(lblRRFNo.Text); Session["Position"] = lblPosition.Text; Session["CandidateName"] = lblCandidateName.Text; Session["PostedDate"] = lblPostedDate.Text; Session["Requestor"] = lblRequestor.Text; Session["StageName"] = lblStageName.Text; Session["ScheduledDate"] = lblScheduleDate.Text; Session["ScheduledTime"] = lblTime.Text; Session["InterviewerName"] = lblInterviewer.Text; Session["RoundNumber"] = grdrow.RowIndex + 1; Session["RecruiterId"] = recruiterid; Session["InterviewerID"] = interviewerid; Session["InterviewerEmployeeId"] = employeeId; Response.Redirect("~/Recruitment/RescheduleForm.aspx"); } } } } else if (e.CommandName == "ViewFeedBack") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow grdrow = grdCandidateSchedule.Rows[index]; GridViewRow grdView = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); Label lblCandidateID = (Label)grdrow.FindControl("lblCandidateID"); Label lblDesignationName = (Label)grdrow.FindControl("lblDesignationName"); Label lblScheduleID = (Label)grdrow.FindControl("lblScheduleID"); Label lblStageID = (Label)grdrow.FindControl("lblStageID"); Label lblStageNameGrid = (Label)grdrow.FindControl("lblStageName"); Label lblRRFID = (Label)grdrow.FindControl("lblRRFID"); Label RRFNumber = (Label)grdrow.FindControl("lblRRFNumber"); Session["ScheduleID"] = lblScheduleID.Text; Session["StageName"] = lblStageNameGrid.Text; Session["DesignationName"] = lblDesignationName.Text; Session["CandidateID"] = lblCandidateID.Text; Session["RRFNumber"] = RRFNumber.Text; Session["RRFID"] = lblRRFID.Text; Session["StageID"] = lblStageID.Text; if (lblStageID.Text == "17") { // string flag = "1"; Session["flag"] = "1"; Session["Mode"] = ""; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( 'SelectedCandidate.aspx?ScheduleID=" + lblScheduleID.Text + "&StageName=" + lblStageNameGrid.Text + "&DesignationName=" + lblDesignationName.Text + "&CandidateID=" + lblCandidateID.Text + "&RRFNumber=" + RRFNumber.Text + "&RRFID=" + lblRRFID.Text + "&StageID=" + lblStageID.Text + "&Mode=&Flag=1&height=700, width=700,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ' );", true); // ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('JoinEmployeePopup.aspx',null,'height=250, width=600,status= no, resizable= no, scrollbars=yes, toolbar=no,location=no,menubar=no');", true); ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( 'SelectedCandidate.aspx',null,'height=900, width=1800,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ' );", true); } // HR stage or Group head stage else if (lblStageID.Text == "6" || lblStageID.Text == "18") { Session["flag"] = "0"; Session["Mode"] = "Read"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( 'HRInterviewAssessment.aspx?ScheduleID=" + lblScheduleID.Text + "&StageName=" + lblStageNameGrid.Text + "&DesignationName=" + lblDesignationName.Text + "&CandidateID=" + lblCandidateID.Text + "&RRFNumber=" + RRFNumber.Text + "&RRFID=" + lblRRFID.Text + "&StageID=" + lblStageID.Text + "&flag=0&Mode=Read&height=550, width=1200,status= no, resizable= no, scrollbars=yes, toolbar=no,location=no,menubar=no', null, 'status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no' );", true); ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( 'HRInterviewAssessment.aspx', null, 'height=1000, width=1200,status=yes,toolbar=no,titlebar=yes,scrollbars=yes,menubar=no,location=no' );", true); } //else if(lblStageID.Text=="6" && lblStageID.Text=="17" && lblStageID.Text=="18") else { Session["flag"] = "0"; Session["Mode"] = "Read"; // ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( 'InterviewFeedback.aspx?ScheduleID=" + lblScheduleID.Text + "&StageName=" + lblStageNameGrid.Text + "&DesignationName=" + lblDesignationName.Text + "&CandidateID=" + lblCandidateID.Text + "&RRFNumber=" + RRFNumber.Text + "&RRFID=" + lblRRFID.Text + "&StageID=" + lblStageID.Text + "&flag=0&Mode=Read&height=700, width=1000,status= no, resizable= no, scrollbars=yes, toolbar=no,location=no,menubar=no', null, 'status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no' );", true); ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( 'InterviewFeedback.aspx', null, 'height=1000, width=1200,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no' );", true); } } } else { //Response.Redirect("SelectedCandidate.aspx?StageName=" + stageName+"&Mode=Read"); int RowNumberForReschedule = 0; //objCandidateInterviewScheduleBOL.CandidateName = lblCandidateName.Text; objCandidateInterviewScheduleBOL.CandidateID = Convert.ToInt32(Session["CandidateID"]); objCandidateInterviewScheduleBOL.RRFNo = Convert.ToInt32(Session["RRFID"]); objCandidateInterviewScheduleBOL.Stage = Convert.ToString(ddlStage.SelectedItem.Text); Session["StageName"] = Convert.ToString(ddlStage.SelectedItem.Value); DropDownList ddlTimeHours = grdCandidateSchedule.FooterRow.FindControl("ddlTimeHours") as DropDownList; DropDownList ddlTimeMinutes = grdCandidateSchedule.FooterRow.FindControl("ddlTimeMinutes") as DropDownList; objCandidateInterviewScheduleBOL.ScheduledDateTime = DateTime.Now; //objCandidateInterviewScheduleBOL.ScheduledBy = Convert.ToInt32(Session["userID"]); interviewerid = employeeId.ToString(); objCandidateInterviewScheduleBOL.ScheduledBy = Convert.ToInt32(interviewerid); objCandidateInterviewScheduleBOL.RescheduleReason = ""; objCandidateInterviewScheduleBLL.SetCandidateSchecule(objCandidateInterviewScheduleBOL, RowNumberForReschedule); grdCandidateSchedule.EditIndex = -1; BindData(candidateId, RRFID); GetStageDetails(); //Mailing Activity objRRFApproverBOL.Role = "HRM"; dsGetEmployeeFromRole = objRRFApproverBLL.GetEmployeeFromRole(objRRFApproverBOL); string toID = dsGetEmployeeFromRole.Tables[0].Rows[0]["UserId"].ToString(); for (int i = 1; i < dsGetEmployeeFromRole.Tables[0].Rows.Count; i++) { toID = toID + ';' + dsGetEmployeeFromRole.Tables[0].Rows[i]["UserId"].ToString(); } objEmailActivityBOL.ToID = Convert.ToString(interviewerid) + ";"; //interviewer objEmailActivityBOL.CCID = Convert.ToString(recruiterid) + ";" + Convert.ToString(toID) + ";"; //recruiter,HRM objEmailActivityBOL.FromID = Convert.ToInt32(recruiterid); //recruiter objEmailActivityBOL.EmailTemplateName = "Final Stage Schedule"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string body, bodyForCandidate; body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); bodyForCandidate = body; char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = ""; objEmailActivityBOL.skills = ""; objEmailActivityBOL.Position = ""; objEmailActivityBOL.CandidateName = Convert.ToString(Session["CandidateName"].ToString()); try { body = body.Replace("##CandidateName##", lblCandidateName.Text); body = body.Replace("##EmployeeName##", txtInterviewerName.Text); objEmailActivityBOL.Body = body; objEmailActivity.SendMail(objEmailActivityBOL); //for (int i = 0; i < objEmailActivityBOL.ToAddress.Length; i++) // objEmailActivityBOL.ToAddress[i] = string.Empty; //objEmailActivityBOL.ToAddress[0] = Convert.ToString(Session["EmailId"].ToString()); //objEmailActivityBOL.CandidateName = Convert.ToString(Session["CandidateName"].ToString()); //objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); //objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); //bodyForCandidate = bodyForCandidate.Replace(" for <b>##CandidateName##</b>", string.Empty); //objEmailActivityBOL.Body = bodyForCandidate; //objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); //objEmailActivity.SendMail(objEmailActivityBOL); ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOWNew", "javascript:CandidatescheduleLoader();", true); } //catch (System.Exception ex) //{ // lblMessage.Text = "Interview Scheduled,but e-mails could not be sent."; // lblMessage.Visible = true; //} //finally //{ // lblMessage.Text = "Interview Scheduled,but e-mails could not be sent."; // lblMessage.Visible = true; // ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOWNew", "javascript:CandidatescheduleLoader();", true); // Response.Redirect("~/CandidateInterviewSchedule.aspx?CandidateID=" + candidateId + "&RRFID=" + RRFID + "&Message=Email could not be send to the candidate"); //} catch (System.Exception ex) { lblMessage.Text = "Interview Scheduled,but e-mails could not be sent."; lblMessage.Visible = true; mailFlag = 1; } finally { if (mailFlag == 1) { lblErrorMsg.Text = "Interview Scheduled,but e-mails could not be sent."; lblErrorMsg.Visible = true; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOWNew", "javascript:CandidatescheduleLoader();", true); Session["CandidateID"] = Convert.ToString(candidateId); Session["RRFID"] = Convert.ToString(RRFID); Session["Message"] = "Email could not be send to the candidate"; Response.Redirect("~/Recruitment/CandidateInterviewSchedule.aspx"); } } } }
protected void btnNextStage_Click(object sender, EventArgs e) { btnNextStage.Enabled = false; btnReject.Enabled = false; int LatestInterviewID; CommonMethodForAddAndRejectCandidate(); dsInterviewFeedback = InterviewFeedbackBLL.AddInterviewFeedbackDetails(InterviewFeedbackBOL); LatestInterviewID = Convert.ToInt32(dsInterviewFeedback.Tables[0].Rows[0]["InterviewID"].ToString()); AddCoreSkillsRating(LatestInterviewID); objHRInterviewAssessmentBOL.RRFID = Convert.ToInt32(RRFID); objHRInterviewAssessmentBOL.CandidateID = Convert.ToInt32(candidateID); objHRInterviewAssessmentBOL.StageID = Convert.ToInt32(StageID); objHRInterviewAssessmentBOL.RoundNo = RoundNumber; objHRInterviewAssessmentBOL.SrNo = SrNo; objHRInterviewAssessmentBLL.UpdateCandidateScheduleDate(objHRInterviewAssessmentBOL); //btnNextStage.Enabled = false; //btnReject.Enabled = false; //Mailing Activity objRRFApproverBOL.Role = "HRM"; dsGetEmployeeFromRole = objRRFApproverBLL.GetEmployeeFromRole(objRRFApproverBOL); string toID = dsGetEmployeeFromRole.Tables[0].Rows[0]["UserId"].ToString(); for (int i = 1; i < dsGetEmployeeFromRole.Tables[0].Rows.Count; i++) { toID = toID + ';' + dsGetEmployeeFromRole.Tables[0].Rows[i]["UserId"].ToString(); } objEmailActivityBOL.ToID = dsMail.Tables[0].Rows[0]["Recruiter"].ToString() + ";"; //recruiter objEmailActivityBOL.CCID = toID + ";" + Convert.ToString(HttpContext.Current.User.Identity.Name) + ";"; //HRM,Interviewer objEmailActivityBOL.FromID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); //Interviewer objEmailActivityBOL.EmailTemplateName = "Interview Feedback"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); DataSet dsmaildetails = new DataSet(); dsmaildetails = InterviewFeedbackBLL.GetDetailsformail(InterviewFeedbackBOL); string body; body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); body = body.Replace("##comment##", txtOverallComments.Text); body = body.Replace("##Candidate Name##", lblCandidateName.Text); body = body.Replace("##InterviewDate##", (dsmaildetails.Tables[0].Rows[0]["ScheduledDatetime"].ToString())); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); objEmailActivityBOL.Body = body; //(dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString()); try { objEmailActivity.SendMail(objEmailActivityBOL); lblSuccess.Text = "Candidate approved and Interview Feedback submitted successfully."; lblSuccess.Visible = true; } catch (System.Exception ex) { lblSuccess.Text = "Candidate approved and Interview Feedback submitted successfully,but e-mails could not be sent."; lblSuccess.Visible = true; } //this.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script language=javascript>if (window.opener && !window.opener.closed) { parent.location.reload(true); } </script>"); //this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true); this.ClientScript.RegisterStartupScript(GetType(), "CLOSE", "<script language='javascript'> opener.location.href = 'Interviewer.aspx'; window.close(); </script>"); }
protected void btnReschedule_Click(object sender, EventArgs e) { //if (Convert.ToInt32(Session["redirectClickFlag"]) > 1) //{ // Response.Redirect("~/CandidateInterviewSchedule.aspx"); //} //else //{ Session["redirectClickFlag"] = Convert.ToInt32(Session["redirectClickFlag"]) + 1; System.Data.DataSet ds = new DataSet(); objRescheduledBOL.CandidateID = Convert.ToInt32(Session["CandidateID"]); objRescheduledBOL.RRFNo = Convert.ToInt32(Session["RRFID"]); objRescheduledBOL.Stage = Convert.ToString(lblStage.Text); string expireOnDate = txtNewDate.Text; int pos1 = expireOnDate.IndexOf("/"); int pos2 = expireOnDate.IndexOf("/", pos1 + 1); int strDay; int strMonth; if (Convert.ToInt32(expireOnDate.Substring(0, (pos1 - 1))) == 0) { strMonth = Convert.ToInt32(expireOnDate.Substring(1, (pos1 - 1))); } else { strMonth = Convert.ToInt32(expireOnDate.Substring(0, (pos1))); } if (Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 1)) == 0) { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 2), 1)); } else { strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 2)); } int strYear = Convert.ToInt32(expireOnDate.Substring((pos2 + 1))); DateTime expectedClosureDate = new DateTime(strYear, strMonth, strDay); objRescheduledBOL.ScheduledDateTime = expectedClosureDate.AddHours(Convert.ToDouble(ddlNewTimeHours.SelectedValue.ToString())).AddMinutes(Convert.ToDouble(ddlNewTimeMinutes.SelectedItem.Value.ToString())); objRescheduledBOL.Position = Convert.ToString(lblPosition.Text); objRescheduledBOL.Requestor = Convert.ToString(Session["Requestor"]); int isInterviewerNameEmpty = 1; if (txtNewInterviewer.Text != "") { if (dsInterViewer != null) { if (dsInterViewer.Tables[0].Rows.Count > 0 && dsInterViewer.Tables.Count > 0) { for (int i = 0; i < dsInterViewer.Tables[0].Rows.Count; i++) { if (txtNewInterviewer.Text == dsInterViewer.Tables[0].Rows[i]["EmployeeName"].ToString()) { employeeId = Convert.ToInt32(dsInterViewer.Tables[0].Rows[i]["UserID"]); isInterviewerNameEmpty = 1; break; } else { isInterviewerNameEmpty = 0; } } if (isInterviewerNameEmpty == 1) { objRescheduledBOL.InterviewerName = employeeId; } else { lblInterviewer.Visible = true; return; } } else { lblInterviewer.Visible = true; return; } } } else { objRescheduledBOL.InterviewerName = InterviewerId; } //objRescheduledBOL.Schdu // objRescheduledBOL.ScheduledBy = Convert.ToInt32(Session["UserId"]); objRescheduledBOL.ScheduledBy = Convert.ToInt32(Session["RecruiterId"]); objRescheduledBOL.RescheduledBy = Convert.ToString(ddlRescheduledby.SelectedItem.Text); objRescheduledBOL.RescheduledReason = Convert.ToString(txtReason.Text); objRescheduledBLL.SetCandidateSchecule(objRescheduledBOL, RoundNumber); //Mailing Activity objRRFApproverBOL.Role = "HRM"; dsGetEmployeeFromRole = objRRFApproverBLL.GetEmployeeFromRole(objRRFApproverBOL); string toID = dsGetEmployeeFromRole.Tables[0].Rows[0]["UserId"].ToString(); for (int i = 1; i < dsGetEmployeeFromRole.Tables[0].Rows.Count; i++) { toID = toID + ';' + dsGetEmployeeFromRole.Tables[0].Rows[i]["UserId"].ToString(); } if (employeeId == Convert.ToInt32(InterviewerId)) { objEmailActivityBOL.ToID = Convert.ToString(employeeId) + ";";//new interviewer } else { objEmailActivityBOL.ToID = Convert.ToString(InterviewerId) + ";";//old interviewer } //objEmailActivityBOL.CCID = Convert.ToString(Session["RecruiterId"]) + ";" + Convert.ToString(toID) + ";" + Convert.ToString(InterviewerId) + ";";//recruiter,HRM,old interviewer objEmailActivityBOL.CCID = Convert.ToString(toID); objEmailActivityBOL.FromID = Convert.ToInt32(Session["RecruiterId"]);//recruiter objEmailActivityBOL.EmailTemplateName = "Reschedule Interview"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string interviewTime, interviewDate, body, bodyForCandidate; interviewDate = String.Format("{0:dddd, MMMM d, yyyy}", expectedClosureDate); interviewTime = String.Format("{0:t}", objRescheduledBOL.ScheduledDateTime); //string scheduleDate = lblScheduledDate.Text; //int pos1 = expireOnDate.IndexOf("/"); //int pos2 = expireOnDate.IndexOf("/", pos1 + 1); //int strDay; //int strMonth; //if (Convert.ToInt32(expireOnDate.Substring(0, (pos1 - 1))) == 0) // strMonth = Convert.ToInt32(expireOnDate.Substring(1, (pos1 - 1))); //else // strMonth = Convert.ToInt32(expireOnDate.Substring(0, (pos1))); //if (Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 1)) == 0) // strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 2), 1)); //else // strDay = Convert.ToInt32(expireOnDate.Substring((pos1 + 1), 2)); //int strYear = Convert.ToInt32(expireOnDate.Substring((pos2 + 1))); //DateTime expectedClosureDate = new DateTime(strYear, strMonth, strDay); DataSet dsmaildetails = new DataSet(); dsmaildetails = objRescheduledBLL.GetDetailsformail(objRescheduledBOL); body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); body = body.Replace("##InterviewTime##", interviewTime); body = body.Replace("##InterviewDate##", interviewDate); body = body.Replace("##OriginalDate##", String.Format("{0:dddd, MMMM d, yyyy}", Convert.ToDateTime(lblScheduledDate.Text))); body = body.Replace("##OriginalTime##", String.Format("{0:t}", Convert.ToDateTime(lblScheduledTime.Text))); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); body = body.Replace("##comment##", txtReason.Text); bodyForCandidate = body; //String.Format("{0:dddd, MMMM d, yyyy}", dt); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); //body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##date##", String.Format("{0:f}", objRescheduledBOL.ScheduledDateTime)); objEmailActivityBOL.Body = body; objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); try { body = body.Replace("##CandidateName##", lblCandidateName.Text); objEmailActivityBOL.Body = body; //objEmailActivity.SendMail(objEmailActivityBOL); for (int i = 0; i < objEmailActivityBOL.ToAddress.Length; i++) { objEmailActivityBOL.ToAddress[i] = string.Empty; } objEmailActivityBOL.ToAddress[0] = Convert.ToString(Session["EmailId"].ToString()); objEmailActivityBOL.CandidateName = Convert.ToString(Session["CandidateName"].ToString()); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##CandidateName##", lblCandidateName.Text); bodyForCandidate = bodyForCandidate.Replace("##CandidateName##", lblCandidateName.Text); objEmailActivityBOL.Body = bodyForCandidate; objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator); objEmailActivity.SendMail(objEmailActivityBOL); ScriptManager.RegisterStartupScript(this, typeof(string), "CandidateReSchedule", "javascript:CandidateRescheduleLoader();", true); } catch (System.Exception ex) { if (ex.Message.Contains("Mailbox unavailable. The server response was: 5.1.1 User unknown")) { //This Is used to ignore error related to invalid Email Address.But Emails Will be send to other valid users. } else { mailFlag = 1; lblMessage.Text = "Interview Rescheduled,but e-mails could not be sent."; lblMessage.Visible = true; } } finally { if (mailFlag == 1) { Session["Message"] = "Email could not be send to the candidate"; Response.Redirect("~/Recruitment/CandidateInterviewSchedule.aspx"); //Response.Redirect("~/CandidateInterviewSchedule.aspx?Message=Email could not be send to the candidate"); } else { Response.Redirect("~/Recruitment/CandidateInterviewSchedule.aspx"); } } }
protected void btnAcceptRRF_Click(object sender, EventArgs e) { foreach (GridViewRow gvRow in grdRecruiter.Rows) { CheckBox chkSelect = (CheckBox)gvRow.FindControl("chkSelect"); if (chkSelect.Checked == true) { Label lblRRFID = (Label)gvRow.FindControl("lblRRFID"); string RRFID = Convert.ToString(lblRRFID.Text).Trim(); Session["RRFID"] = RRFID; HiddenField hiddenStatus = (HiddenField)gvRow.FindControl("hdnRRFStatus"); string Status = Convert.ToString(hiddenStatus.Value); objRecruiterBOL.RRFID = RRFID; objRecruiterBOL.ModifiedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name.ToString()); objRecruiterBOL.ModifiedDate = DateTime.Now; objRecruiterBOL.RRFAcceptedDate = DateTime.Now; if (Status == "Yet To Begin") { objRecruiterBLL.ChangeStatus(objRecruiterBOL); BindData(); objRRFApproverBOL.Role = "HRM"; dsGetEmployeeFromRole = objRRFApproverBLL.GetEmployeeFromRole(objRRFApproverBOL); string toID = dsGetEmployeeFromRole.Tables[0].Rows[0]["UserId"].ToString(); for (int i = 1; i < dsGetEmployeeFromRole.Tables[0].Rows.Count; i++) { toID = toID + ';' + dsGetEmployeeFromRole.Tables[0].Rows[i]["UserId"].ToString(); } objEmailActivityBOL.ToID = Convert.ToString(toID); objEmailActivityBOL.FromID = objRecruiterBOL.ModifiedBy; //recruiter objEmailActivityBOL.CCID = objRecruiterBOL.ModifiedBy.ToString(); //recruiter objEmailActivityBOL.EmailTemplateName = "Accept RRF"; dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL); string body, bodyForCandidate; objRescheduledBOL.RRFNo = Convert.ToInt32(RRFID); DataSet dsmaildetails = new DataSet(); dsmaildetails = objRescheduledBLL.GetDetailsformail(objRescheduledBOL); body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); //body = body.Replace("##skills##", (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString())); //body = body.Replace("##comment##", txtReason.Text); bodyForCandidate = body; //String.Format("{0:dddd, MMMM d, yyyy}", dt); char[] separator = new char[] { ';' }; objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator); objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString()); //body = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString()); //body = body.Replace("##date##", String.Format("{0:f}", objRescheduledBOL.ScheduledDateTime)); objEmailActivityBOL.Body = body; try { objEmailActivityBOL.RRFNo = (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString()); objEmailActivityBOL.skills = (dsmaildetails.Tables[0].Rows[0]["keyskills"].ToString()); objEmailActivityBOL.Position = (dsmaildetails.Tables[0].Rows[0]["DesignationName"].ToString()); objEmailActivityBOL.Subject = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString()); objEmailActivityBOL.Subject = objEmailActivityBOL.Subject.Replace("##RRFNO##", (dsmaildetails.Tables[0].Rows[0]["RRFNo"].ToString())); objEmailActivityBOL.Body = bodyForCandidate; objEmailActivity.SendMail(objEmailActivityBOL); ScriptManager.RegisterStartupScript(this, typeof(string), "CandidateReSchedule", "javascript:CandidateRescheduleLoader();", true); } catch (System.Exception ex) { if (ex.Message.Contains("Mailbox unavailable. The server response was: 5.1.1 User unknown")) { //This Is used to ignore error related to invalid Email Address.But Emails Will be send to other valid users. } else { mailFlag = 1; lblMessage.Text = "Interview Rescheduled,but e-mails could not be sent."; lblMessage.Visible = true; } } finally { if (mailFlag == 1) { Session["Message"] = "Email could not be send to the candidate"; Response.Redirect("SLAForRRF.aspx"); //Response.Redirect("~/CandidateInterviewSchedule.aspx?Message=Email could not be send to the candidate"); } else { Response.Redirect("SLAForRRF.aspx"); } } } } } }