protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        if (!_authority.HasPermission(Permission.CanManagePayroll, _payrollItem.OrganizationId, -1, Authorization.Flag.ExactOrganization))
        {
            ScriptManager.RegisterStartupScript(this, Page.GetType(), "getlost",
                                                "alert ('You do not have access to change payroll records.');", true);
            return;
        }

        if (!Page.IsValid)
        {
            return;
        }

        string description         = this.TextDescription.Text;
        string amount              = this.TextAmount.Text;
        PayrollAdjustmentType type = (PayrollAdjustmentType)Int32.Parse(this.DropType.SelectedValue);

        amount = amount.Replace(",", ".");  // compensate for cultures

        double adjustmentAmount;

        bool success = Double.TryParse(amount, NumberStyles.Any, CultureInfo.InvariantCulture, out adjustmentAmount);

        if (!success)
        {
            ScriptManager.RegisterStartupScript(this, Page.GetType(), "getlost",
                                                "alert ('Unable to parse the amount.');", true);
            return;
        }

        PayrollAdjustment.Create(_payrollItem, type, adjustmentAmount, description);

        this.TextDescription.Text   = string.Empty;
        this.TextAmount.Text        = string.Empty;
        this.DropType.SelectedIndex = 0;

        PopulateGrid();
    }