/// <summary>
    /// Fill Employee Name
    /// </summary>
    private void FillEmployeeDDL(List <string> lstRights)
    {
        DataSet ds = new DataSet();

        Rave.HR.BusinessLayer.Employee.Employee addEmployeeBAL = new Rave.HR.BusinessLayer.Employee.Employee();
        Rave.HR.BusinessLayer.FourC.FourC       fourCBAL       = new Rave.HR.BusinessLayer.FourC.FourC();

        if (lstRights.Any(o => o.ToString() == MasterEnum.FourCRole.FOURCADMIN.ToString()) || lstRights.Any(o => o.ToString() == MasterEnum.FourCRole.VIEWACCESSRIGHTS.ToString()))
        //if (ViewState["FourCRole"].ToString() != MasterEnum.FourCRole.RMS_FUNCTIONALMANAGER.ToString())
        {
            ds = addEmployeeBAL.GetActiveEmployeeList();
        }
        else
        {
            ds = fourCBAL.GetFunctionalManagerEmployeeName(int.Parse(ViewState["LoginEmpId"].ToString()));
        }

        ddlEmployee.Items.Clear();

        ddlEmployee.DataSource     = ds.Tables[0];
        ddlEmployee.DataTextField  = ds.Tables[0].Columns[1].ToString();
        ddlEmployee.DataValueField = ds.Tables[0].Columns[0].ToString();
        ddlEmployee.DataBind();

        ddlEmployee.Items.Insert(0, new ListItem(CommonConstants.SELECT, CommonConstants.ZERO.ToString()));
    }
    private BusinessEntities.RaveHRCollection GetHeadCountReport(string SortExpressionAndDirection)
    {
        BusinessEntities.Projects               project          = new Projects();
        BusinessEntities.RaveHRCollection       raveHRCollection = new BusinessEntities.RaveHRCollection();
        Rave.HR.BusinessLayer.Employee.Employee employeeBL       = new Rave.HR.BusinessLayer.Employee.Employee();
        try
        {
            project.ProjectDivision         = ddlDivision.SelectedValue != "Select" ? Convert.ToInt32(ddlDivision.SelectedValue) : 0;
            project.ProjectBussinessArea    = ddlBusinessArea.SelectedValue != "Select" ? Convert.ToInt32(ddlBusinessArea.SelectedValue) : 0;
            project.ProjectBussinessSegment = ddlBusinessSegment.SelectedValue != "Select" ? Convert.ToInt32(ddlBusinessSegment.SelectedValue) : 0;
            //Siddharth 27 March 2015 Start
            raveHRCollection = employeeBL.GetHeadCountReport(project, SortExpressionAndDirection);
            //Siddharth 27 March 2015 End
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetHeadCountReport", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }

        return(raveHRCollection);
    }
Esempio n. 3
0
    private void GetMRFCode()
    {
        //Declaring COllection class object
        BusinessEntities.RaveHRCollection raveHrColl = new BusinessEntities.RaveHRCollection();

        //Declaring Master Class Object
        Rave.HR.BusinessLayer.Employee.Employee employee = new Rave.HR.BusinessLayer.Employee.Employee();

        try
        {
            //Calling Fill dropdown Business layer method to fill
            //the dropdown from Employee Business class.
            raveHrColl = employee.FillMRFCodeDropDowns();

            ddlMRFCode.Items.Clear();
            ddlMRFCode.DataSource     = raveHrColl;
            ddlMRFCode.DataTextField  = Common.CommonConstants.DDL_DataTextField;
            ddlMRFCode.DataValueField = Common.CommonConstants.DDL_DataValueField;
            ddlMRFCode.DataBind();
            ddlMRFCode.Items.Insert(CommonConstants.ZERO, CommonConstants.SELECT);
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetMRFCode", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
Esempio n. 4
0
    private void GetProjectNameNIS()
    {
        try
        {
            AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();
            UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
            UserRaveDomainId = UserRaveDomainId.Replace("co.in", "com");

            //Declaring COllection class object
            BusinessEntities.RaveHRCollection raveHrColl = new BusinessEntities.RaveHRCollection();

            //Declaring Master Class Object
            Rave.HR.BusinessLayer.Employee.Employee employee = new Rave.HR.BusinessLayer.Employee.Employee();

            //Calling Fill dropdown Business layer method to fill
            //the dropdown from Employee Business class.
            raveHrColl = employee.FillProjectNameNISDropDowns(UserRaveDomainId, objParameter.Role);

            ddlProject.Items.Clear();
            ddlProject.DataSource     = raveHrColl;
            ddlProject.DataTextField  = Common.CommonConstants.DDL_DataTextField;
            ddlProject.DataValueField = Common.CommonConstants.DDL_DataValueField;
            ddlProject.DataBind();
            //ddlProject.Items.Insert(CommonConstants.ZERO, CommonConstants.SELECT);
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetConsolidated", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
Esempio n. 5
0
    private void GetConsolidated(string SortExpressionAndDirection)
    {
        BusinessEntities.Employee               employee         = new BusinessEntities.Employee();
        BusinessEntities.RaveHRCollection       raveHRCollection = new BusinessEntities.RaveHRCollection();
        Rave.HR.BusinessLayer.Employee.Employee employeeBL       = new Rave.HR.BusinessLayer.Employee.Employee();
        try
        {
            DataSet ds = new DataSet();

            ds = employeeBL.GetConsolidated(Convert.ToInt32(ddlProject.SelectedValue), SortExpressionAndDirection);
            GVResourcesOnboard.DataSource = ds.Tables[0];
            Session["GVResourcesOnboard"] = Convert.ToInt32(ds.Tables[0].Rows.Count);
            GVResourcesOnboard.DataBind();

            GVResourcesReleased.DataSource = ds.Tables[1];
            Session["GVResourcesReleased"] = Convert.ToInt32(ds.Tables[1].Rows.Count);
            GVResourcesReleased.DataBind();
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    btnExport.Visible = false;
                }
                else
                {
                    btnExport.Visible = true;
                }

                if (ds.Tables[0].Rows.Count == 0)
                {
                    TROnBoard.Visible = false;
                }
                else
                {
                    TROnBoard.Visible = true;
                }

                if (ds.Tables[1].Rows.Count == 0)
                {
                    TRRelease.Visible = false;
                }
                else
                {
                    TRRelease.Visible = true;
                }
            }
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetConsolidated", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
    ///// <summary>
    ///// Handles the Click event of the lnkSaveBtn control.
    ///// </summary>
    ///// <param name="sender">The source of the event.</param>
    ///// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnRollBack_Click(object sender, EventArgs e)
    {
        try
        {
            Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();

            if (txtResignationReason.Text.Trim() == null || txtResignationReason.Text.Trim() == "" ||
                txtResignationReason.Text.Trim() == string.Empty)
            {
                lblMessage.Text = "Plese enter details";
                return;
            }
            else
            {
                //Mohamed : Issue 41564 : 04/04/2013 : Starts
                //Desc : Employee’s name is missing in subject line. It should have been “Employee Name : Kalpesh Hodar”. Another same case attached
                employee.FullName = employee.FirstName.Trim() + " " + employee.LastName.Trim();
                //Mohamed : Issue 41564 : 04/04/2013 : Ends

                // Roll back Resign of employee from company (Cancel).
                employeeBL.RollBackEmployeeResignationDetailsBL(employee);

                //Send mail for Roll back Resign.
                employeeBL.SendMailEmployeeRollBackResignFromCompany(employee);

                lblConfirmMsg.Text = ROLLBACK_RESIGNATION_MESSAGE;

                lblMessage.Visible               = true;
                txtResignationReason.Text        = string.Empty;
                ucDatePickerResignationDate.Text = string.Empty;

                //Mohamed : Issue 41715 : 04/04/2013 : Starts
                //Desc : Employee Detail/Resignation Detail :- after Rollback, if we click on "Resignation Detail" from left panel it display the detail even after Rollback
                employee.LastWorkingDay    = DateTime.MinValue;
                employee.ResignationDate   = DateTime.MinValue;
                employee.ResignationReason = string.Empty;

                //Mohamed : Issue 41715 : 04/04/2013 : Ends
                //Poonam : Issue : 56656 : Starts
                btnSave.Visible = true;
                //Poonam : Issue : 56656 : Ends
                btnRollBack.Visible = false;
            }
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnRollBack_Click", EventIDConstants.RAVE_HR_CONTRACT_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
Esempio n. 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            this.SetEmployeeIndex();
        }


        //for roles and login user id

        Rave.HR.BusinessLayer.MRF.MRFRoles mrfRoles = new Rave.HR.BusinessLayer.MRF.MRFRoles();
        // Get logged-in user's email id
        AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();

        UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
        UserMailId       = UserRaveDomainId.Replace("co.in", "com");
        AuthorizationManager RaveHRAuthorizationManager = new AuthorizationManager();

        //ArrayList arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());
        arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());

        if (arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
        {
            trResignationDetails.Visible = true;
            trEmployeeResume.Visible     = true;
        }
        // 30212,30295-Ambar-03102011-made both the statement to upper case for checking
        else if (((BusinessEntities.Employee)(Session[SessionNames.EMPLOYEEDETAILS])).EmailId.ToString().ToUpper() == UserRaveDomainId.ToString().Replace("co.in", "com").ToUpper())
        {
            // 30212-Ambar-Start-03102011
            trResignationDetails.Visible = false;
            // 30212-Ambar-End-03102011
            trEmployeeResume.Visible = true;
        }
        else
        {
            //Ishwar 20022015 : NIS RMS : Start
            string strUserIdentity = string.Empty;
            strUserIdentity = HttpContext.Current.ApplicationInstance.Session["WindowsUsername"].ToString().Trim();
            BusinessEntities.Employee Employee = new BusinessEntities.Employee();
            Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();
            Employee = employeeBL.GetNISEmployeeList(strUserIdentity);
            if (!String.IsNullOrEmpty(Employee.WindowsUserName))
            {
                trResignationDetails.Visible = true;
            }//Ishwar 20022015 : NIS RMS : End
            else
            {
                trResignationDetails.Visible = false;
                trEmployeeResume.Visible     = false;
            }
        }
    }
    /// <summary>
    /// Handles the RowCommand event of the gvEmployeeResume control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewCommandEventArgs"/> instance containing the event data.</param>
    protected void gvEmployeeResume_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "View")
        {
            GridViewRow grv           = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            LinkButton  lnkResume     = (LinkButton)grv.FindControl("_lnkResume");
            Label       FileExtension = (Label)grv.FindControl("lblExtension");

            if (lnkResume != null)
            {
                Response.Clear();
                Response.ContentType = "Application/msword";
                Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", lnkResume.Text));
                Response.Charset = "";
                Response.WriteFile(Server.MapPath(resumePhsicalPath + lnkResume.Text));
                Response.Flush();
                Response.End();
            }
        }

        //19645-Ambar-Start
        if (e.CommandName == "Delete")
        {
            GridViewRow grv           = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            LinkButton  lnkResume     = (LinkButton)grv.FindControl("_lnkResume");
            Label       FileExtension = (Label)grv.FindControl("lblExtension");

            if (lnkResume != null)
            {
                str_deletedfile = lnkResume.Text;
                File.Delete(Server.MapPath(resumePhsicalPath + lnkResume.Text));

                if (!str_deletedfile.Contains("_old"))
                {
                    string str_deletedfile_temp = str_deletedfile.Substring(0, str_deletedfile.Length - 4) + "_old" + str_deletedfile.Substring(str_deletedfile.Length - 4);

                    if (File.Exists(Server.MapPath(resumePhsicalPath + str_deletedfile_temp)))
                    {
                        File.Copy(Server.MapPath(resumePhsicalPath + str_deletedfile_temp), Server.MapPath(resumePhsicalPath + str_deletedfile));
                        File.Delete(Server.MapPath(resumePhsicalPath + str_deletedfile_temp));
                    }
                }
                lblMessage.Text = "Employee Resume Deleted successfully.";

                //Aarohi : Issue 30053(CR) : 22/12/2011 : Start
                //Send mail for Employee Resume Delete.
                Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();
                employeeBL.SendDeleteResumeMails(employee);
                //Aarohi : Issue 30053(CR) : 22/12/2011 : End
            }
        }
        //19645-Ambar-End
    }
    private void PopulateData()
    {
        try
        {
            Rave.HR.BusinessLayer.Employee.Employee empBL   = new Rave.HR.BusinessLayer.Employee.Employee();
            BusinessEntities.RaveHRCollection       collObj = new BusinessEntities.RaveHRCollection();


            //Aarohi : Issue 28572(CR) : 05/01/2012 : Start
            //Commented the below line of code to add a new parameter for employeeId
            //commented for 4C report
            //collObj = empBL.GetEmployeesList(txtResourceName.Text.Trim());



            //if (hidEMPId.Text != null || hidEMPId.Text == string.Empty || hidEMPId.Text == "")
            //if (hidEMPId.Text != null && hidEMPId.Text != string.Empty || hidEMPId.Text != "")
            //{
            //    collObj = empBL.GetEmployeeListForFMRM(txtResourceName.Text.Trim(), hidEMPId.Text);
            //}
            //else
            //{
            //    collObj = empBL.GetEmployeesList(txtResourceName.Text.Trim());
            //}
            //Aarohi : Issue 28572(CR) : 05/01/2012 : End


            //CASES to show employee
            //First to show all sub-ordinate
            if (DecryptQueryString("VIEW") != null && !string.IsNullOrEmpty(DecryptQueryString("VIEW")))
            {
                collObj = empBL.GetEmployeesView(DecryptQueryString("VIEW"), int.Parse(DecryptQueryString("EmpId")), txtResourceName.Text.Trim());
            }
            else
            {
                collObj = empBL.GetEmployeesList(txtResourceName.Text.Trim());
            }

            grdvListofEmployees.DataSource = collObj;
            grdvListofEmployees.DataBind();
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "PopulateData", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
Esempio n. 10
0
    private void GetEmployeeDesignations(int categoryID)
    {
        Rave.HR.BusinessLayer.Common.Master     master     = new Rave.HR.BusinessLayer.Common.Master();
        BusinessEntities.RaveHRCollection       raveHrColl = new BusinessEntities.RaveHRCollection();
        Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();

        raveHrColl = employeeBL.GetEmployeesDesignations(categoryID);

        ddlDesignation.Items.Clear();
        ddlDesignation.DataSource     = raveHrColl;
        ddlDesignation.DataTextField  = Common.CommonConstants.DDL_DataTextField;
        ddlDesignation.DataValueField = Common.CommonConstants.DDL_DataValueField;
        ddlDesignation.DataBind();
        ddlDesignation.Items.Insert(CommonConstants.ZERO, CommonConstants.SELECT);
    }
    private void fillEmployeeDDL()
    {
        DataSet ds = new DataSet();

        Rave.HR.BusinessLayer.Employee.Employee addEmployeeBAL = new Rave.HR.BusinessLayer.Employee.Employee();
        //sanju kushwaha Start
        //issue 49187 Added new SP USP_Project_GetManagerList to load the manager list instead of all employees
        ds = addEmployeeBAL.GetManagersList();
        //End
        ddlEmployeeList.DataSource     = ds.Tables[0];
        ddlEmployeeList.DataTextField  = ds.Tables[0].Columns[1].ToString();
        ddlEmployeeList.DataValueField = ds.Tables[0].Columns[0].ToString();
        ddlEmployeeList.DataBind();

        ddlEmployeeList.Items.Insert(0, new ListItem(SELECTONE, ZERO));
    }
    private BusinessEntities.Employee GetEmployee(BusinessEntities.Employee employeeObj)
    {
        BusinessEntities.Employee empPar = null;
        empPar = new BusinessEntities.Employee();
        BusinessEntities.Employee employee = new BusinessEntities.Employee();
        Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();

        try
        {
            employee = employeeBL.GetEmployee(employeeObj);
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetEmployee", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }

        return(employee);
    }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //Clearing the error label
            lblMessage.Text    = string.Empty;
            lblConfirmMsg.Text = string.Empty;

            btnSave.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
            //26137-Ambar-Start
            //btnRollBack.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ConfirmForRollBackResign();");
            //26137-Ambar-End
            //Poonam : Issue : Disable Button : Starts
            btnSave.OnClientClick     = "if(ButtonClickValidate()){" + ClientScript.GetPostBackEventReference(btnSave, null) + "}";
            btnRollBack.OnClientClick = "if(ConfirmForRollBackResign()){" + ClientScript.GetPostBackEventReference(btnRollBack, null) + "}";
            //Poonam : Issue : Disable Button : Ends
            //btnRMFM.Attributes.Add(CommonConstants.EVENT_ONCLICK, "return SelectProjectDetails();");

            Rave.HR.BusinessLayer.MRF.MRFRoles mrfRoles = new Rave.HR.BusinessLayer.MRF.MRFRoles();
            // Get logged-in user's email id
            AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();
            UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
            UserMailId       = UserRaveDomainId.Replace("co.in", "com");
            AuthorizationManager RaveHRAuthorizationManager = new AuthorizationManager();
            //ArrayList arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());
            arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());

            if (!ValidateURL())
            {
                Response.Redirect(CommonConstants.INVALIDURL, false);
            }

            if (Session[Common.SessionNames.EMPLOYEEDETAILS] != null)
            {
                employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];
            }

            if (employee != null)
            {
                employeeID      = employee.EMPId;
                lblempName.Text = employee.FirstName.ToUpper() + " " + employee.LastName.ToUpper();
            }

            if (!IsPostBack)
            {
                #region Modified By Mohamed Dangra
                // Mohamed : Issue 50959 : 16/05/2014 : Starts
                // Desc : Roll back button should invisible for Inactive employee

                if (employee.StatusId == 142)
                {
                    //31145-Subhra-Start
                    if (employee.ResignationReason != string.Empty)
                    {
                        btnRollBack.Visible = true;
                    }
                    //31145-Subhra-end
                }

                // Mohamed : Issue 50959 : 16/05/2014 : Ends
                #endregion Modified By Mohamed Dangra
                this.GetEmployeeStatus();
                this.PopulateControls();

                //Ishwar 20022015 : NIS RMS : Start
                string strUserIdentity = string.Empty;
                strUserIdentity = HttpContext.Current.ApplicationInstance.Session["WindowsUsername"].ToString().Trim();
                BusinessEntities.Employee Employee = new BusinessEntities.Employee();
                Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();
                Employee = employeeBL.GetNISEmployeeList(strUserIdentity);
                if (!String.IsNullOrEmpty(Employee.WindowsUserName))
                {
                    pnlResignationDetails.Enabled = false;
                    btnRMFMHTML.Visible           = false;
                    btnSave.Visible     = false;
                    btnRollBack.Visible = false;
                }
                //Ishwar 20022015 : NIS RMS : End
            }

            SavedControlVirtualPath = "~/EmployeeMenuUC.ascx";
            ReloadControl();
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "Page_Load", EventIDConstants.RAVE_HR_CONTRACT_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
    /// <summary>
    /// release the employee from project & then Exit the employee.
    /// If employee is last resource on project then project should get closed.
    /// Mail should be send for all above activities.
    /// </summary>
    /// <param name="employee">Employee Details</param>
    /// <created By>Yagendra Sharnagat </created By>
    private void ExitEmployee(BusinessEntities.Employee employee, bool B_ClientName)
    {
        RaveHRCollection raveHRCollection = new RaveHRCollection();

        Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();

        //Get the allocated project details of employee
        raveHRCollection = employeeBL.IsAllocatedToProject(employee);

        //Issue Id : 28572 Mahendra START
        //Check if any employee's line manager or functional manager is resigned employee.
        RaveHRCollection raveHRCollectionReportingEmployee = new RaveHRCollection();

        raveHRCollectionReportingEmployee = employeeBL.IsRepotingManager(employee);
        if (raveHRCollectionReportingEmployee.Count != 0)
        {
            lblMessage.Visible = true;
            lblMessage.Text    = "Resigned Employee is a Line Manager or Functional Manager of some of employees. Please change Manager for that employees.";
            return;
        }
        //Issue Id : 28572 Mahendra END


        int     ProjectCount      = 0;
        Boolean IsProjectClosed   = false;
        string  projectAllocation = string.Empty;
        Boolean IsRoleHR          = false;

        // Check whether employee is allocated to project.
        if (raveHRCollection.Count != 0)
        {
            RaveHRCollection newRaveHRCollection = new RaveHRCollection();
            BusinessEntities.ParameterCriteria newObjParameter = new BusinessEntities.ParameterCriteria();

            //As this parameter required for the method.
            newObjParameter.PageNumber = 1;
            newObjParameter.PageSize   = 10;
            newObjParameter.SortExpressionAndDirection = "EMPId ASC";
            IsRoleHR = true;

            employee.StatusId = 142;//active emp

            //Get the employee details of allocated projects.
            newRaveHRCollection = employeeBL.GetEmployeesProjectDetails(newObjParameter, employee, ref ProjectCount);

            //To release Employee project wise.
            foreach (BusinessEntities.Employee empDetails in newRaveHRCollection)
            {
                empDetails.EmpReleasedStatus = 1;

                empDetails.StatusId = Convert.ToInt32(ddlStatus.SelectedItem.Value.ToString());

                //For mail get current date for release
                //30920-Subhra-Start
                //empDetails.ProjectReleaseDate = System.DateTime.Now;
                empDetails.ProjectReleaseDate = ucDatePickerLastWorkDay.Text.Trim() == string.Empty ? DateTime.MinValue : Convert.ToDateTime(ucDatePickerLastWorkDay.Text);
                //30920-Subhra-End

                //Release the employee from project.
                employeeBL.UpdateEmployeeReleaseStatus(empDetails, ref IsProjectClosed);

                //Siddharth 7 April 2015 Start
                //Set isActive =0 for projects of resigned employees
                employeeBL.Employee_UpdateEmpCostCodeProjRelease(empDetails);
                //Siddharth 7 April 2015 End

                if (empDetails.ProjectId != 0)
                {   //Send mail for project release.
                    employeeBL.SendMailToEmployeeReleasedFromProject(empDetails, IsRoleHR);

                    projectAllocation += empDetails.ProjectName + ", ";
                }
                else
                {
                    //Send mail for department release.
                    employeeBL.SendMailToEmployeeReleasedFromDepartment(empDetails, IsRoleHR);
                }

                //If last employee then close the project.
                if (IsProjectClosed)
                {
                    //then send Email for closed project
                    int ProjectId = empDetails.ProjectId;

                    Rave.HR.BusinessLayer.Projects.Projects objProjectsBAL = new Rave.HR.BusinessLayer.Projects.Projects();;
                    BusinessEntities.Projects objRaveHR = new BusinessEntities.Projects();;
                    //Get the prooject details for email functionality.
                    objRaveHR = objProjectsBAL.RetrieveProjectDetails(ProjectId);
                    //--Call the BL method to send Emails.
                    employeeBL.SendMailToEmployeeForClosedProject(objRaveHR);
                }
            }
        }

        //Inactive employee Id.
        employee.StatusId = 143;

        //Resign the employee from company (exit).
        employeeBL.UpdateEmployeeResignationDetails(employee);

        //Remove last appended comma.
        if (projectAllocation.EndsWith(", "))
        {
            projectAllocation = projectAllocation.Substring(0, projectAllocation.Length - 2);
        }

        //Also get project name with department.
        if (projectAllocation.Trim() != string.Empty)
        {
            employee.Department = employee.Department + " (" + projectAllocation.Trim() + ") ";
        }


        //Send mail for exit.
        employeeBL.SendMailEmployeeResignFromCompany(employee, B_ClientName);

        lblConfirmMsg.Text = "Employee Resignation Details saved successfully and email notification is sent.";

        lblMessage.Visible = true;
    }
    /// <summary>
    /// Handles the Click event of the btnSave control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Rave.HR.BusinessLayer.Employee.SkillsDetails objSkillsDetailsBAL;
        Rave.HR.BusinessLayer.Employee.Employee      objEmployeeSkillsBAL;

        BusinessEntities.SkillsDetails    objSkillsDetails;
        BusinessEntities.RaveHRCollection objSaveSkillsDetailsCollection = new BusinessEntities.RaveHRCollection();

        try
        {
            objSkillsDetailsBAL  = new Rave.HR.BusinessLayer.Employee.SkillsDetails();
            objEmployeeSkillsBAL = new Rave.HR.BusinessLayer.Employee.Employee();

            if (gvSkills.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
            {
                for (int i = 0; i < gvSkills.Rows.Count; i++)
                {
                    objSkillsDetails = new BusinessEntities.SkillsDetails();

                    Label SkillValue       = (Label)gvSkills.Rows[i].FindControl(SKILL);
                    Label ProficiencyValue = (Label)gvSkills.Rows[i].FindControl(PROFICIENCY);
                    Label SkillId          = (Label)gvSkills.Rows[i].FindControl(SKILLID);
                    Label Mode             = (Label)gvSkills.Rows[i].FindControl(MODE);

                    objSkillsDetails.SkillsId         = int.Parse(SkillId.Text);
                    objSkillsDetails.EMPId            = int.Parse(EMPId.Value);
                    objSkillsDetails.SkillName        = gvSkills.Rows[i].Cells[0].Text;
                    objSkillsDetails.Experience       = gvSkills.Rows[i].Cells[1].Text;
                    objSkillsDetails.ProficiencyLevel = gvSkills.Rows[i].Cells[2].Text;
                    objSkillsDetails.LastUsedDate     = Convert.ToDateTime(gvSkills.Rows[i].Cells[3].Text);
                    objSkillsDetails.Mode             = int.Parse(Mode.Text);
                    objSkillsDetails.Skill            = int.Parse(SkillValue.Text);
                    objSkillsDetails.Proficiency      = int.Parse(ProficiencyValue.Text);
                    objSaveSkillsDetailsCollection.Add(objSkillsDetails);
                }
            }
            BusinessEntities.RaveHRCollection objDeleteSkillsDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[SKILLDETAILSDELETE];

            if (objDeleteSkillsDetailsCollection != null)
            {
                BusinessEntities.SkillsDetails obj = null;

                for (int i = 0; i < objDeleteSkillsDetailsCollection.Count; i++)
                {
                    objSkillsDetails = new BusinessEntities.SkillsDetails();
                    obj = (BusinessEntities.SkillsDetails)objDeleteSkillsDetailsCollection.Item(i);

                    objSkillsDetails.SkillsId    = obj.SkillsId;
                    objSkillsDetails.EMPId       = obj.EMPId;
                    objSkillsDetails.Skill       = obj.Skill;
                    objSkillsDetails.Experience  = obj.Experience;
                    objSkillsDetails.Proficiency = obj.Proficiency;
                    objSkillsDetails.Mode        = obj.Mode;
                    objSkillsDetails.Skill       = obj.Skill;
                    objSkillsDetails.Proficiency = obj.Proficiency;

                    objSaveSkillsDetailsCollection.Add(objSkillsDetails);
                }
            }
            objSkillsDetailsBAL.Manipulation(objSaveSkillsDetailsCollection);

            if (ViewState.Count > 0)
            {
                ViewState.Clear();
            }

            if (EMPId.Value != string.Empty)
            {
                int empID = Convert.ToInt32(EMPId.Value);
                //Refresh the grip after saving
                this.PopulateGrid(empID);
            }
            if (gvSkills.Rows.Count == 0)
            {
                btnSave.Visible = false;
            }

            objEmployeeSkillsBAL.SendMailApprovalOfSkillsRating(employee);

            lblMessage.Text = "Skills details saved successfully.";
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnSave_Click", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
    /// <summary>
    /// Handles the Click event of the btnSave control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (ValidateControls())
            {
                Boolean Flag, B_ClientName = false;
                string  ClientName = string.Empty;
                employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];

                if (Request.QueryString[QueryStringConstants.EMPID] != null)
                {
                    employee.EMPId = Convert.ToInt32(DecryptQueryString(QueryStringConstants.EMPID).ToString());
                }
                if (employee != null)
                {
                    Rave.HR.BusinessLayer.Employee.Employee addEmployeeBAL = new Rave.HR.BusinessLayer.Employee.Employee();
                    AuthorizationManager authoriseduser = new AuthorizationManager();

                    if (ucDatePickerLastWorkDay.Visible)
                    {
                        if (employee.StatusId != Convert.ToInt32(ddlStatus.SelectedItem.Value.ToString()) || employee.ResignationDate.ToString("dd/MM/yyyy") != ucDatePickerResignationDate.Text || employee.ResignationReason != txtResignationReason.Text || employee.LastWorkingDay.ToString("dd/MM/yyyy") != ucDatePickerLastWorkDay.Text)
                        {
                            Flag = true;
                        }
                    }
                    else if (employee.StatusId != Convert.ToInt32(ddlStatus.SelectedItem.Value.ToString()) || employee.ResignationDate.ToString("dd/MM/yyyy") != ucDatePickerResignationDate.Text || employee.ResignationReason != txtResignationReason.Text)
                    {
                        Flag = true;
                    }
                    Flag = true;

                    if (Flag)
                    {
                        objParameter.EMailID          = UserMailId;
                        employee.StatusId             = Convert.ToInt32(ddlStatus.SelectedItem.Value.ToString());
                        employee.LastWorkingDay       = ucDatePickerLastWorkDay.Text.Trim() == string.Empty ? DateTime.MinValue : Convert.ToDateTime(ucDatePickerLastWorkDay.Text);
                        employee.ResignationDate      = ucDatePickerResignationDate.Text.Trim() == string.Empty ? DateTime.MinValue : Convert.ToDateTime(ucDatePickerResignationDate.Text);
                        employee.ResignationReason    = txtResignationReason.Text.Trim();
                        employee.LastModifiedByMailId = UserMailId;
                        employee.LastModifiedDate     = DateTime.Now.Date;
                        employee.FullName             = employee.FirstName.Trim() + " " + employee.LastName.Trim();

                        //update the session values for an employee.
                        Session[SessionNames.EMPLOYEEDETAILS] = employee;

                        //Siddharth 23-02-2015
                        //Get Projects allocated of resigned Employee
                        RaveHRCollection raveHRCollection = new RaveHRCollection();
                        Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();
                        //Get the allocated project details of employee
                        raveHRCollection = employeeBL.GetEmployeesAllocation(employee);
                        B_ClientName     = false;

                        if (raveHRCollection != null)
                        {
                            if (raveHRCollection.Count > 0)
                            {
                                for (int i = 0; i < raveHRCollection.Count; i++)
                                {
                                    ClientName = ((BusinessEntities.Employee)(raveHRCollection.Item(i))).ClientName;
                                    if (ClientName.ToUpper().Contains("NPS") || ClientName.ToUpper().Contains("NORTHGATE"))
                                    {
                                        B_ClientName = true;
                                    }
                                }
                            }
                        }

                        //--Get mailIds
                        if (ddlStatus.SelectedItem.Text == "Active")
                        {
                            addEmployeeBAL.UpdateEmployeeResignationDetails(employee);

                            addEmployeeBAL.SendMailEmployeeSeperationFromCompany(employee, B_ClientName);

                            lblConfirmMsg.Text = "Employee Resignation Details saved successfully and email notification is sent.";

                            lblMessage.Visible = true;
                        }
                        if (ddlStatus.SelectedItem.Text == "InActive")
                        {
                            ExitEmployee(employee, B_ClientName);
                        }
                        btnRollBack.Visible = true;
                    }
                }
            }
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnUpdate_Click", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
Esempio n. 17
0
        //send mail function
        public void SendEmail(IRMSEmail objEmailConfigEntities)
        {
            SmtpClient  mailClient = null;
            MailMessage message    = null;

            try
            {
                //--Check mailing on or off
                if (ConfigurationManager.AppSettings["MailingOnOrOff"].ToString().ToLower() == "off")
                {
                    return;
                }

                //--Get the entity values
                string strFrom = objEmailConfigEntities.From;
                if (strFrom.Trim() == string.Empty)
                {
                    //--Get logged in user
                    AuthorizationManager authoriseduser = new AuthorizationManager();
                    strFrom = authoriseduser.getLoggedInUserEmailId();
                    //GoogleMail
                    //strFrom = getLoggedInUserEmailId();
                }
                string strTo      = string.Join(",", (string[])objEmailConfigEntities.To.ToArray(Type.GetType("System.String")));
                string strCC      = string.Join(",", (string[])objEmailConfigEntities.CC.ToArray(Type.GetType("System.String")));
                string strSubject = objEmailConfigEntities.Subject;
                string strBody    = objEmailConfigEntities.Body;

                string strHead = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><HEAD><META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\"><META content=\"MSHTML 6.00.6000.16525\" name=GENERATOR><STYLE></STYLE></HEAD><BODY><DIV><FONT face=Verdana size=2>";

                string strFooter = "</font></div></body>";

                mailClient = new SmtpClient();
                message    = new MailMessage();
                string strFullBody = strBody;

                //smtp mail host
                mailClient.Host = ConfigurationSettings.AppSettings["SmtpServer"];
                //smtp mail port
                mailClient.Port = int.Parse(ConfigurationSettings.AppSettings["Port"]);

                //from mail Address
                MailAddress fromAddress = new MailAddress(strFrom);
                message.From = fromAddress;

                char chr = ',';
                strTo = strTo.Trim(chr);
                strCC = strCC.Trim(chr);

                string[] strToMails = strTo.Split(chr);
                string[] strCCMails = strCC.Split(chr);

                for (int cont = 0; cont < strToMails.Length; cont++)
                {
                    //to mail address
                    if (strToMails[cont].Trim() != "")
                    {
                        // CR - 29936 Sachin Start
                        // Commented following code and Added conditions to check whether employee has exited of not
                        // message.To.Add(strToMails[cont]);
                        Rave.HR.BusinessLayer.Employee.Employee EmpTo = new Rave.HR.BusinessLayer.Employee.Employee();
                        BusinessEntities.Employee emp = new BusinessEntities.Employee();
                        emp.EmailId = strToMails[cont];
                        emp         = EmpTo.GetEmployeeByEmpId(emp);
                        if (emp != null && emp.LastWorkingDay != null)
                        {
                            if (emp.LastWorkingDay == DateTime.MinValue)
                            {
                                message.To.Add(strToMails[cont]);
                            }
                        }
                        // CR - 29936 Sachin End
                    }
                }

                for (int cont = 0; cont < strCCMails.Length; cont++)
                {
                    //cc mail address
                    if (strCCMails[cont].Trim() != "")
                    {
                        // CR - 29936 Sachin
                        // Commented following code and Added conditions to check whether employee has exited of not
                        // message.CC.Add(strCCMails[cont]);
                        Rave.HR.BusinessLayer.Employee.Employee EmpTo = new Rave.HR.BusinessLayer.Employee.Employee();
                        BusinessEntities.Employee emp = new BusinessEntities.Employee();
                        emp.EmailId = strCCMails[cont];
                        emp         = EmpTo.GetEmployeeByEmpId(emp);
                        if (emp != null && emp.LastWorkingDay != null)
                        {
                            if (emp.LastWorkingDay == DateTime.MinValue)
                            {
                                message.CC.Add(strCCMails[cont]);
                            }
                        }
                        // CR - 29936 Sachin End
                    }
                }

                //--CC to self
                message.CC.Add(strFrom);

                //--Subject
                message.Subject = strSubject;
                //--Body
                message.Body       = strHead + strFullBody + strFooter;
                message.IsBodyHtml = true;

                //--Send
                mailClient.Send(message);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message,
                                          ex,
                                          Sources.CommonLayer,
                                          CLASS_NAME_RP,
                                          "SendEmail",
                                          EventIDConstants.MAIL_EXCEPTION);
            }
            finally
            {
                if (message != null)
                {
                    message = null;
                }
                if (mailClient != null)
                {
                    mailClient = null;
                }
            }
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            Rave.HR.BusinessLayer.Employee.Employee addEmployeeBAL = new Rave.HR.BusinessLayer.Employee.Employee();
            string chkUpdateEmpNo = "";

            if (Request.QueryString["page"] != null && Request.QueryString["page"] == "employeesummary")
            {
                empId = ddlEmployeeList.SelectedItem.Value;
            }
            else
            {
                employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];
                empId    = employee.EMPId.ToString();
            }

            foreach (GridViewRow gvRow in grdvListofReportingEmployees.Rows)
            {
                System.Web.UI.WebControls.CheckBox    chkSel                  = (System.Web.UI.WebControls.CheckBox)gvRow.FindControl("chkSelect");
                System.Web.UI.WebControls.HiddenField hdEmpNo                 = (System.Web.UI.WebControls.HiddenField)gvRow.FindControl("HfEmpId");
                System.Web.UI.WebControls.HiddenField hdProjectId             = (System.Web.UI.WebControls.HiddenField)gvRow.FindControl("HfProjectId");
                System.Web.UI.WebControls.HiddenField hdReportingToName       = (System.Web.UI.WebControls.HiddenField)gvRow.FindControl("HfReportingToName");
                System.Web.UI.WebControls.HiddenField HdReportingToCommonName = (System.Web.UI.WebControls.HiddenField)gvRow.FindControl("HfReportingToCommonName");
                System.Web.UI.WebControls.HiddenField HdFunctionalToName      = (System.Web.UI.WebControls.HiddenField)gvRow.FindControl("HfFunctionalToName");

                if (chkSel != null && chkSel.Checked)
                {
                    if (hdProjectId.Value != "0")
                    {
                        //Update Project Allocation table T_ProjectAllocation
                        addEmployeeBAL.UpdateEmployeeFMRMForProjectAllocation(Convert.ToInt32(hdEmpNo.Value), hdReportingToName.Value, Convert.ToInt32(hdProjectId.Value));
                    }

                    if (!string.Equals(chkUpdateEmpNo.Trim(), hdEmpNo.Value.Trim()))
                    {
                        chkUpdateEmpNo = hdEmpNo.Value;
                        //Siddhesh Arekar : Reporting Manager not updating : 17/06/2015 : Starts
                        //Description - Added new parameter in ReportingToCommonName function for passing changed FunctionalToName
                        string HdReportingCommonNew = ReportingToCommonName(empId, hdEmpNo.Value, HdReportingToCommonName.Value, HdFunctionalToName.Value);
                        //Siddhesh Arekar : Reporting Manager not updating : 17/06/2015 : Ends

                        if (HdReportingCommonNew.Equals("DuplicateFunctionalManager"))
                        {
                            Page page = HttpContext.Current.Handler as Page;
                            ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('Two different fucntional managers selected for same employee.');", true);
                            return;
                        }

                        //update common functional and reporting to T_Employees
                        if (HdReportingCommonNew != "")
                        {
                            addEmployeeBAL.UpdateEmployeeFMRM(Convert.ToInt32(hdEmpNo.Value), HdReportingCommonNew, Convert.ToInt32(HdFunctionalToName.Value));
                        }
                    }
                }
            }

            //Umesh: Issue 'Modal Popup issue in chrome' Starts
            ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "SaveMessage", "alert('Data Saved Successfully'); jQuery.modalDialog.getCurrent().close();", true);
            //Response.Write("<script type='text/javascript'>alert('Data Saved Successfully'); window.close();</script>");
            //Umesh: Issue 'Modal Popup issue in chrome' Ends
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, "ReportingOrFunctionalManager.aspx", "btnSave_Click", EventIDConstants.RAVE_HR_EMPLOYEE_BUSNIESS_LAYER);
        }
    }
    private void PopulateData()
    {
        try
        {
            BusinessEntities.Employee employee = new BusinessEntities.Employee();

            if (Request.QueryString["page"] != null && Request.QueryString["page"] == "employeesummary")
            {
                empId = ddlEmployeeList.SelectedItem.Value;
            }
            else
            {
                employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];
                empId    = employee.EMPId.ToString();
            }

            grdvListofReportingEmployees.Visible = true;
            Rave.HR.BusinessLayer.Employee.Employee addEmployeeBAL = new Rave.HR.BusinessLayer.Employee.Employee();
            AuthorizationManager authoriseduser = new AuthorizationManager();
            DataSet ds = new DataSet();
            ds = addEmployeeBAL.GetReportingFunctionalManagerIds(empId, objParameter);
            grdvListofReportingEmployees.DataSource = ds;
            grdvListofReportingEmployees.DataBind();

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count == 0)
                {
                    //btnSave.Visible = false;
                    imgFMSelectAll.Visible = false;
                    imgPMSelectAll.Visible = false;
                    lblFMName.Visible      = false;
                    lblPMName.Visible      = false;
                    txtFMName.Visible      = false;
                    txtRMName.Visible      = false;
                    //btnSave.Visible = false;
                    //btnReset.Visible = false;
                }
                else
                {
                    imgFMSelectAll.Visible = true;
                    imgPMSelectAll.Visible = true;
                    lblFMName.Visible      = true;
                    lblPMName.Visible      = true;
                    txtFMName.Visible      = true;
                    txtRMName.Visible      = true;
                    txtFMName.Enabled      = false;
                    txtRMName.Enabled      = false;
                    //btnSave.Visible = true;
                    //btnSave.Visible = true;
                    //btnReset.Visible = true;
                }
            }
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, "ReportingOrFunctionalManager.aspx", "PopulateData", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            throw objEx;
        }
    }
Esempio n. 20
0
    protected void lnkResumeTemplate_Click(object sender, EventArgs e)
    {
        int DeptId;
        //Issue : Different departments should have different CV template
        //Name : Poonam Starts
        DropDownList a = (DropDownList)this.Parent.FindControl("ddlDepartment");

        if (a != null)
        {
            DeptId = Convert.ToInt32(a.SelectedValue);
        }
        else if (Session["DeptId"] != null)
        {
            DeptId = Convert.ToInt32(Session["DeptId"]);
        }
        else
        {
            DeptId = 1;
        }

        if (DeptId == 16)
        {
            Response.Clear();
            Response.ContentType = "Application/msword";
            Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", "Rave CV template_BA.doc"));
            Response.Charset = "";
            Response.WriteFile(Server.MapPath(ResumeFormat + "Rave CV template_BA.doc"));
            Response.Flush();
            Response.End();
        }
        else if (DeptId == 17)
        {
            Response.Clear();
            Response.ContentType = "Application/msword";
            Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", "Resume Template_Usability.doc"));
            Response.Charset = "";
            Response.WriteFile(Server.MapPath(ResumeFormat + "Resume Template_Usability.doc"));
            Response.Flush();
            Response.End();
        }
        //Rakesh : Business Vertical Wise Resume Template Download 08/07/2016 Begin

        /*1805	Service Delivery
         * else if (DeptId == 1 && Session["BusinessVertical"].ToString().Contains(" Service Delivery"))                    */
        else if (DeptId == 1 && Session["BusinessVertical"].ToString() == "1805")
        {
            //Business Vertical Wise Resume Template Download  08/07/2016 End

            /*BusinessEntities.Employee employee = new BusinessEntities.Employee();
             * employee.EMPId = Convert.ToInt32(Session["EmpId"]);*/

            Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();

            int count = employeeBL.CheckEmployeeIsProjectManager(Convert.ToInt32(Session["EmpId"]));

            if (count != 0)
            {
                Response.Clear();
                Response.ContentType = "Application/msword";
                Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", "Rave CV template.doc"));
                Response.Charset = "";
                Response.WriteFile(Server.MapPath(ResumeFormat + "Rave CV template.doc"));
                Response.Flush();
                Response.End();
            }
            else
            {
                Response.Clear();
                Response.ContentType = "Application/msword";
                Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", "Rave CV template.doc"));
                Response.Charset = "";
                Response.WriteFile(Server.MapPath(ResumeFormat + "Resume template_Service Delivery.doc"));
                Response.Flush();
                Response.End();
            }
        }

        //Rakesh : Business Vertical Wise Resume Template Download 08/07/2016 Begin

        /* Procurement- 1939 ,NIS_NPS Finance & Accounting-1940
         *    else if (DeptId == 1 && (Session["BusinessVertical"].ToString().Contains("NIS_NPS Mumbai Procurement") || Session["BusinessVertical"].ToString().Contains("NIS_NPS Finance & Accounting - Mumbai"))) */
        else if (DeptId == 1 && (Session["BusinessVertical"].ToString() == "1939" || Session["BusinessVertical"].ToString() == "1940"))
        {
            // Rakesh : Business Vertical Wise Resume Template Download 08/07/2016 End

            Response.Clear();
            Response.ContentType = "Application/msword";
            Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", "Rave CV template.doc"));
            Response.Charset = "";
            Response.WriteFile(Server.MapPath(ResumeFormat + "Resume template_ESC_SharedServices.docx"));
            Response.Flush();
            Response.End();
        }
        else
        {
            Response.Clear();
            Response.ContentType = "Application/msword";
            Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", "Rave CV template.doc"));
            Response.Charset = "";
            Response.WriteFile(Server.MapPath(ResumeFormat + "Rave CV template.doc"));
            Response.Flush();
            Response.End();
        }
        //Ends
    }
    /// <summary>
    /// Handles the Click event of the btnSave control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (ValidateControls())
        {
            Rave.HR.BusinessLayer.Employee.VisaDetails objVisaDetailsBAL;
            //Rave.HR.BusinessLayer.Employee.Employee objEmployeeBAL;

            BusinessEntities.VisaDetails      objVisaDetails;
            BusinessEntities.RaveHRCollection objSaveVisaDetailsCollection = new BusinessEntities.RaveHRCollection();

            try
            {
                objEmployeeBAL = new Rave.HR.BusinessLayer.Employee.Employee();

                if (rbtnValidPassport.SelectedIndex == CommonConstants.ZERO)
                {
                    employee.PassportNo         = txtPassportNo.Text;
                    employee.PassportIssuePlace = txtIssuePlace.Text;
                    employee.PassportIssueDate  = Convert.ToDateTime(txtIssueDate.Text);
                    employee.PassportExpireDate = Convert.ToDateTime(txtExpiryDate.Text);

                    if (rbtnValidVisa.SelectedIndex == CommonConstants.ZERO)
                    {
                        objVisaDetailsBAL = new Rave.HR.BusinessLayer.Employee.VisaDetails();

                        if (gvVisaDetails.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                        {
                            for (int i = 0; i < gvVisaDetails.Rows.Count; i++)
                            {
                                objVisaDetails = new BusinessEntities.VisaDetails();

                                Label VisaId = (Label)gvVisaDetails.Rows[i].FindControl(VISAID);
                                Label Mode   = (Label)gvVisaDetails.Rows[i].FindControl(MODE);

                                objVisaDetails.VisaId      = int.Parse(VisaId.Text);
                                objVisaDetails.EMPId       = int.Parse(EMPId.Value);
                                objVisaDetails.CountryName = gvVisaDetails.Rows[i].Cells[0].Text;
                                objVisaDetails.VisaType    = gvVisaDetails.Rows[i].Cells[1].Text;
                                objVisaDetails.ExpiryDate  = Convert.ToDateTime(gvVisaDetails.Rows[i].Cells[2].Text);
                                objVisaDetails.Mode        = int.Parse(Mode.Text);
                                objSaveVisaDetailsCollection.Add(objVisaDetails);
                            }
                        }
                        BusinessEntities.RaveHRCollection objDeleteVisaDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[VISADETAILSDELETE];

                        if (objDeleteVisaDetailsCollection != null)
                        {
                            BusinessEntities.VisaDetails obj = null;

                            for (int i = 0; i < objDeleteVisaDetailsCollection.Count; i++)
                            {
                                objVisaDetails = new BusinessEntities.VisaDetails();
                                obj            = (BusinessEntities.VisaDetails)objDeleteVisaDetailsCollection.Item(i);

                                objVisaDetails.VisaId      = obj.VisaId;
                                objVisaDetails.EMPId       = obj.EMPId;
                                objVisaDetails.CountryName = obj.CountryName;
                                objVisaDetails.VisaType    = obj.VisaType;
                                objVisaDetails.ExpiryDate  = obj.ExpiryDate;
                                objVisaDetails.Mode        = obj.Mode;

                                objSaveVisaDetailsCollection.Add(objVisaDetails);
                            }
                        }
                    }
                    else
                    {
                        //delete visa details if exists.
                        objVisaDetailsBAL = new Rave.HR.BusinessLayer.Employee.VisaDetails();
                        objVisaDetailsBAL.DeleteVisaDetailsByEmpId(employeeID);
                    }
                }
                else
                {
                    employee.PassportNo         = string.Empty;
                    employee.PassportIssuePlace = string.Empty;
                    employee.PassportIssueDate  = DateTime.MinValue;
                    employee.PassportExpireDate = DateTime.MinValue;

                    //delete visa details if exists.
                    objVisaDetailsBAL = new Rave.HR.BusinessLayer.Employee.VisaDetails();
                    objVisaDetailsBAL.DeleteVisaDetailsByEmpId(employeeID);
                }
                Boolean Flag = false;
                objEmployeeBAL.UpdateEmployee(employee, Flag);

                objVisaDetailsBAL.Manipulation(objSaveVisaDetailsCollection);

                if (ViewState.Count > 0)
                {
                    ViewState.Clear();
                }

                //Refresh the grip after saving
                if (EMPId.Value != string.Empty)
                {
                    int empID = Convert.ToInt32(EMPId.Value);
                    //Refresh the grip after saving
                    this.PopulateGrid(empID);
                }

                lblMessage.Text = "Passport details saved successfully.";
            }
            catch (RaveHRException ex)
            {
                LogErrorMessage(ex);
            }
            catch (Exception ex)
            {
                RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnSave_Click", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER);
                LogErrorMessage(objEx);
            }
        }
    }
    /// <summary>
    /// Handles the Click event of the btnUpload control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        int    i;
        string fileExtension = System.IO.Path.GetExtension(fileResume.FileName).ToLower();

        if (ValidateControls())
        {
            char[] SPILITER_DOT = { '.' };
            Rave.HR.BusinessLayer.Employee.EmployeeResume objEmployeeResumeBAL;
            BusinessEntities.EmployeeResume objEmployeeResume = new BusinessEntities.EmployeeResume();
            objEmployeeResumeBAL = new Rave.HR.BusinessLayer.Employee.EmployeeResume();
            //string[] EmployeeArray = Convert.ToString(employee.EmailId.Replace("@rave-tech.com", "")).Split(SPILITER_DOT);

            objEmployeeResume.EMPId = employee.EMPId;
            string docName = "";

            //Googleconfigurable
            AuthorizationManager obj = new AuthorizationManager();
            docName = obj.GetUsernameBasedOnEmail(employee.EmailId);

            //if (employee.EmailId.ToLower().Trim().Contains("@rave-tech.com"))
            //{
            //    docName = employee.EmailId.ToLower().Replace("@rave-tech.com", "");
            //}
            //else
            //{
            //    docName = employee.EmailId.ToLower().Replace("@" + AuthorizationManagerConstants.NORTHGATEDOMAINEMAIL, "");
            //}
            objEmployeeResume.DocumentName = docName;

            //objEmployeeResume.DocumentName = employee.EmailId.Replace("@rave-tech.com", "");
            //GoogleMail
            //Googleconfigurable
            objEmployeeResume.ModifyDate = DateTime.Now;
            objEmployeeResume.ModifyBy   = obj.GetUsernameBasedOnEmail(UserRaveDomainId);
            //if (UserRaveDomainId != null && UserRaveDomainId.Contains("@rave-tech.co.in"))
            //{
            //    objEmployeeResume.ModifyBy = UserRaveDomainId.Replace("@rave-tech.co.in", "");
            //}
            //else if (UserRaveDomainId != null && UserRaveDomainId.ToLower().Contains("@" + AuthorizationManagerConstants.NORTHGATEDOMAIN))
            //{
            //    objEmployeeResume.ModifyBy = UserRaveDomainId.ToLower().Replace("@" + AuthorizationManagerConstants.NORTHGATEDOMAIN, "");
            //}

            objEmployeeResume.FileExtension = fileExtension;

            if (EmployeeResumeCollection == null)
            {
                EmployeeResumeCollection = new BusinessEntities.RaveHRCollection();
            }

            EmployeeResumeCollection.Add(objEmployeeResume);

            EmployeeResumeCollection = objEmployeeResumeBAL.AddEmployeeResumeDetails(objEmployeeResume);

            i = Convert.ToInt32(((BusinessEntities.EmployeeResume)(EmployeeResumeCollection.Item(0))).ResumeCount);

            if (gvEmployeeResume.Rows.Count > 1)
            {
                string OldDocumentName = ((System.Web.UI.WebControls.LinkButton)(gvEmployeeResume.Rows[1].FindControl("_lnkResume"))).Text;
                HfOldDocumentName.Value = OldDocumentName;
            }
            this.PopulateGrid(objEmployeeResume.EMPId);

            switch (i)
            {
            case 0:
                Upload(0, objEmployeeResume);
                break;

            case 1:
                Upload(1, objEmployeeResume);
                break;

            case 2:
                Upload(2, objEmployeeResume);
                break;
            }

            lblMessage.Text = "Employee Resume Uploaded successfully.";

            //Aarohi : Issue 30053(CR) : 22/12/2011 : Start
            //Send mail for Employee Resume Upload.
            Rave.HR.BusinessLayer.Employee.Employee employeeBL = new Rave.HR.BusinessLayer.Employee.Employee();
            employeeBL.SendUploadResumeMails(employee);
            //Aarohi : Issue 30053(CR) : 22/12/2011 : End
        }
    }
Esempio n. 23
0
    private void AddEmployeeData()
    {
        try
        {
            int    empID       = 0;
            bool   isExist     = false;
            string empCode     = string.Empty;
            string fullName    = string.Empty;
            string _userMailId = string.Empty;

            Rave.HR.BusinessLayer.Recruitment.Recruitment recruitmentBL = new Rave.HR.BusinessLayer.Recruitment.Recruitment();
            BusinessEntities.Recruitment            recruitment         = null;
            BusinessEntities.Employee               addEmployee         = new BusinessEntities.Employee();
            Rave.HR.BusinessLayer.Employee.Employee addEmployeeBAL      = new Rave.HR.BusinessLayer.Employee.Employee();

            addEmployee.Prefix     = Convert.ToInt32(ddlPrefix.SelectedItem.Value);
            addEmployee.EMPCode    = txtEmployeeCode.Text.Trim();
            addEmployee.FirstName  = txtFirstName.Text.Trim();
            addEmployee.MiddleName = txtMiddleName.Text.Trim();
            addEmployee.LastName   = txtLastName.Text.Trim();
            fullName            = txtFirstName.Text.Trim() + " " + txtLastName.Text.Trim();
            addEmployee.EmailId = txtEmailID.Text.Trim();
            addEmployee.GroupId = Convert.ToInt32(ddlDepartment.SelectedItem.Value);
            addEmployee.Band    = Convert.ToInt32(ddlBand.SelectedItem.Value);
            //addEmployee.JoiningDate = Convert.ToDateTime(txtJoiningDate.Text.Trim());
            addEmployee.JoiningDate   = Convert.ToDateTime(ucDatePicker.Text.Trim());
            addEmployee.StatusId      = (int)MasterEnum.EmployeeStatus.Active;
            addEmployee.DesignationId = Convert.ToInt32(ddlDesignation.SelectedItem.Value);
            addEmployee.EmailId       = txtEmailID.Text.Trim().ToLower();
            addEmployee.ReportingToId = hidReportingTo.Value.Trim().ToString();
            AuthorizationManager authoriseduser = new AuthorizationManager();
            string LoggedInUserMailId           = authoriseduser.getLoggedInUser();
            _userMailId = LoggedInUserMailId.Replace("co.in", "com");
            addEmployee.CreatedByMailId      = _userMailId;
            addEmployee.CreatedDate          = DateTime.Today;
            addEmployee.LastModifiedByMailId = _userMailId;
            addEmployee.LastModifiedDate     = DateTime.Today;
            addEmployee.Type        = Convert.ToInt32(ddlEmployeeType.SelectedItem.Value);
            addEmployee.CreatedDate = DateTime.Now;
            addEmployee.MRFId       = Convert.ToInt32(ddlMRFCode.SelectedItem.Value);
            string imgName = Path.GetFileName(imgEmp.ImageUrl);
            addEmployee.FileName = imgName;
            addEmployee.RelavantExperienceMonth = Convert.ToInt32(txtReleventMonths.Text);
            addEmployee.RelevantExperienceYear  = Convert.ToInt32(txtReleventYears.Text);
            addEmployee.ResourceBussinessUnit   = Convert.ToInt32(ddlResourceBussinesUnit.SelectedValue);
            addEmployee.ReportingToFMId         = Convert.ToInt32(hidReportingToFM.Value.Trim().ToString());
            addEmployee.Department   = Convert.ToString(ddlDepartment.SelectedItem);
            addEmployee.Designation  = Convert.ToString(ddlDesignation.SelectedItem);
            addEmployee.EmployeeType = Convert.ToString(ddlEmployeeType.SelectedItem);
            addEmployee.MRFcode      = ddlMRFCode.SelectedItem.Text;
            recruitment             = recruitmentBL.GetMrfDetailForEmployee(Convert.ToInt32(addEmployee.MRFId));
            addEmployee.Location    = recruitment.Location;
            addEmployee.EmpLocation = (ddlLocation.SelectedItem.Text).Trim().ToString();

            //going google Mahendra 26-Jun-2013
            addEmployee.WindowsUserName = txtWindowsUsername.Text.Trim().ToString();



            int dataCount = addEmployeeBAL.IsEmployeeDataExists(addEmployee);

            //Mohamed : Issue 41065 : 05/04/2013 : Starts
            //Desc :  "When X-Employee rejoin then its previous email id should be change and the same email id should be inserted" -- Code Changes in Sp
            //if (dataCount == 1)
            //{
            //    lblMessage.Text = "Emailid " + addEmployee.EmailId + " and Emplyee Code " + addEmployee.EMPCode + " already exists in the database.";
            //    return;
            //}
            //if (dataCount == 2)
            //{
            //    lblMessage.Text = "Emailid " + addEmployee.EmailId + " already exists in the database.";
            //    return;
            //}
            if (dataCount == 4)
            {
                lblMessage.Text = "Emailid " + addEmployee.EmailId + " is already assign to existing user.";
                return;
            }
            //Mohamed : Issue 41065 : 05/04/2013 : Ends
            if (dataCount == 3)
            {
                lblMessage.Text = "Employee Code " + addEmployee.EMPCode + " already exists in the database.";
                return;
            }

            empID = addEmployeeBAL.AddEmployee(addEmployee, ref empCode);
            if (empID > 0)
            {
                addEmployee.EMPId = empID;
                addEmployeeBAL.UpdateEmployeeMRFCode(addEmployee, (int)Common.MasterEnum.MRFStatus.PendingNewEmployeeAllocation);
            }
            else
            {
                return;
            }
            //--Get mailIds
            addEmployeeBAL.SendMailForAddEmployee(addEmployee);

            //for sending mail to the added employee to update his/her details
            //Only Rave domain employee should get this mail.
            //if (addEmployee.EmailId.Contains(RAVE_DOMAIN))
            if (addEmployee.EmployeeType != ONSITECONTRACT)
            {
                addEmployeeBAL.SendMailForAddEmployeeToUpdateDetails(addEmployee);
            }

            //Refreshing the data after inserting it.
            this.RefreshControls();

            lblConfirmationMessage.Text = "Employee: " + fullName + " added successfully with Employee Code: " + empCode;
            lblMessage.Text             = string.Empty;
            imgEmp.ImageUrl             = imagePath + BackSlash + NoImage;
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "AddEmployee", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }