Example #1
0
    /// <summary>
    /// btnOk_Click Event Handler
    /// </summary>
    protected void btnOk_Click(object sender, EventArgs e)
    {
        try
        {
            int         selected = (int)ViewState[SELECTED_ROW];
            GridViewRow dr       = grdvListofInternalResource.Rows[selected];
            if (Session[SessionNames.MRFDetail] != null)
            {
                mrfDetail = (MRFDetail)Session[SessionNames.MRFDetail];
                Label lblEmpId = (Label)dr.Cells[0].FindControl("lblEmployeeId");
                mrfDetail.EmployeeId   = Convert.ToInt32(lblEmpId.Text);
                mrfDetail.EmployeeName = dr.Cells[2].Text.ToString();

                Rave.HR.BusinessLayer.MRF.MRFDetail objMrfDetail = new Rave.HR.BusinessLayer.MRF.MRFDetail();
                int EmpExist = objMrfDetail.GetEmployeeExistCheck(mrfDetail);
                if (EmpExist != 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "SelectAnotherResourceJS",
                                                            "alert('Please Select another resource as " + mrfDetail.EmployeeName + " is already allocated to this project.');", true);
                }
                else
                {
                    Session[SessionNames.MRFDetail]        = mrfDetail;
                    Session[SessionNames.InternalResource] = mrfDetail;
                    //Aarohi : Issue 31826 : 16/12/2011 : Start
                    Session[SessionNames.RESOURCE_JOINED] = mrfDetail.EmployeeName;

                    HiddenField hdJoinigDate = (HiddenField)dr.Cells[0].FindControl("hdEmpJoinigDay");
                    mrfDetail.EmployeeJoiningDate = Convert.ToDateTime(hdJoinigDate.Value);

                    //Aarohi : Issue 31826 : 16/12/2011 : End
                    ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "CloseJS",
                                                            "jQuery.modalDialog.getCurrent().close();", true);
                }
            }
        }
        //catches RaveHRException exception
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnOk_Click", EventIDConstants.RAVE_HR_MRF_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }