/// <summary> /// Handles the Click event of the btnAdd 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 btnAdd_Click(object sender, EventArgs e) { Rave.HR.BusinessLayer.Employee.ProfessionalDetails objProfessionalDetailsBAL; if (ValidateControls()) { BusinessEntities.ProfessionalDetails objProfessionalDetails = new BusinessEntities.ProfessionalDetails(); objProfessionalDetailsBAL = new Rave.HR.BusinessLayer.Employee.ProfessionalDetails(); if (gvProfessionalCourses.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE) { ProfessionalDetailsCollection.Clear(); } // 26864-Ambar-Start // Code to accept only one decimal point bool is_decimal_point = false; string str_current_char = null, strScore = txtScore.Text; if ((strScore != string.Empty) || (strScore != null) || (strScore != "")) { for (int i = 0; i < txtScore.Text.Length; i++) { str_current_char = strScore.Substring(i, 1); if ((str_current_char == ".")) { if (is_decimal_point) { lblMessage.Text = "<font color=RED>" + "Percentage can contain only one decimal point." + "</font>"; return; } else { is_decimal_point = true; } } } } // 26864-Ambar-End objProfessionalDetails.CourseName = txtCourseName.Text; objProfessionalDetails.InstitutionName = txtInstituteName.Text; objProfessionalDetails.PassingYear = txtYearofPassing.Text; objProfessionalDetails.Score = txtScore.Text; objProfessionalDetails.EMPId = int.Parse(EMPId.Value); objProfessionalDetails.Mode = 1; ProfessionalDetailsCollection.Add(objProfessionalDetails); objProfessionalDetailsBAL.AddProfessionalDetails(objProfessionalDetails); this.PopulateGrid(objProfessionalDetails.EMPId); this.ClearControls(); lblMessage.Text = "Professional Courses saved successfully."; } }
/// <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(); }