/// <summary>
    /// Sets data to database.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check input values from textboxes and other contrlos
        string errorMessage = new Validator()
                              .NotEmpty(txtPaymentOptionDisplayName.Text.Trim(), GetString("paymentoption_edit.errorEmptyDisplayName"))
                              .NotEmpty(txtPaymentOptionName.Text.Trim(), GetString("paymentoption_edit.errorEmptyCodeName")).Result;

        if (!ValidationHelper.IsCodeName(txtPaymentOptionName.Text.Trim()))
        {
            errorMessage = GetString("General.ErrorCodeNameInIdentifierFormat");
        }

        if (errorMessage == "")
        {
            // PaymentOptionName must be unique
            PaymentOptionInfo paymentOptionObj = null;
            string            siteWhere        = (mSiteId > 0) ? " AND (PaymentOptionSiteID = " + mSiteId + " OR PaymentOptionSiteID IS NULL)" : "";
            DataSet           ds = PaymentOptionInfoProvider.GetPaymentOptions("PaymentOptionName = '" + txtPaymentOptionName.Text.Trim().Replace("'", "''") + "'" + siteWhere, null, 1, null);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                paymentOptionObj = new PaymentOptionInfo(ds.Tables[0].Rows[0]);
            }

            if ((paymentOptionObj == null) || (paymentOptionObj.PaymentOptionID == mPaymentOptionId))
            {
                // Get the object
                if (paymentOptionObj == null)
                {
                    paymentOptionObj = PaymentOptionInfoProvider.GetPaymentOptionInfo(mPaymentOptionId);
                    if (paymentOptionObj == null)
                    {
                        paymentOptionObj = new PaymentOptionInfo();
                        paymentOptionObj.PaymentOptionSiteID = mSiteId;
                    }
                }

                // Fill object
                paymentOptionObj.PaymentOptionID                     = mPaymentOptionId;
                paymentOptionObj.PaymentOptionDisplayName            = txtPaymentOptionDisplayName.Text.Trim();
                paymentOptionObj.PaymentOptionDescription            = txtDescription.Text.Trim();
                paymentOptionObj.PaymentOptionName                   = txtPaymentOptionName.Text.Trim();
                paymentOptionObj.PaymentOptionEnabled                = chkPaymentOptionEnabled.Checked;
                paymentOptionObj.PaymentOptionPaymentGateUrl         = txtGateUrl.Text.Trim();
                paymentOptionObj.PaymentOptionClassName              = txtPaymentClassName.Text.Trim();
                paymentOptionObj.PaymentOptionAssemblyName           = txtPaymentAssemblyName.Text.Trim();
                paymentOptionObj.PaymentOptionSucceededOrderStatusID = succeededElem.OrderStatusID;
                paymentOptionObj.PaymentOptionFailedOrderStatusID    = failedElem.OrderStatusID;
                paymentOptionObj.PaymentOptionAllowIfNoShipping      = chkAllowIfNoShipping.Checked;

                CheckConfigurationModification(paymentOptionObj.PaymentOptionSiteID);

                bool isNew = (paymentOptionObj.PaymentOptionID <= 0);

                PaymentOptionInfoProvider.SetPaymentOptionInfo(paymentOptionObj);

                // Upload image teaser
                if (isNew)
                {
                    file.ObjectID = paymentOptionObj.PaymentOptionID;
                    file.UploadFile();
                }

                URLHelper.Redirect("PaymentOption_Edit.aspx?paymentOptionId=" + Convert.ToString(paymentOptionObj.PaymentOptionID) + "&saved=1&siteId=" + SiteID);
            }
            else
            {
                // Show error message
                ShowError(GetString("PaymentOption_Edit.PaymentOptionNameExists"));
            }
        }
        else
        {
            // Show error message
            ShowError(errorMessage);
        }
    }