Esempio n. 1
0
    /// <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)
    {
        if (ValidateVisaControls())
        {
            BusinessEntities.VisaDetails objVisaDetails = new BusinessEntities.VisaDetails();

            if (gvVisaDetails.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE)
            {
                VisaDetailsCollection.Clear();
            }
            objVisaDetails.CountryName = txtCountryName.Text;
            objVisaDetails.VisaType    = txtVisaType.Text;
            objVisaDetails.ExpiryDate  = Convert.ToDateTime(ucDatePickerVisaExpiryDate.Text);

            objVisaDetails.Mode = 1;

            VisaDetailsCollection.Add(objVisaDetails);

            this.DoDataBind();

            this.ClearControls();

            btnAddRow.Text         = CommonConstants.BTN_AddRow;
            HfIsDataModified.Value = CommonConstants.YES;
        }
    }
Esempio n. 2
0
 /// <summary>
 /// Handles the SelectedIndexChanged event of the rbtnValidVisa 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 rbtnValidVisa_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (rbtnValidVisa.SelectedItem.Text == CommonConstants.YES)
     {
         divVisaDetails.Visible = true;
         if (gvVisaDetails.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE)
         {
             VisaDetailsCollection.Clear();
             ShowHeaderWhenEmptyGrid();
         }
     }
     else
     {
         divVisaDetails.Visible = false;
     }
 }
Esempio n. 3
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();
    }