public void SourceObjectWithNullReference()
        {
            var employeeDto = new EmployeeDto
            {
                Title = "Man"
            };

            var employee = new Employee
            {
                ManagerID = 2,
                ContactID = 3,
                Title = "Developer",
                BirthDate = new DateTime(1965, 1, 1, 0, 0, 0),
                HireDate = DateTime.Now,
                Gender = "M",
                MaritalStatus = "M",
                ModifiedDate = DateTime.Now,
                NationalIDNumber = "2",
                rowguid = new Guid(),
                CurrentFlag = true,
                VacationHours = 2,
                SickLeaveHours = 3,
                SalariedFlag = false,
                LoginID = "adventure-works\\peter"
            };

            ITypeAdapter typeAdapter = new TypeAdapter();
            employee = typeAdapter.Transform(employeeDto, employee);

            Assert.NotNull(employee.Gender);
            Assert.Equal(employee.Title, employeeDto.Title);
        }
Example #2
0
    /// <summary>
    /// Event Handler for Update Command
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
    {
        if (e.Item is GridEditableItem)
        {
            GridEditableItem gei = e.Item as GridEditableItem;

            Dictionary <string, string> newValues = new Dictionary <string, string>();
            e.Item.OwnerTableView.ExtractValuesFromItem(newValues, gei);

            int _Id = (int)gei.GetDataKeyValue("Id");

            EmployeeDataContract edc = GetAppropriateDataObject();

            edc.Employees = (edc.Employees.Select(emp =>
            {
                if (emp.Id == _Id)
                {
                    emp = new BusinessEntities.Employee
                    {
                        Id = _Id,
                        Job = newValues["Job"].ToString(),
                        ManagerName = newValues["ManagerName"].ToString(),
                        Name = newValues["Name"].ToString(),
                        Salary = double.Parse(newValues["Salary"].ToString())
                    };
                }
                return(emp);
            })).ToList();

            Session["data"] = edc;
        }
    }
    private void BubbleControl_BubbleClick(object sender, EventArgs e)
    {
        try
        {
            //this.PopulateControls();

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

                lblempName.Text = employee.FirstName.ToUpper() + " " + employee.LastName.ToUpper();

                this.PopulateControls();
            }

            Session[Common.SessionNames.EMPLOYEEDETAILS] = employee;
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "BubbleControl_BubbleClick", EventIDConstants.RAVE_HR_CONTRACT_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
Example #4
0
    /// <summary>
    /// Handles the BubbleClick event of the BubbleControl 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>
    private void BubbleControl_BubbleClick(object sender, EventArgs e)
    {
        //this.PopulateControls();
        if (Session[SessionNames.EMPLOYEEDETAILS] != null)
        {
            employee = (BusinessEntities.Employee)Session[SessionNames.EMPLOYEEDETAILS];
            employee = this.GetEmployee(employee);

            lblempName.Text = employee.FirstName.ToUpper() + " " + employee.LastName.ToUpper();
            //this.PopulateGrid(employee.EMPId);

            this.PopulateControl();
            this.PopulateGrid(employee.EMPId);
        }

        //Ishwar: Issue Id - 54410 : 31122014 Start
        if (UserMailId.ToLower() != employee.EmailId.ToLower() && arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEPM))
        {
            btnEdit.Visible           = false;
            btnCancel.Visible         = true;
            btnSave.Visible           = false;
            btnAddRow.Visible         = false;
            rbtnValidPassport.Enabled = false;
            lblValidPassport.Enabled  = false;
        }
        //Ishwar: Issue Id - 54410 : 31122014 Ends

        Session[Common.SessionNames.EMPLOYEEDETAILS] = employee;
    }
  /// <summary>
  /// Converts the dto to entities.
  /// </summary>
  /// <param name="_EmployeeDto">The Employee dto</param>
  /// <param name="efEmployee">已存在的Employee EF model</param>
  /// <returns>Employee</returns>
 public Employee ConvertDtoToEntities(EmployeeDto _EmployeeDto, Employee efEmployee)
 {
      if (_EmployeeDto==null && efEmployee==null)
      {
           throw new ArgumentNullException("models should not be null");
      }
       ConvertObject(_EmployeeDto, efEmployee);
       return efEmployee;
 }
Example #6
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);
        }
    }
    public void AccessRightForEmployee()
    {
        AuthorizationManager objAuthMgr = new AuthorizationManager();



        if ((!Rave.HR.BusinessLayer.Employee.Employee.CheckDepartmentHeadbyEmailId(objAuthMgr.getLoggedInUserEmailId())) && (!EmployeeRoles.CheckRolesEmployeeSummaryAndProfile()))
        {
            SpanEmpSummary.Visible = false;
        }

        if (!EmployeeRoles.CheckRolesEmployee())
        {
            SpanAddEmployee.Visible = false;
        }

        // Ishwar - NISRMS - 30102014 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))
        {
            if (Employee.WindowsUserName.ToUpper() == strUserIdentity.ToUpper())
            {
                //Employee Profile false for EDC team members
                SpanEmployeeProfile.Visible = false;
            }
        }
        else
        {
            string strNISUsers = string.Empty;
            if (ConfigurationManager.AppSettings["NISReportsAccess"] != null)
            {
                strNISUsers = ConfigurationManager.AppSettings["NISReportsAccess"].ToString();
            }
            Common.AuthorizationManager.AuthorizationManager objAuth = new Common.AuthorizationManager.AuthorizationManager();
            if (!strNISUsers.Contains(objAuth.getLoggedInUser()))
            {
                spanSkillSearchReport.Visible      = false;
                spanHeadCountReport.Visible        = false;
                spanSkillSearchReport.Visible      = false;
                spanSkillReport.Visible            = false;
                spanConsolidated.Visible           = false;
                spanConsolidatedByCostCode.Visible = false;
                // Ishwar - NISRMS - 16022015 Start
                spanMRFAgingReport.Visible = false;
                spanMRFAgingForOpenPositionReport.Visible = false;
                // Ishwar - NISRMS - 16022015 End
            }
        }
        // Ishwar - NISRMS - 30102014 End
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
        HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
        HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
        HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
        HttpContext.Current.Response.Cache.SetNoStore();

        if (!ValidateURL())
        {
            Response.Redirect(CommonConstants.INVALIDURL, false);
        }
        else
        {
            employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];
            imgFMSelectAll.Attributes.Add("onclick", "return popUpFunctionalManagerSearch();");
            imgPMSelectAll.Attributes.Add("onclick", "return popUpEmployeeSearch();");


            if (!Page.IsPostBack)
            {
                if (Session[SessionNames.PREVIOUS_SORT_EXPRESSION_UPManger] == null)
                {
                    sortExpression = CommonConstants.EMPLOYEE_NAME;
                    Session[SessionNames.PREVIOUS_SORT_EXPRESSION_UPManger] = sortExpression;
                }
                else
                {
                    sortExpression = Session[SessionNames.PREVIOUS_SORT_EXPRESSION_UPManger].ToString();
                }

                if (Request.QueryString["page"] != null && Request.QueryString["page"] == "employeesummary")
                {
                    dataView.Visible          = false;
                    ddlEmployeeList.Visible   = true;
                    lblSelectEmployee.Visible = true;
                    lblSelectEmployee.Visible = true;
                    //btnReset.Visible = false;
                    //btnSave.Visible = false;
                }
                else
                {
                    dataView.Visible          = true;
                    ddlEmployeeList.Visible   = false;
                    lblSelectEmployee.Visible = false;
                    lblSelectEmployee.Visible = false;
                    SortGridView("EmployeeName", ASCENDING);
                    //btnReset.Visible = true;
                    //btnSave.Visible = true;
                }
                fillEmployeeDDL();
            }
        }

        //hidEMPId.Value = URL;
    }
          /// <summary>
          /// Converts the dto to entities.
          /// </summary>
          /// <param name="_ EmployeeDto">The  Employee dto.</param>
          /// <param name="ef Employee">已存的EntityFramework实体 ef Employee</param>
          /// <param name="skipNullPropertyValue">if set to <c>true</c> [skip null property value].</param>
          /// <returns>Employee</returns>
        public Employee ConvertDtoToEntities(EmployeeDto _EmployeeDto, Employee efEmployee, bool skipNullPropertyValue)
        {
               if (_EmployeeDto==null && efEmployee==null)
               {
                    throw new ArgumentNullException("models should not be null");
               }
 
              ConvertObjectWithCheckNull(_EmployeeDto, skipNullPropertyValue, efEmployee);
              return efEmployee;
        }
Example #10
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 BubbleClick event of the BubbleControl 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>
    private void BubbleControl_BubbleClick(object sender, EventArgs e)
    {
        int i = 0;

        //this.PopulateControls();
        if (Session[SessionNames.EMPLOYEEDETAILS] != null)
        {
            employee = (BusinessEntities.Employee)Session[SessionNames.EMPLOYEEDETAILS];
            employee = this.GetEmployee(employee);

            lblempName.Text = employee.FirstName.ToUpper() + " " + employee.LastName.ToUpper();
            //To solved the issue no 19221
            //Comment by Rahul P
            //Start
            this.ClearControls();
            i = this.PopulateGrid(employee.EMPId);
        }

        if (i == 0)
        {
            Certificationdetails.Enabled = true;
            btnEdit.Visible       = false;
            btnEditCancel.Visible = false;
            btnCancel.Visible     = true;
            btnAddRow.Visible     = true;
            btnUpdate.Visible     = false;
            btnCancelRow.Visible  = false;
        }
        else
        {
            Certificationdetails.Enabled = false;
            btnEdit.Visible       = true;
            btnEditCancel.Visible = true;
            btnCancel.Visible     = false;
            btnAddRow.Visible     = false;
            btnUpdate.Visible     = false;
            btnCancelRow.Visible  = false;
        }
        //End
        //Ishwar: Issue Id - 54410 : 31122014 Start
        if (UserMailId.ToLower() != employee.EmailId.ToLower() && arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEPM))
        {
            btnEdit.Visible              = false;
            btnUpdate.Visible            = false;
            btnCancel.Visible            = false;
            btnAddRow.Visible            = false;
            btnEditCancel.Visible        = true;
            Certificationdetails.Enabled = false;
        }
        //Ishwar: Issue Id - 54410 : 31122014 Ends
        Session[Common.SessionNames.EMPLOYEEDETAILS] = employee;
    }
Example #12
0
    /// <summary>
    /// get allocated resource by projectId
    /// </summary>
    public RaveHRCollection GetAllocatedResourceByProjectId()
    {
        try
        {
            objDAResourcePlan = new DataAccessClass();
            objDAResourcePlan.OpenConnection(ConfigurationManager.ConnectionStrings["RaveHRConnectionString"].ConnectionString);
            objReader = objDAResourcePlan.ExecuteReaderSP("USP_ResourcePlan_GetPracticeTeamAllocationDetails");
            RaveHRCollection objListGetResourcePlan = new RaveHRCollection();

            BusinessEntities.Employee objBEEmployee = null;
            while (objReader.Read())
            {
                objBEEmployee             = new BusinessEntities.Employee();
                objBEEmployee.FullName    = objReader["EmployeeName"].ToString();
                objBEEmployee.Designation = objReader["Designation"].ToString();
                objBEEmployee.Department  = objReader["ResourceBU"].ToString();
                objBEEmployee.ProjectName = objReader["ProjectName"].ToString();
                string str  = objReader["NoOfDaysBilled"].ToString();
                string str1 = objReader["NoOfDaysUtilized"].ToString();
                objBEEmployee.NoOfDaysBilled        = double.Parse(objReader["NoOfDaysBilled"].ToString());
                objBEEmployee.NoOfDaysUtilised      = double.Parse(objReader["NoOfDaysUtilized"].ToString());
                objBEEmployee.TotalNoOfDaysBilled   = double.Parse(objReader["TotalNoOfDaysBilled"].ToString());
                objBEEmployee.TotalNoOfDaysUtilised = double.Parse(objReader["TotalNoOfDaysUtilised"].ToString());

                objListGetResourcePlan.Add(objBEEmployee);
            }

            //--
            return(objListGetResourcePlan);
        }
        //catches genral exception
        catch (Exception ex)
        {
            throw ex;
        }
        //close datareader and connection
        finally
        {
            //checks if datareader is null
            if (objReader != null)
            {
                //close datareader
                objReader.Close();
            }

            //close connection
            objDAResourcePlan.CloseConncetion();
        }
    }
    /// <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)
    {
        //clearing the text
        lblMessage.Text = string.Empty;

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

        // 34617-Ambar-Start-20062012
        // Check whether it is called for specific employee if yes then proceed with that employee profile
        if (Request.QueryString[CommonConstants.EMP_ID] != null)
        {
            Session[SessionNames.EMPLOYEEDETAILS] = null;
            employee.EMPId = Convert.ToInt32(DecryptQueryString(QueryStringConstants.EMPID).ToString());
            employee       = this.GetEmployee(employee);
            Session[SessionNames.EMPLOYEEDETAILS] = employee;
            //btnRelease.Attributes["onclick"] = "popUpEmployeeReleasePopulate('" + employee.EMPId + "')";
        }
        // 34617-Ambar-End-20062012

        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)
        {
            Session[SessionNames.PAGEMODE] = Common.MasterEnum.PageModeEnum.View;
            this.PopulateGrid(employeeID);
        }

        // Get logged-in user's email id
        AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();

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

        SavedControlVirtualPath = "~/EmployeeMenuUC.ascx";
        ReloadControl();
    }
    /// <summary>
    /// Handles the BubbleClick event of the BubbleControl 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>
    private void BubbleControl_BubbleClick(object sender, EventArgs e)
    {
        int i = 0;

        //this.PopulateControls();
        if (Session[SessionNames.EMPLOYEEDETAILS] != null)
        {
            employee        = (BusinessEntities.Employee)Session[SessionNames.EMPLOYEEDETAILS];
            employee        = this.GetEmployee(employee);
            lblempName.Text = employee.FirstName.ToUpper() + " " + employee.LastName.ToUpper();
            this.PopulateGrid(employee.EMPId);
        }

        Session[Common.SessionNames.EMPLOYEEDETAILS] = employee;
    }
    /// <summary>
    /// Handles the BubbleClick event of the BubbleControl 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>
    private void BubbleControl_BubbleClick(object sender, EventArgs e)
    {
        //this.PopulateControls();
        if (Session[SessionNames.EMPLOYEEDETAILS] != null)
        {
            employee = (BusinessEntities.Employee)Session[SessionNames.EMPLOYEEDETAILS];
            employee = this.GetEmployee(employee);

            lblempName.Text = employee.FirstName.ToUpper() + " " + employee.LastName.ToUpper();

            employeeID  = employee.EMPId;
            EMPId.Value = employeeID.ToString().Trim();
            this.PopulateControl();
        }
        //To solved issue id 19221
        //Coded by Rahul P
        //Start
        if (!IsDataSaved)
        {
            Otherdetails.Enabled = true;
            btnEdit.Visible      = false;
            btnSave.Visible      = true;
        }
        else
        {
            Otherdetails.Enabled = false;
            btnEdit.Visible      = true;
            btnSave.Visible      = false;
        }
        //End

        //Ishwar: Issue Id - 54410 : 05012015 Start
        if (UserMailId.ToLower() != employee.EmailId.ToLower() && arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEPM))
        {
            btnEdit.Visible      = false;
            btnCancel.Visible    = true;
            btnSave.Visible      = false;
            Otherdetails.Enabled = false;
        }
        //Ishwar: Issue Id - 54410 : 05012015 Ends

        Session[Common.SessionNames.EMPLOYEEDETAILS] = employee;
    }
 /// <summary>
 /// The create new employee.
 /// </summary>
 /// <returns>
 /// </returns>
 public Employee CreateNewEmployee()
 {
     var employee = new Employee
         {
             ManagerID = 2, 
             ContactID = 3, 
             Title = "Developer", 
             BirthDate = new DateTime(1965, 1, 1, 0, 0, 0), 
             HireDate = DateTime.Now, 
             Gender = "M", 
             MaritalStatus = "M", 
             ModifiedDate = DateTime.Now, 
             NationalIDNumber = "2", 
             rowguid = new Guid(), 
             CurrentFlag = true, 
             VacationHours = 2, 
             SickLeaveHours = 3, 
             SalariedFlag = false, 
             LoginID = "adventure-works\\peter"
         };
     return employee;
 }
    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>
        /// Deletes the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
		public void Delete(Employee entity)
		{
			Repository.Delete(entity);
		}
Example #19
0
    /// <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)
    {
        //Clearing the error label
        lblError.Text   = string.Empty;
        lblMessage.Text = string.Empty;

        btnAddRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
        btnUpdate.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
        btnSave.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return SaveButtonClickValidate();");

        txtName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtName.ClientID + "','" + imgName.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPACE + "');");
        imgName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanName.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanName.ClientID + "');");

        txtTotalScore.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtTotalScore.ClientID + "','" + imgTotalScore.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgTotalScore.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanTotalScore.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgTotalScore.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanTotalScore.ClientID + "');");

        txtOutOf.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtOutOf.ClientID + "','" + imgOutOf.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgOutOf.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanOutOf.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgOutOf.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanOutOf.ClientID + "');");

        txtCertificationDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + txtCertificationDate.ClientID + "','','');");
        txtCertificationDate.Attributes.Add(ReadOnly, ReadOnly);
        txtCertficationValidDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + txtCertficationValidDate.ClientID + "','','');");
        txtCertficationValidDate.Attributes.Add(ReadOnly, ReadOnly);
        //imgCertificationDate.Attributes.Add(CommonConstants.EVENT_ONMOUSEOVER, "javascript:ValidateControl('" + imgCertificationDate.ClientID + "','','');");
        //imgCertficationValidDate.Attributes.Add(CommonConstants.EVENT_ONMOUSEOVER, "javascript:ValidateControl('" + imgCertficationValidDate.ClientID + "','','');");

        if (!ValidateURL())
        {
            Response.Redirect(CommonConstants.INVALIDURL, false);
        }
        else
        {
            if (Session[Common.SessionNames.EMPLOYEEDETAILS] != null)
            {
                employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];
            }

            if (employee != null)
            {
                employeeID = employee.EMPId;
            }

            if (!IsPostBack)
            {
                this.PopulateGrid(employeeID);
            }

            // Get logged-in user's email id
            AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();
            UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
            UserMailId       = UserRaveDomainId.Replace("co.in", "com");


            if (Session[SessionNames.PAGEMODE] != null)
            {
                string PageMode = Session[SessionNames.PAGEMODE].ToString();
                arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());

                if (UserMailId.ToLower() == employee.EmailId.ToLower())
                {
                    if (arrRolesForUser.Count > 0)
                    {
                        if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString())
                        {
                            Certificationdetails.Enabled = true;
                            btnCancel.Visible            = true;
                            if (gvCertification.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                            {
                                btnSave.Visible = true;
                            }
                        }
                        else
                        {
                            Certificationdetails.Enabled = false;
                            btnSave.Visible   = false;
                            btnCancel.Visible = false;
                        }
                    }
                }
                else
                {
                    if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString() && arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
                    {
                        Certificationdetails.Enabled = true;
                        btnCancel.Visible            = true;
                        if (gvCertification.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                        {
                            btnSave.Visible = true;
                        }
                    }
                    else
                    {
                        Certificationdetails.Enabled = false;
                        btnSave.Visible   = false;
                        btnCancel.Visible = false;
                    }
                }
            }
        }
    }
		 /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
		public void Add(Employee entity)
		{
			Repository.Add(entity);
		}
    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;
        }
    }
    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);
        }
    }
    /// <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
        {
            if (!ValidateURL())
            {
                Response.Redirect(CommonConstants.INVALIDURL, false);
            }
            else
            {
                //Clearing the error label
                lblError.Text   = string.Empty;
                lblMessage.Text = string.Empty;

                btnAddRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
                btnUpdate.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
                btnSave.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return SaveButtonClickValidate();");

                txtYearsOfExperience.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtYearsOfExperience.ClientID + "','" + imgYearsOfExperience.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
                imgYearsOfExperience.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanYearsOfExperience.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
                imgYearsOfExperience.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanYearsOfExperience.ClientID + "');");

                txtLastUsedDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + txtLastUsedDate.ClientID + "','','');");
                txtLastUsedDate.Attributes.Add(ReadOnly, ReadOnly);

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

                if (employee != null)
                {
                    employeeID = employee.EMPId;
                }

                if (!IsPostBack)
                {
                    this.PopulateGrid(employeeID);
                    this.GetSkillTypes();
                    this.GetSkillsByType(0);
                    this.GetProficiencyLevel();
                }

                // Get logged-in user's email id
                AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();
                UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
                UserMailId       = UserRaveDomainId.Replace("co.in", "com");


                if (Session[SessionNames.PAGEMODE] != null)
                {
                    string PageMode = Session[SessionNames.PAGEMODE].ToString();
                    arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());

                    if (UserMailId.ToLower() == employee.EmailId.ToLower())
                    {
                        if (arrRolesForUser.Count > 0)
                        {
                            if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString())
                            {
                                Skillsdetails.Enabled = true;
                                btnCancel.Visible     = true;
                                SkillTypeRow.Disabled = false;
                                if (gvSkills.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                                {
                                    btnSave.Visible = true;
                                }
                            }
                            else
                            {
                                Skillsdetails.Enabled = false;
                                btnSave.Visible       = false;
                                btnCancel.Visible     = false;
                                SkillTypeRow.Disabled = true;
                            }
                        }
                    }
                    else
                    {
                        if (arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
                        {
                            if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString())
                            {
                                Skillsdetails.Enabled = true;
                                btnCancel.Visible     = true;
                                SkillTypeRow.Disabled = false;
                                if (gvSkills.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                                {
                                    btnSave.Visible = true;
                                }
                            }
                            else
                            {
                                Skillsdetails.Enabled = false;
                                btnSave.Visible       = false;
                                btnCancel.Visible     = false;
                                SkillTypeRow.Disabled = true;
                            }
                        }
                        else
                        {
                            if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString())
                            {
                                Skillsdetails.Enabled        = true;
                                btnCancel.Visible            = true;
                                SkillTypeRow.Disabled        = true;
                                ddlSkills.Enabled            = false;
                                txtLastUsedDate.Enabled      = false;
                                txtYearsOfExperience.Enabled = false;
                                imgLastUsedDate.Enabled      = false;

                                for (int i = 0; i < gvSkills.Rows.Count; i++)
                                {
                                    ImageButton ibtnDelete = (ImageButton)gvSkills.Rows[i].FindControl(IBTNDELETE);
                                    ibtnDelete.Enabled = false;
                                }
                                if (gvSkills.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                                {
                                    btnSave.Visible = true;
                                }
                            }
                            else
                            {
                                Skillsdetails.Enabled = false;
                                btnSave.Visible       = false;
                                btnCancel.Visible     = false;
                                SkillTypeRow.Disabled = true;
                            }
                        }
                    }
                }
            }
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "Page_Load", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
        public void TestAttachEmploeeAndUpdateIt()
        {
            var ebo = ServiceFactory.GetInstance<IEmployeeBusinessObject>();
            var employee = new Employee { EmployeeID = 2 };

            ebo.AttachEmployee(employee);

            employee.Title = "modified";
            ebo.UpdateEmployee(employee);

            Employee entity = ebo.GetEmployee(employee.EmployeeID);

            Assert.NotNull(entity);
            Assert.Equal(employee.Title, entity.Title);
        }
 public EmployeeDto ConvertEntitiesToDto(Employee _Employee)
 {
     return new EmployeeDto();
 }
 public Employee ConvertDtoToEntities(EmployeeDto _EmployeeDto, Employee efEmployee, bool skipNullPropertyValue)
 {
     return new 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)
    {
        //Clearing the error label
        lblError.Text   = string.Empty;
        lblMessage.Text = string.Empty;

        btnAddRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");

        btnSave.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return SaveButtonClickValidate();");


        txtCountryName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtCountryName.ClientID + "','" + imgCountryName.ClientID + "','" + Common.CommonConstants.VALIDATE_ISALPHABET + "');");
        imgCountryName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanCountryName.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgCountryName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanCountryName.ClientID + "');");

        txtVisaType.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtVisaType.ClientID + "','" + imgVisaType.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPACE + "');");
        imgVisaType.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanVisaType.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgVisaType.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanVisaType.ClientID + "');");

        txtExpiryDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + txtExpiryDate.ClientID + "','','');");
        txtExpiryDate.Attributes.Add(ReadOnly, ReadOnly);
        txtVisaExpiryDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + txtVisaExpiryDate.ClientID + "','','');");
        txtVisaExpiryDate.Attributes.Add(ReadOnly, ReadOnly);
        txtIssueDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + txtIssueDate.ClientID + "','','');");
        txtIssueDate.Attributes.Add(ReadOnly, ReadOnly);

        txtPassportNo.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtPassportNo.ClientID + "','" + imgPassportNo.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHA_NUMERIC_FUNCTION + "');");
        imgPassportNo.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanPassportNo.ClientID + "','" + Common.CommonConstants.MSG_ALPHA_NUMERIC + "');");
        imgPassportNo.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanPassportNo.ClientID + "');");

        txtIssuePlace.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtIssuePlace.ClientID + "','" + imgIssuePlace.ClientID + "','" + Common.CommonConstants.VALIDATE_ISALPHABET + "');");
        imgIssuePlace.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanIssuePlace.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgIssuePlace.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanIssuePlace.ClientID + "');");

        if (!ValidateURL())
        {
            Response.Redirect(CommonConstants.INVALIDURL, false);
        }
        else
        {
            if (Session[Common.SessionNames.EMPLOYEEDETAILS] != null)
            {
                employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];
            }

            if (employee != null)
            {
                employeeID = employee.EMPId;
            }

            if (!IsPostBack)
            {
                this.PopulateControl();
                this.PopulateGrid(employeeID);
            }

            // Get logged-in user's email id
            AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();
            UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
            UserMailId       = UserRaveDomainId.Replace("co.in", "com");


            if (Session[SessionNames.PAGEMODE] != null)
            {
                PageMode        = Session[SessionNames.PAGEMODE].ToString();
                arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());

                if (UserMailId.ToLower() == employee.EmailId.ToLower())
                {
                    if (arrRolesForUser.Count > 0)
                    {
                        if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString())
                        {
                            passportdetails.Enabled   = true;
                            visaDetails.Enabled       = true;
                            rbtnValidPassport.Enabled = true;
                            lblValidPassport.Enabled  = true;
                            if (rbtnValidPassport.SelectedIndex == CommonConstants.ZERO)
                            {
                                btnSave.Visible   = true;
                                btnCancel.Visible = true;
                            }
                        }
                        else
                        {
                            passportdetails.Enabled   = false;
                            visaDetails.Enabled       = false;
                            rbtnValidPassport.Enabled = false;
                            lblValidPassport.Enabled  = false;
                        }
                    }
                }
                else
                {
                    if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString() && arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
                    {
                        passportdetails.Enabled   = true;
                        visaDetails.Enabled       = true;
                        rbtnValidPassport.Enabled = true;
                        lblValidPassport.Enabled  = true;
                        if (rbtnValidPassport.SelectedIndex == CommonConstants.ZERO)
                        {
                            btnSave.Visible   = true;
                            btnCancel.Visible = true;
                        }
                    }
                    else
                    {
                        passportdetails.Enabled   = false;
                        visaDetails.Enabled       = false;
                        rbtnValidPassport.Enabled = false;
                        lblValidPassport.Enabled  = false;
                    }
                }
            }
        }
    }
    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);
        }
    }
    /// <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)
    {
        //Clearing the error label
        lblError.Text   = string.Empty;
        lblMessage.Text = string.Empty;

        btnAddRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
        btnUpdateRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");

        txtCourseName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtCourseName.ClientID + "','" + imgCourseName.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPACE + "');");
        imgCourseName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanCourseName.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgCourseName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanCourseName.ClientID + "');");

        txtInstituteName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtInstituteName.ClientID + "','" + imgInstituteName.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPECIALCHAR + "');");
        imgInstituteName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanInstituteName.ClientID + "','" + Common.CommonConstants.MSG_ALPHABET_SPECIALCHAR + "');");
        imgInstituteName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanInstituteName.ClientID + "');");

        txtYearofPassing.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtYearofPassing.ClientID + "','" + imgYearofPassing.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgYearofPassing.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanYearofPassing.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgYearofPassing.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanYearofPassing.ClientID + "');");

        imgScore.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanScore.ClientID + "','" + Common.CommonConstants.MSG_ALPHA_NUMERIC + "');");
        imgScore.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanScore.ClientID + "');");

        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)
        {
            Session[SessionNames.PAGEMODE] = Common.MasterEnum.PageModeEnum.View;
            this.PopulateGrid(employeeID);
        }

        if (gvProfessionalCourses.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE)
        {
            ProfessionalDetailsCollection.Clear();
            ShowHeaderWhenEmptyGrid();
        }

        // Get logged-in user's email id
        AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();

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

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

        if (UserMailId.ToLower() == employee.EmailId.ToLower() || arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
        {
            if (Session[SessionNames.PAGEMODE] != null)
            {
                PageMode = Session[SessionNames.PAGEMODE].ToString();

                if (PageMode == Common.MasterEnum.PageModeEnum.View.ToString() && IsPostBack == false && gvProfessionalCourses.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                {
                    Professionaldetails.Enabled = false;
                    btnEdit.Visible             = true;
                    btnEditCancel.Visible       = true;
                    btnCancel.Visible           = false;
                    btnAddRow.Visible           = false;

                    if (gvProfessionalCourses.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                    {
                        //Enabling all the edit buttons.
                        for (int i = 0; i < gvProfessionalCourses.Rows.Count; i++)
                        {
                            ImageButton btnImgEdit = (ImageButton)gvProfessionalCourses.Rows[i].FindControl(IMGBTNEDIT);
                            btnImgEdit.Enabled = false;
                            ImageButton btnImgDelete = (ImageButton)gvProfessionalCourses.Rows[i].FindControl(IMGBTNDELETE);
                            btnImgDelete.Enabled = false;
                        }
                    }
                }
            }
        }
        else
        {
            Professionaldetails.Enabled = false;
        }

        SavedControlVirtualPath = "~/EmployeeMenuUC.ascx";
        ReloadControl();
    }
 public void TestEmployeeRepositoryDelete(Employee _Employee)
 {
     var _EmployeeRepository = RepositoryHelper.GetEmployeeRepository();
    _EmployeeRepository.Repository.Delete(_Employee);
    _EmployeeRepository.Save();
 }
 public void TestEmployeeRepositoryAdd(Employee _Employee)
 {
     var _EmployeeRepository = RepositoryHelper.GetEmployeeRepository();
     _EmployeeRepository.Add(_Employee);
     _EmployeeRepository.Save();
 }
 /// <summary>
 /// The create employee.
 /// </summary>
 /// <param name="employee">
 /// The employee.
 /// </param>
 /// <returns>
 /// The create employee.
 /// </returns>
 public bool CreateEmployee(Employee employee)
 {
     return this.ebo.CreateEmployee(employee);
 }
 /// <summary>
 /// Dels the employee.
 /// </summary>
 /// <param name="employee">
 /// The employee.
 /// </param>
 /// <returns>
 /// The del employee.
 /// </returns>
 public bool DelEmployee(Employee employee)
 {
     this.employeeRepository.Delete(employee);
     this.employeeRepository.Save();
     return true;
 }
 /// <summary>
 /// The del employee.
 /// </summary>
 /// <param name="employee">
 /// The employee.
 /// </param>
 /// <returns>
 /// The del employee.
 /// </returns>
 public bool DelEmployee(Employee employee)
 {
     this.ebo.AttachEmployee(employee);
     return this.ebo.DelEmployee(employee);
 }
    /// <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;
    }
Example #36
0
    /// <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)
    {
        //Clearing the error label
        lblError.Text   = string.Empty;
        lblMessage.Text = string.Empty;

        btnAddRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
        btnUpdate.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
        btnSave.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return SaveButtonClickValidate();");

        ddlLocation.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + spanzLocation.ClientID + "','','');");
        imgLocation.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanLocation.ClientID + "','" + Common.CommonConstants.MSG_ALPHA_NUMERIC + "');");
        imgLocation.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanLocation.ClientID + "');");

        txtCompanyName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtCompanyName.ClientID + "','" + imgCompanyName.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPECIALCHAR + "');");
        imgCompanyName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanCompanyName.ClientID + "','" + Common.CommonConstants.MSG_ALPHABET_SPECIALCHAR + "');");
        imgCompanyName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanCompanyName.ClientID + "');");

        txtProjectName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtProjectName.ClientID + "','" + imgProjectName.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPECIALCHAR + "');");
        imgProjectName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanProjectName.ClientID + "','" + Common.CommonConstants.MSG_ALPHABET_SPECIALCHAR + "');");
        imgProjectName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanProjectName.ClientID + "');");

        txtClientName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtClientName.ClientID + "','" + imgClientName.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPECIALCHAR + "');");
        imgClientName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanClientName.ClientID + "','" + Common.CommonConstants.MSG_ALPHABET_SPECIALCHAR + "');");
        imgClientName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanClientName.ClientID + "');");

        txtDuration.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtDuration.ClientID + "','" + imgDuration.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgDuration.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanDuration.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgDuration.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanDuration.ClientID + "');");

        txtProjectSiZe.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtProjectSiZe.ClientID + "','" + imgProjectSize.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgProjectSize.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanProjectSize.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgProjectSize.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanProjectSize.ClientID + "');");

        txtProjectDescription.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return MultiLineTextBox('" + txtProjectDescription.ClientID + "','" + txtProjectDescription.MaxLength + "','" + imgProjectDescription.ClientID + "');");
        imgProjectDescription.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanProjectDescription.ClientID + "','" + Common.CommonConstants.MSG_ALPHA_NUMERIC + "');");
        imgProjectDescription.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanProjectDescription.ClientID + "');");

        txtRole.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtRole.ClientID + "','" + imgRole.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPACE + "');");
        imgRole.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanRole.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgRole.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanRole.ClientID + "');");

        txtResponsibility.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return MultiLineTextBox('" + txtResponsibility.ClientID + "','" + txtResponsibility.MaxLength + "','" + imgResponsibility.ClientID + "');");
        imgResponsibility.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanResponsibility.ClientID + "','" + Common.CommonConstants.MSG_ALPHA_NUMERIC + "');");
        imgResponsibility.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanResponsibility.ClientID + "');");

        if (!ValidateURL())
        {
            Response.Redirect(CommonConstants.INVALIDURL, false);
        }
        else
        {
            if (Session[Common.SessionNames.EMPLOYEEDETAILS] != null)
            {
                employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];
            }

            if (employee != null)
            {
                employeeID = employee.EMPId;
            }

            if (!IsPostBack)
            {
                this.PopulateGrid(employeeID);
                this.GetLocation();
                this.GetBifurcation();
            }

            if (gvProjectDetails.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE)
            {
                ProjectDetailsCollection.Clear();
                ShowHeaderWhenEmptyGrid();
            }

            // Get logged-in user's email id
            AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();
            UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
            UserMailId       = UserRaveDomainId.Replace("co.in", "com");


            if (Session[SessionNames.PAGEMODE] != null)
            {
                string PageMode = Session[SessionNames.PAGEMODE].ToString();
                arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());

                if (UserMailId.ToLower() == employee.EmailId.ToLower())
                {
                    if (arrRolesForUser.Count > 0)
                    {
                        if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString())
                        {
                            Projectdetails.Enabled = true;
                            btnCancel.Visible      = true;
                            if (gvProjectDetails.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                            {
                                btnSave.Visible = true;
                            }
                        }
                        else
                        {
                            Projectdetails.Enabled = false;
                            btnSave.Visible        = false;
                            btnCancel.Visible      = false;
                        }
                    }
                }
                else
                {
                    if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString() && arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
                    {
                        Projectdetails.Enabled = true;
                        btnCancel.Visible      = true;
                        if (gvProjectDetails.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                        {
                            btnSave.Visible = true;
                        }
                    }
                    else
                    {
                        Projectdetails.Enabled = false;
                        btnSave.Visible        = false;
                        btnCancel.Visible      = false;
                    }
                }
            }
        }
    }
Example #37
0
    /// <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)
    {
        //Clearing the error label
        lblError.Text   = string.Empty;
        lblMessage.Text = string.Empty;

        btnAddRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");

        btnSave.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return SaveButtonClickValidate();");


        txtCountryName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtCountryName.ClientID + "','" + imgCountryName.ClientID + "','" + Common.CommonConstants.VALIDATE_ISALPHABET + "');");
        imgCountryName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanCountryName.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgCountryName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanCountryName.ClientID + "');");

        txtVisaType.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtVisaType.ClientID + "','" + imgVisaType.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPACE + "');");
        imgVisaType.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanVisaType.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgVisaType.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanVisaType.ClientID + "');");

        ucDatePickerExpiryDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + ucDatePickerExpiryDate.ClientID + "','','');");
        ucDatePickerExpiryDate.Attributes.Add(ReadOnly, ReadOnly);
        ucDatePickerVisaExpiryDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + ucDatePickerVisaExpiryDate.ClientID + "','','');");
        ucDatePickerVisaExpiryDate.Attributes.Add(ReadOnly, ReadOnly);
        ucDatePickerIssueDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + ucDatePickerIssueDate.ClientID + "','','');");
        ucDatePickerIssueDate.Attributes.Add(ReadOnly, ReadOnly);

        txtPassportNo.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtPassportNo.ClientID + "','" + imgPassportNo.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHA_NUMERIC_FUNCTION + "');");

        //CR - 28321 -  Passport Application Number Sachin  - Start
        txtPassportAppNo.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtPassportNo.ClientID + "','" + imgPassportNo.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHA_NUMERIC_FUNCTION + "');");
        //CR - 28321 -  Passport Application Number Sachin  - End

        //txtPassportNo.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return Max_Length1();");
        //imgPassportNo.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanPassportNo.ClientID + "','" + Common.CommonConstants.MSG_ALPHA_NUMERIC + "');");
        //imgPassportNo.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanPassportNo.ClientID + "');");

        txtIssuePlace.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtIssuePlace.ClientID + "','" + imgIssuePlace.ClientID + "','" + Common.CommonConstants.VALIDATE_ISALPHABET + "');");
        imgIssuePlace.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanIssuePlace.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgIssuePlace.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanIssuePlace.ClientID + "');");

        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)
        {
            Session[SessionNames.PAGEMODE] = Common.MasterEnum.PageModeEnum.View;
            this.PopulateControl();
            this.PopulateGrid(employeeID);
        }

        if (gvVisaDetails.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE)
        {
            VisaDetailsCollection.Clear();
            ShowHeaderWhenEmptyGrid();
        }

        // Get logged-in user's email id
        AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();

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

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

        if (UserMailId.ToLower() == employee.EmailId.ToLower() || arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
        {
            if (Session[SessionNames.PAGEMODE] != null)
            {
                PageMode = Session[SessionNames.PAGEMODE].ToString();

                if (PageMode == Common.MasterEnum.PageModeEnum.View.ToString() && IsPostBack == false)
                {
                    if (!string.IsNullOrEmpty(txtPassportNo.Text))
                    {
                        passportdetails.Enabled   = false;
                        visaDetails.Enabled       = false;
                        rbtnValidPassport.Enabled = false;
                        lblValidPassport.Enabled  = false;
                        btnEdit.Visible           = true;
                        btnSave.Visible           = false;
                    }
                    else
                    {
                        passportdetails.Enabled   = true;
                        visaDetails.Enabled       = true;
                        rbtnValidPassport.Enabled = true;
                        lblValidPassport.Enabled  = true;
                        btnEdit.Visible           = false;
                        btnSave.Visible           = true;
                    }
                }
            }
        }
        else
        {
            passportdetails.Enabled   = false;
            btnEdit.Visible           = false;
            btnCancel.Visible         = false;
            btnAddRow.Visible         = false;
            visaDetails.Enabled       = false;
            btnSave.Visible           = false;
            rbtnValidPassport.Enabled = false;
            lblValidPassport.Enabled  = false;
        }

        SavedControlVirtualPath = "~/EmployeeMenuUC.ascx";
        ReloadControl();
    }
 public void TestBODeleteEmployeeWithAttachEmployee()
 {
     var ebo = ServiceFactory.GetInstance<IEmployeeBusinessObject>();
     var existemployee = new Employee { EmployeeID = 344 };
     ebo.AttachEmployee(existemployee);
     ebo.DelEmployee(existemployee);
 }
 /// <summary>
 /// Creates the employee.
 /// </summary>
 /// <param name="employee">
 /// The employee.
 /// </param>
 /// <returns>
 /// The create employee.
 /// </returns>
 public bool CreateEmployee(Employee employee)
 {
     this.employeeRepository.Add(employee);
     this.employeeRepository.Save();
     return true;
 }
Example #40
0
    /// <summary>
    /// Function will use to enable or disable previous or next Buttons
    /// </summary>
    /// <param name="currentIndex"></param>
    /// <param name="PreviousIndex"></param>
    /// <param name="NextIndex"></param>
    private void EnableDisableButtons(int currentIndex, int PreviousIndex, int NextIndex)
    {
        try
        {
            Hashtable ht = new Hashtable();
            if (Session[SessionNames.EMPLOYEEVIEWINDEX] != null)
            {
                //27633-Subhra-start
                //ht = (Hashtable)Session[SessionNames.EMPLOYEEVIEWINDEX];
                ht = (Hashtable)Session[SessionNames.EMPPREVIOUSHASHTABLE];
                // 27633-Subhra-end


                if (ht.Contains(PreviousIndex) == true)
                {
                    btnPrevious.Enabled = true;
                }
                else
                {
                    btnPrevious.Enabled = false;
                }

                if (ht.Contains(NextIndex) == true)
                {
                    btnNext.Enabled = true;
                }
                else
                {
                    btnNext.Enabled = false;
                }

                if (ht.Contains(currentIndex) == true)
                {
                    string empID = Convert.ToString(ht[currentIndex]);
                    //globalEmpId = empID;
                    EMPLOYEEID = empID;
                    BusinessEntities.Employee emp = new BusinessEntities.Employee();
                    emp.EMPId = Convert.ToInt32(empID);
                    Session[SessionNames.EMPLOYEEDETAILS] = emp;
                    //this.GetEmployee(emp);
                    //this.PopulateControls();

                    //if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString())
                    //{
                    //    btnEdit.Visible = false;
                    //}

                    //CopyMRFDetail(Convert.ToInt32(ht[currentIndex]));
                }
            }
            //To solved the issue no 19221
            //Comment by Rahul P
            //Start
            //Check the Create session variable and check
            //if they differ than change the session variale to view
            if (Session[SessionNames.PREVIOUS_EMP] != null)
            {
                if (Session[SessionNames.PREVIOUS_EMP].ToString() != Convert.ToString(ht[currentIndex]))
                {
                    Session[SessionNames.PAGEMODE] = "View";
                }
            }
            //End
        }
        //catch (RaveHRException ex)
        //{
        //    throw ex;
        //}
        catch (Exception ex)
        {
            //RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "EnableDisableButtons", EventIDConstants.RAVE_HR_MRF_PRESENTATION_LAYER);
            //LogErrorMessage(objEx);
        }
    }
 public Employee ConvertDtoToEntities(EmployeeDto _EmployeeDto, Employee efEmployee)
 {
     return new Employee();
 }
        public void TransformEmployeeToDTO()
        {
            var adapter = new EmployeeAdapter();
            var employee = new Employee()
            {
                EmployeeID = 1,
                LoginID = "petter",
                ContactID = 12,
                Contact = new Contact() { FirstName = "Peter" },
                EmployeePayHistories = new List<EmployeePayHistory>()
                 {
                    new EmployeePayHistory()
                    {
                        EmployeeID = 1,
                        ModifiedDate = DateTime.Now
                    }
                 }
            };
            var dto = adapter.Transform<Employee, EmployeeDto>(employee);

            Assert.Equal(employee.EmployeeID, dto.EmployeeID);
            Assert.Equal(employee.LoginID, dto.LoginID);
        }
 private static void ConvertObject(EmployeeDto _EmployeeDto, Employee efEmployee)
 {
     efEmployee.EmployeeID=_EmployeeDto.EmployeeID; 
        efEmployee.NationalIDNumber=_EmployeeDto.NationalIDNumber; 
        efEmployee.ContactID=_EmployeeDto.ContactID; 
        efEmployee.LoginID=_EmployeeDto.LoginID; 
        efEmployee.ManagerID=_EmployeeDto.ManagerID; 
        efEmployee.Title=_EmployeeDto.Title; 
        efEmployee.BirthDate=_EmployeeDto.BirthDate; 
        efEmployee.MaritalStatus=_EmployeeDto.MaritalStatus; 
        efEmployee.Gender=_EmployeeDto.Gender; 
        efEmployee.HireDate=_EmployeeDto.HireDate; 
        efEmployee.SalariedFlag=_EmployeeDto.SalariedFlag; 
        efEmployee.VacationHours=_EmployeeDto.VacationHours; 
        efEmployee.SickLeaveHours=_EmployeeDto.SickLeaveHours; 
        efEmployee.CurrentFlag=_EmployeeDto.CurrentFlag; 
        efEmployee.rowguid=_EmployeeDto.rowguid; 
        efEmployee.ModifiedDate=_EmployeeDto.ModifiedDate; 
    }
Example #44
0
    /// <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)
    {
        if (!ValidateURL())
        {
            Response.Redirect(CommonConstants.INVALIDURL, false);
        }
        else
        {
            //Clearing the error label
            lblError.Text   = string.Empty;
            lblMessage.Text = string.Empty;

            txtNoRelocationIndiaReason.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return MultiLineTextBox('" + txtNoRelocationIndiaReason.ClientID + "','" + txtNoRelocationIndiaReason.MaxLength + "','" + imgNoRelocationIndiaReason.ClientID + "');");
            imgNoRelocationIndiaReason.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanNoRelocationIndiaReason.ClientID + "','" + Common.CommonConstants.MSG_ALPHA_NUMERIC + "');");
            imgNoRelocationIndiaReason.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanNoRelocationIndiaReason.ClientID + "');");

            txtNoRelocationOtherCountryReason.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return MultiLineTextBox('" + txtNoRelocationOtherCountryReason.ClientID + "','" + txtNoRelocationOtherCountryReason.MaxLength + "','" + imgNoRelocationOtherCountryReason.ClientID + "');");
            imgNoRelocationOtherCountryReason.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanNoRelocationOtherCountryReason.ClientID + "','" + Common.CommonConstants.MSG_ALPHA_NUMERIC + "');");
            imgNoRelocationOtherCountryReason.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanNoRelocationOtherCountryReason.ClientID + "');");

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

            if (employee != null)
            {
                employeeID = employee.EMPId;
            }

            if (!IsPostBack)
            {
                this.PopulateControl();
            }

            // Get logged-in user's email id
            AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();
            UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
            UserMailId       = UserRaveDomainId.Replace("co.in", "com");


            if (Session[SessionNames.PAGEMODE] != null)
            {
                string PageMode = Session[SessionNames.PAGEMODE].ToString();
                arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());

                if (UserMailId.ToLower() == employee.EmailId.ToLower())
                {
                    if (arrRolesForUser.Count > 0)
                    {
                        if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString())
                        {
                            Otherdetails.Enabled = true;
                            btnSave.Visible      = true;
                            btnCancel.Visible    = true;
                        }
                        else
                        {
                            Otherdetails.Enabled = false;
                            btnSave.Visible      = false;
                            btnCancel.Visible    = false;
                        }
                    }
                }
                else
                {
                    if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString() && arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
                    {
                        Otherdetails.Enabled = true;
                        btnSave.Visible      = true;
                        btnCancel.Visible    = true;
                    }
                    else
                    {
                        Otherdetails.Enabled = false;
                        btnSave.Visible      = false;
                        btnCancel.Visible    = false;
                    }
                }
            }
        }
    }
        public void TestCreate()
        {
            using (var webservice = CreateRESTHttpService())
            {
                var client = new HttpClient();
                client.BaseAddress = webservice.BaseUri;

                // Builds: http://localhost:20259/RESTEmployeeService.svc/Create

                var uri = webservice.Uri("Create");

                var employee = new Employee()
                {
                    ContactID = 1,
                    ManagerID = 23,
                    Title = "Engineer",
                    BirthDate = DateTime.Now.AddYears(-23),
                    Gender = "1",
                    CurrentFlag = false,
                    HireDate = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    NationalIDNumber = "32323"
                };

                var httpcontent = new FormUrlEncodedContent(GetEntityToListKeyValuePair(employee));
                var response = client.Post(uri, httpcontent);

                Assert.True(response.IsSuccessStatusCode, response.ToString());
                Assert.True(response.Content.ReadAsString().Contains("true"));
            }
        }
		 /// <summary>
        /// Attaches the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
		public void Attach(Employee entity)
		{
		    Repository.Attach(entity);
		}
        /// <summary>
        /// Gets the entity to list key value pair.
        /// </summary>
        /// <param name="employee">The employee.</param>
        /// <returns></returns>
        private List<KeyValuePair<string, string>> GetEntityToListKeyValuePair(Employee employee)
        {
            var keyvalus = new List<KeyValuePair<string, string>>();

            foreach (var po in
             employee.GetType().GetProperties())
            {
                var rr = po.GetValue(employee, null);

                if (rr != null)
                {
                    //parse datatime and guid and bool type has some issue
                    if (!rr.ToString().Contains('/') && !rr.ToString().Contains('-') && !rr.ToString().Contains("False"))
                    {
                        keyvalus.Add(new KeyValuePair<string, string>(po.Name, rr.ToString()));
                        Console.WriteLine("{0}:  {1}", po.Name, rr);
                    }


                }
            }

            return keyvalus;
        }
 /// <summary>
 /// The update employee.
 /// </summary>
 /// <param name="employee">
 /// The employee.
 /// </param>
 /// <returns>
 /// The update employee.
 /// </returns>
 public bool UpdateEmployee(Employee employee)
 {
     return this.ebo.UpdateEmployeeByAttachEntity(employee);
 }
        /// <summary>
        /// Converts the entities to dto.
       /// </summary>
       /// <param name="_Employee">The Employee entity</param>
       /// <returns>EmployeeDto</returns>
      public EmployeeDto ConvertEntitiesToDto(Employee  _Employee)
     {
           if (_Employee==null)
           {
                    throw new ArgumentNullException("models should not be null");
           }
 
          var _EmployeeDto =new EmployeeDto();
                      _EmployeeDto.EmployeeID=_Employee.EmployeeID; 
               _EmployeeDto.NationalIDNumber=_Employee.NationalIDNumber; 
               _EmployeeDto.ContactID=_Employee.ContactID; 
               _EmployeeDto.LoginID=_Employee.LoginID; 
               _EmployeeDto.ManagerID=_Employee.ManagerID; 
               _EmployeeDto.Title=_Employee.Title; 
               _EmployeeDto.BirthDate=_Employee.BirthDate; 
               _EmployeeDto.MaritalStatus=_Employee.MaritalStatus; 
               _EmployeeDto.Gender=_Employee.Gender; 
               _EmployeeDto.HireDate=_Employee.HireDate; 
               _EmployeeDto.SalariedFlag=_Employee.SalariedFlag; 
               _EmployeeDto.VacationHours=_Employee.VacationHours; 
               _EmployeeDto.SickLeaveHours=_Employee.SickLeaveHours; 
               _EmployeeDto.CurrentFlag=_Employee.CurrentFlag; 
               _EmployeeDto.rowguid=_Employee.rowguid; 
               _EmployeeDto.ModifiedDate=_Employee.ModifiedDate; 
              return _EmployeeDto;
     }
 /// <summary>
 /// The create employee 2.
 /// </summary>
 /// <param name="employee">
 /// The employee.
 /// </param>
 /// <returns>
 /// The create employee 2.
 /// </returns>
 public int CreateEmployee2(Employee employee)
 {
     this.ebo.CreateEmployee(employee);
     return employee.EmployeeID;
 }
    /// <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)
    {
        //Clearing the error label
        lblError.Text   = string.Empty;
        lblMessage.Text = string.Empty;

        btnAddRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
        btnUpdateRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
        btnSave.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return SaveButtonClickValidate();");

        ddlQualification.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + spanzQualification.ClientID + "','','');");
        imgQualification.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanQualification.ClientID + "','" + Common.CommonConstants.MSG_ALPHA_NUMERIC + "');");
        imgQualification.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanQualification.ClientID + "');");

        txtUniversityName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtUniversityName.ClientID + "','" + imgUniversityName.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPECIALCHAR + "');");
        imgUniversityName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanUniversityName.ClientID + "','" + Common.CommonConstants.MSG_ALPHABET_SPECIALCHAR + "');");
        imgUniversityName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanUniversityName.ClientID + "');");

        txtInstituteName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtInstituteName.ClientID + "','" + imgInstituteName.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPECIALCHAR + "');");
        imgInstituteName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanInstituteName.ClientID + "','" + Common.CommonConstants.MSG_ALPHABET_SPECIALCHAR + "');");
        imgInstituteName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanInstituteName.ClientID + "');");

        txtYearOfPassing.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtYearOfPassing.ClientID + "','" + imgYearOfPassing.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgYearOfPassing.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanYearOfPassing.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgYearOfPassing.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanYearOfPassing.ClientID + "');");

        txtGPA.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtGPA.ClientID + "','" + imgGPA.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgGPA.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanGPA.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgGPA.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanGPA.ClientID + "');");

        txtOutOf.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtOutOf.ClientID + "','" + imgOutOf.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgOutOf.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanOutOf.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgOutOf.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanOutOf.ClientID + "');");

        txtPercentage.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtPercentage.ClientID + "','" + imgPercentage.ClientID + "','" + "Decimal" + "');");
        imgPercentage.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanPercentage.ClientID + "','" + Common.CommonConstants.MSG_DECIMAL + "');");
        imgPercentage.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanPercentage.ClientID + "');");

        if (!ValidateURL())
        {
            Response.Redirect(CommonConstants.INVALIDURL, false);
        }
        else
        {
            if (Session[Common.SessionNames.EMPLOYEEDETAILS] != null)
            {
                employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];
            }

            if (employee != null)
            {
                employeeID = employee.EMPId;
            }

            if (!IsPostBack)
            {
                this.PopulateGrid(employeeID);
                this.GetQualifications();
            }

            // Get logged-in user's email id
            AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();
            UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
            UserMailId       = UserRaveDomainId.Replace("co.in", "com");


            if (Session[SessionNames.PAGEMODE] != null)
            {
                string PageMode = Session[SessionNames.PAGEMODE].ToString();
                arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());

                if (UserMailId.ToLower() == employee.EmailId.ToLower())
                {
                    if (arrRolesForUser.Count > 0)
                    {
                        if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString())
                        {
                            Qualificationdetails.Enabled = true;
                            btnCancel.Visible            = true;
                            if (gvQualification.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                            {
                                btnSave.Visible = true;
                            }
                        }
                        else
                        {
                            Qualificationdetails.Enabled = false;
                            btnSave.Visible   = false;
                            btnCancel.Visible = false;
                        }
                    }
                }
                else
                {
                    if (PageMode == Common.MasterEnum.PageModeEnum.Edit.ToString() && arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
                    {
                        Qualificationdetails.Enabled = true;
                        btnCancel.Visible            = true;
                        if (gvQualification.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                        {
                            btnSave.Visible = true;
                        }
                    }
                    else
                    {
                        Qualificationdetails.Enabled = false;
                        btnSave.Visible   = false;
                        btnCancel.Visible = false;
                    }
                }
            }
        }
    }
    /// <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);
        }
    }
        private void BOLayerInsertInvaildFKValueAriseUpdateException()
        {
            var employee = new Employee
            {
                // invaild FK value
                ManagerID = 999,
                ContactID = 3,
                Title = "Developer",
                BirthDate = new DateTime(1965, 1, 1, 0, 0, 0),
                HireDate = DateTime.Now,
                Gender = "M",
                MaritalStatus = "M",
                ModifiedDate = DateTime.Now,
                NationalIDNumber = "2",
                rowguid = new Guid(),
                CurrentFlag = true,
                VacationHours = 2,
                SickLeaveHours = 3,
                SalariedFlag = false,
                LoginID = "adventure-works\\peter"
            };

            var ebo = ServiceFactory.GetInstance<IEmployeeBusinessObject>();

            // By default,have a exception logging files ErrorRolling.log due to arise an exception at bin folder
            ebo.CreateEmployee(employee);

            string loggingfilefullpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ErrorRolling.log");
            Assert.True(File.Exists(loggingfilefullpath));
        }
 /// <summary>
 /// Updates the employee.
 /// </summary>
 /// <param name="employee">
 /// The employee.
 /// </param>
 /// <returns>
 /// The update employee.
 /// </returns>
 public bool UpdateEmployee(Employee employee)
 {
     //To avoid this error when update record
     // "The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value. The statement has been terminated."
     // exec sp_executesql N'update [HumanResources].[Employee]
     employee.ModifiedDate = System.DateTime.Now;
     employee.rowguid = System.Guid.NewGuid();
     this.employeeRepository.Save();
     return true;
 }
   private static void ConvertObjectWithCheckNull(EmployeeDto _EmployeeDto, bool skipNullPropertyValue, Employee efEmployee)
   {
        efEmployee.EmployeeID=_EmployeeDto.EmployeeID;
   
        if (!skipNullPropertyValue ||  _EmployeeDto.NationalIDNumber != null) {efEmployee.NationalIDNumber=_EmployeeDto.NationalIDNumber; }
           efEmployee.ContactID=_EmployeeDto.ContactID;
   
        if (!skipNullPropertyValue ||  _EmployeeDto.LoginID != null) {efEmployee.LoginID=_EmployeeDto.LoginID; }
           efEmployee.ManagerID=_EmployeeDto.ManagerID;
   
        if (!skipNullPropertyValue ||  _EmployeeDto.Title != null) {efEmployee.Title=_EmployeeDto.Title; }
           efEmployee.BirthDate=_EmployeeDto.BirthDate;
   
        if (!skipNullPropertyValue ||  _EmployeeDto.MaritalStatus != null) {efEmployee.MaritalStatus=_EmployeeDto.MaritalStatus; }
 
        if (!skipNullPropertyValue ||  _EmployeeDto.Gender != null) {efEmployee.Gender=_EmployeeDto.Gender; }
           efEmployee.HireDate=_EmployeeDto.HireDate;
             efEmployee.SalariedFlag=_EmployeeDto.SalariedFlag;
             efEmployee.VacationHours=_EmployeeDto.VacationHours;
             efEmployee.SickLeaveHours=_EmployeeDto.SickLeaveHours;
             efEmployee.CurrentFlag=_EmployeeDto.CurrentFlag;
             efEmployee.rowguid=_EmployeeDto.rowguid;
             efEmployee.ModifiedDate=_EmployeeDto.ModifiedDate;
  
     }
    /// <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>
        /// Updates the employee 
        /// </summary>
        /// <param name="employee">
        /// The employee.
        /// </param>
        /// <returns>
        /// The update employee 2.
        /// </returns>
        /// <remarks>
        /// For WCF,because wcf cannot persistent ef4 objectcontext
        /// we also need change entity state then save it. Reference book 'Programming Entity framework 4'
        /// </remarks>
        public bool UpdateEmployeeByAttachEntity(Employee employee)
        {
            IObjectContext context = RepositoryHelper.GetDbContext();
            IUnitOfWork uow = RepositoryHelper.GetUnitOfWork(context);
            EmployeeRepository employRepository = RepositoryHelper.GetEmployeeRepository(context);

            employRepository.Attach(employee);
            employee.rowguid = System.Guid.NewGuid();
            employee.State = State.Modified;
            //To avoid this error when update record
            // "The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value. The statement has been terminated."
            // exec sp_executesql N'update [HumanResources].[Employee]
            employee.ModifiedDate = System.DateTime.Now;
            context.ChangeObjectState(employee, StateHelpers.GetEquivalentEntityState(employee.State));
            uow.Save();

            return true;
        }