예제 #1
0
 private void SelectItemInDropDown(DropDownList list, CommonSettingsManager.SettingsNames value)
 {
     SettingsDto.CommonSettingsRow[] rows = (SettingsDto.CommonSettingsRow[])_SettingsDto.CommonSettings.Select(String.Format("Name='{0}'", value));
     if (rows != null && rows.Length > 0)
     {
         ManagementHelper.SelectListItemIgnoreCase(list, rows[0].Value);
     }
 }
예제 #2
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, System.EventArgs e)
        {
            if (!this.IsPostBack)
            {
                if (_PaymentMethodDto != null && _PaymentMethodDto.PaymentMethodParameter != null)
                {
                    PaymentMethodDto.PaymentMethodParameterRow param = null;
                    param = GetParameterByName(_GatewayParameterName);
                    if (param != null && !String.IsNullOrEmpty(param.Value))
                    {
                        ManagementHelper.SelectListItemIgnoreCase(Gateways, param.Value);
                    }

                    BindData();
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        /// <param name="reset">if set to <c>true</c> [reset].</param>
        private void BindForm(bool reset)
        {
            if (SaleTypeFilter.Items.Count == 0)
            {
                BindSaleTypesList();
            }
            if (CurrencyFilter.Items.Count == 0)
            {
                BindCurrenciesList();
                // select default currency
                ManagementHelper.SelectListItemIgnoreCase(CurrencyFilter, _CatalogCurrency);
            }

            if (String.IsNullOrEmpty(SelectedSaleTypeField.Value))
            {
                SelectedSaleTypeField.Value = SaleTypeFilter.SelectedValue;
            }

            if (String.IsNullOrEmpty(SelectedCurrencyField.Value))
            {
                SelectedCurrencyField.Value = CurrencyFilter.SelectedValue;
            }

            CatalogEntryDto.SalePriceRow selectedSalePriceRow = null;
            if (SalePriceId != 0)
            {
                selectedSalePriceRow = _CatalogEntryDto.SalePrice.FindBySalePriceId(SalePriceId);
            }

            if (selectedSalePriceRow != null)
            {
                if (reset)
                {
                    SetFormFieldsValues(selectedSalePriceRow.SaleCode,
                                        selectedSalePriceRow.UnitPrice,
                                        selectedSalePriceRow.MinQuantity,
                                        selectedSalePriceRow.StartDate,
                                        selectedSalePriceRow.EndDate,
                                        selectedSalePriceRow.SaleType,
                                        selectedSalePriceRow.Currency);
                }

                ManagementHelper.SelectListItem2(SaleTypeFilter, selectedSalePriceRow.SaleType);
                ManagementHelper.SelectListItem2(CurrencyFilter, selectedSalePriceRow.Currency);
            }
            else if (reset)
            {
                if (_CatalogEntryDto != null)
                {
                    SetFormFieldsValues("",
                                        0m,
                                        0m,
                                        DateTime.UtcNow,
                                        DateTime.UtcNow.AddYears(1),
                                        -1, _CatalogCurrency);
                }
                else
                {
                    SetFormFieldsValues("", 0m, 0m, DateTime.UtcNow, DateTime.UtcNow.AddYears(1), -1, _CatalogCurrency);
                }

                ManagementHelper.SelectListItem2(CurrencyFilter, _CatalogCurrency);
            }
        }
예제 #4
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        public void BindData()
        {
            GenericTable.Rows.Clear();
            Gateway gateway = GetGateways().GetGatewayById(Gateways.SelectedValue);

            if (gateway == null)
            {
                GenericTable.Visible = false;
                return;
            }
            else
            {
                GenericTable.Visible = true;
            }

            TransactionTypeList.Items.Clear();
            foreach (TransactionType type in gateway.TransactionTypes)
            {
                TransactionTypeList.Items.Add(new ListItem(type.FriendlyName, type.Name));
            }
            TransactionTypeList.DataBind();

            // fill in the form fields
            if (_PaymentMethodDto != null && _PaymentMethodDto.PaymentMethodParameter != null)
            {
                PaymentMethodDto.PaymentMethodParameterRow param = null;
                param = GetParameterByName(_TransactionTypeParameterName);

                if (param != null)
                {
                    ManagementHelper.SelectListItemIgnoreCase(TransactionTypeList, param.Value);
                }

                param = GetParameterByName(_GatewayParameterName);
                if (param != null && String.Compare(param.Value, Gateways.SelectedValue, true) == 0)
                {
                    foreach (PaymentMethodDto.PaymentMethodParameterRow pRow in _PaymentMethodDto.PaymentMethodParameter)
                    {
                        // skip parameter with name "Gateway" and process all the other parameters
                        if (String.Compare(pRow.Parameter, _GatewayParameterName, true) != 0 &&
                            String.Compare(pRow.Parameter, _TransactionTypeParameterName, true) != 0)
                        {
                            GatewayProperty prop = gateway.FindPropertyByName(pRow.Parameter);
                            if (prop != null)
                            {
                                CreateRow(prop.Name, prop.FriendlyName, pRow.Value, prop.Required);
                            }
                        }
                    }
                }
                else
                {
                    if (gateway.Properties != null)
                    {
                        foreach (GatewayProperty prop in gateway.Properties)
                        {
                            CreateRow(prop.Name, prop.FriendlyName, "", prop.Required);
                        }
                    }
                }
            }
            else
            {
                this.Visible = false;
            }
        }
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            // Bind Languages
            BindLanguages();

            string language = ddlLanguage.SelectedValue;

            // bind available Shipping gateway classes
            BindShippingOptions(language);

            // Bind Currencies
            BindCurrency();

            if (_ShippingMethodDto != null && _ShippingMethodDto.ShippingMethod.Count > 0)
            {
                try
                {
                    ShippingMethodDto.ShippingMethodRow shippingRow = _ShippingMethodDto.ShippingMethod[0];

                    this.lblShippingMethodId.Text = shippingRow.ShippingMethodId.ToString();
                    this.tbName.Text         = shippingRow.Name;
                    this.tbFriendlyName.Text = shippingRow.DisplayName;
                    try
                    {
                        this.tbDescription.Text = shippingRow.Description;
                    }
                    catch
                    {
                        this.tbDescription.Text = "";
                    }
                    this.tbBasePrice.Text = shippingRow.BasePrice.ToString("#.00", System.Threading.Thread.CurrentThread.CurrentUICulture.NumberFormat);

                    try
                    {
                        this.tbSortOrder.Text = shippingRow.Ordering.ToString();
                    }
                    catch
                    {
                        this.tbSortOrder.Text = "0";
                    }

                    this.IsActive.IsSelected  = shippingRow.IsActive;
                    this.IsDefault.IsSelected = shippingRow.IsDefault;

                    ManagementHelper.SelectListItem(ddlShippingOption, shippingRow.ShippingOptionId);
                    ManagementHelper.SelectListItemIgnoreCase(ddlLanguage, shippingRow.LanguageId);
                    ManagementHelper.SelectListItemIgnoreCase(ddlCurrency, shippingRow.Currency);

                    // do not allow to change system name
                    this.tbName.Enabled = false;
                }
                catch (Exception ex)
                {
                    DisplayErrorMessage("Error during binding form: " + ex.Message);
                }
            }
            else
            {
                // set default form values
                this.tbName.Enabled   = true;
                this.tbSortOrder.Text = "0";
            }
        }