/// <summary> /// Raise the Head count for MRF /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, EventArgs e) { try { string mrfIdGroup = string.Empty; //Get the Recruitment Manager Id string recruitmentManagerId = ddlRecruitmentManager.SelectedValue; //Aarohi : Issue 30885 : 14/12/2011 : Start if ((Session[SessionNames.PURPOSE] != null) && (ddlPurpose.SelectedValue == Convert.ToString((int)Common.MasterEnum.MRFPurpose.Replacement)) || (ddlPurpose.SelectedValue == Convert.ToString((int)Common.MasterEnum.MRFPurpose.SubstituteForMaternityLeave))) { //Issue Id : 34331 START : Mahendra //commented following and added new code to map Arraylist elements //txtPurpose.Text = Session[SessionNames.PURPOSE].ToString(); System.Collections.ArrayList name = (System.Collections.ArrayList)Session[SessionNames.PURPOSE]; foreach (var item in name) { txtPurpose.Text = item.ToString(); } //Issue Id : 34331 END } //Aarohi : Issue 30885 : 14/12/2011 : End //On Click, Change the status of respetive MRF if (recruitmentManagerId != CommonConstants.SELECT) { BusinessEntities.MRFDetail mrfDetail = new BusinessEntities.MRFDetail(); Rave.HR.BusinessLayer.MRF.MRFDetail objMrf = new Rave.HR.BusinessLayer.MRF.MRFDetail(); //Check if wheather any need of approval of head count.means approver id for this deprtment is 0. string mailTo = GetEmailIdForDeptWiseHeadCountApprovalMailTo(hidDepartment.Value); //if no approver id found then directly goes for pending external allocation. //For Rave consultant department no approval is required.mail is directly sent to Recruiment. if (string.IsNullOrEmpty(mailTo)) { mrfDetail.Status = CommonConstants.MRFStatus_PendingExternalAllocation; } else { //Sent For Finance to approve the head count. mrfDetail.Status = CommonConstants.MRFStatus_PendingHeadCountApprovalOfFinance; //Goes for head count approval & make status Peding Approval Of HeadCount. // mrfDetail.Status = CommonConstants.MRFStatus_PedingApprovalOfHeadCount; } mrfDetail.EmployeeId = int.Parse(recruitmentManagerId); mrfDetail.ExpectedClosureDate = txtTargetDate.Text; mrfDetail.RecruitmentManager = ddlRecruitmentManager.SelectedItem.Text; mrfDetail.MRFCode = hidMrfCode.Value; mrfDetail.ProjectName = txtProjectName.Text; mrfDetail.DepartmentName = hidDepartment.Value; mrfDetail.Role = txtRole.Text; mrfDetail.ExpectedClosureDate = txtTargetDate.Text; mrfDetail.RecruitersId = ddlRecruitmentManager.SelectedValue; // 57877-Venkatesh- 29042016 : Start // Add sai email if while raising headcount for nis projects if (HfldProjectId.Value != "SELECT") { mrfDetail.ProjectId = Convert.ToInt32(HfldProjectId.Value); } // 57877-Venkatesh- 29042016 : End //Adding Purpose and PurposeDescription fileds if (ddlPurpose.SelectedItem.Text != Common.CommonConstants.SELECT) { mrfDetail.MRFPurposeId = Convert.ToInt32(ddlPurpose.SelectedValue); } else { mrfDetail.MRFPurposeId = CommonConstants.ZERO; } if (mrfDetail.MRFPurposeId == Convert.ToInt32(MasterEnum.MRFPurpose.MarketResearchfeasibility)) { mrfDetail.Status = CommonConstants.MRFStatus_PendingExternalAllocation; } if (txtPurpose.Visible == true && !string.IsNullOrEmpty(txtPurpose.Text)) { mrfDetail.MRFPurposeDescription = txtPurpose.Text.Trim(); } if (ddlDepartment.Visible == true && ddlDepartment.SelectedIndex > 0) { mrfDetail.MRFPurposeDescription = ddlDepartment.SelectedItem.Text; } // Rakesh - Issue : 57942 to Set Dropdown Value to Object if (ddlPurpose.SelectedItem != null) { mrfDetail.MRFPurpose = ddlPurpose.SelectedItem.Text; } //end if (Session[SessionNames.MRFRaiseHeadCOuntGroup] != null) { mrfIdGroup = Session[SessionNames.MRFRaiseHeadCOuntGroup].ToString(); } string[] newMrfId = mrfIdGroup.Split(','); // Rajan Kumar : Issue 46252: 10/02/2014 : Starts // Desc : In MRF history need to implemented in all cases in RMS. //Pass Email to know who is going to modified the data AuthorizationManager authoriseduser = new AuthorizationManager(); mrfDetail.LoggedInUserEmail = authoriseduser.getLoggedInUserEmailId(); // Rajan Kumar : Issue 46252: 10/02/2014 : END //Rakesh : Actual vs Budget 06/06/2016 Begin if (!string.IsNullOrEmpty(ddlCostCode.SelectedValue) && ddlCostCode.SelectedValue != CommonConstants.SELECT) { mrfDetail.CostCodeId = ddlCostCode.SelectedValue.CastToInt32(); } //End //If Session is not null Means multiple values selected from pending allocation page. if (Session[SessionNames.MRFRaiseHeadCOuntGroup] != null) { for (int i = 0; i < newMrfId.Length; i++) { bool isMailInGroup = false; if (newMrfId.Length == 1) { isMailInGroup = true; } mrfDetail.MRFId = Convert.ToInt32(newMrfId[i]); BusinessEntities.RaveHRCollection raveHRCollection = new RaveHRCollection(); raveHRCollection = objMrf.CopyMRFBL(Convert.ToInt32(newMrfId[i])); foreach (BusinessEntities.MRFDetail currentMrfDetails in raveHRCollection) { mrfDetail.MRFCode = currentMrfDetails.MRFCode; } //update MRF Status //Last parameter set to mail should not send for group. it would be in shot. //for that code is written below. objMrf.UpdateMrfStatus(mrfDetail, mailTo, newMrfId, isMailInGroup); } //For rave consultant send mail in one shot for all selected MRF. if (string.IsNullOrEmpty(mailTo) && newMrfId.Length > 1) { objMrf.SendMailForRaiseHeadCountWithouApprovalInGroup(mrfDetail, newMrfId); } } else { mrfDetail.MRFId = int.Parse(hidMrfId.Value); objMrf.UpdateMrfStatus(mrfDetail, mailTo, newMrfId, true); } Session[SessionNames.CONFIRMATION_MESSAGE] = "Request for head count is raised successfully, email notification is sent for approval."; Session[SessionNames.RAISE_HEAD_COUNT] = "True"; if (Session[SessionNames.MRFRaiseHeadCOuntGroup] != null) { Session.Remove(SessionNames.MRFRaiseHeadCOuntGroup); //Close the window //Page.ClientScript.RegisterStartupScript(this.GetType(), "close", " window.opener.location.href='MrfPendingAllocation.aspx'; window.close();", true); //Umesh: Issue 'Modal Popup issue in chrome' Starts ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "CloseJS", "jQuery.modalDialog.getCurrent().close();", true); //Umesh: Issue 'Modal Popup issue in chrome' Ends } else { //Umesh: Issue 'Modal Popup issue in chrome' Starts ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "CloseJS", "jQuery.modalDialog.getCurrent().close();", true); //Umesh: Issue 'Modal Popup issue in chrome' Ends } } } //catches RaveHRException exception catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME_MRFRAISEHEADCOUNT, "btnOK_Click", EventIDConstants.RAVE_HR_MRF_PRESENTATION_LAYER); LogErrorMessage(objEx); } }