Пример #1
0
        /// <summary>
        /// Binds the element.
        /// </summary>
        private void BindElement()
        {
            ddlElement.Items.Clear();
            MetaClassCollection coll = MetaClass.GetList(MDContext, Namespace, true);

            foreach (MetaClass mc in coll)
            {
                if (mc.Parent == null)
                {
                    if (String.Compare(mc.TableName, "customeraccount", true) != 0 &&
                        String.Compare(mc.TableName, "address", true) != 0)
                    {
                        ddlElement.Items.Add(new ListItem(mc.FriendlyName, mc.Id.ToString()));
                    }
                }
            }
            if (ddlElement.Items.Count > 0)
            {
                MetaClass mc = null;
                if (MetaClassId > 0 && !IsPostBack)
                {
                    mc = MetaClass.Load(MDContext, MetaClassId);
                }
                if (mc != null)
                {
                    ManagementHelper.SelectListItem(ddlElement, mc.Parent.Id.ToString());
                }
                else
                {
                    ManagementHelper.SelectListItem(ddlElement, ddlElement.Items[0].Value);
                }
            }

            BindType();
        }
        public void LoadObject(object dto)
        {
            var paymentMethod = dto as PaymentMethodDto;

            if (paymentMethod == null)
            {
                return;
            }

            var isProduction = bool.Parse(paymentMethod.GetParameter(KlarnaConstants.IsProduction, "false"));

            cbIsProduction.Checked = isProduction;
            txtMerchantId.Text     = paymentMethod.GetParameter(KlarnaConstants.MerchantId, "");
            txtSecret.Text         = paymentMethod.GetParameter(KlarnaConstants.Secret, "");

            ddlLocale.DataSource = Locale.Locales.OrderBy(c => c.Country)
                                   .Select(c => new ListItem(c.Country, c.LocaleCode)).ToList();
            ddlLocale.DataBind();

            //Sweden set as default Locale
            ManagementHelper.SelectListItem(
                ddlLocale,
                paymentMethod.GetParameter(KlarnaConstants.Locale, "sv-se"),
                StringComparer.OrdinalIgnoreCase);
        }
Пример #3
0
        private void BindForm()
        {
            CultureInfo ci = null;

            foreach (string cultureName in _cultures)
            {
                try
                {
                    ci = new CultureInfo(cultureName);
                    ListItem item = new ListItem(ci.NativeName, ci.Name);
                    LanguagesList.Items.Add(item);
                }
                catch { }
            }

            ManagementHelper.SelectListItem(LanguagesList, ManagementContext.Current.ConsoleUICulture.Name);

            //foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
            //{
            //    ListItem item = new ListItem(ci.NativeName, ci.Name);
            //    LanguagesList.Items.Add(item);
            //}

            //DataTable languages = Language.GetAllLanguagesDT();
            //foreach (DataRow row in languages.Rows)
            //{
            //    ListItem item = new ListItem(row["FriendlyName"].ToString(), row["LangName"].ToString());
            //    LanguagesList.Items.Add(item);
            //}
        }
Пример #4
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            if (PrincipalId != Guid.Empty)
            {
                //first check permissions
                //if permissions not present, deny
                SecurityManager.CheckRolePermission("profile:org:mng:edit");

                Organization org = ProfileContext.Current.GetOrganization(PrincipalId);

                if (org != null)
                {
                    Name.Text        = org.Name;
                    Description.Text = org.Description;

                    ProfileSearchParameters pars    = new ProfileSearchParameters();
                    ProfileSearchOptions    options = new ProfileSearchOptions();
                    pars.SqlMetaWhereClause = String.Format("OrganizationId = {0}", org.Id);
                    options.Namespace       = "Mediachase.Commerce.Profile";
                    options.Classes.Add("Account");

                    Account[] accounts = ProfileContext.Current.FindAccounts(pars, options);
                    OrgMemberList.DataSource = accounts;
                    OrgMemberList.DataBind();

                    ManagementHelper.SelectListItem(AccountState, org.State);
                }
            }
            else
            {
                //if permissions not present, deny
                SecurityManager.CheckRolePermission("profile:org:mng:create");
            }
        }
Пример #5
0
    /// <summary>
    /// Binds the form.
    /// </summary>
    private void BindForm()
    {
        if (Config != null)
        {
            Description.Text = Config.Description;
        }

        OfferAmount.Text = "0";
        MinQuantity.Text = "0";

        Settings settings = GetSettings();

        if (settings != null)
        {
            PersistSkuEntrys     = settings.RuleSkuSet;
            MinQuantity.Text     = settings.MinQuantity.ToString();
            EntryList.DataSource = new SkuEntryHelper(settings.RuleSkuSet);
            EntryList.DataBind();
        }
        if (PromotionDto != null && PromotionDto.Promotion.Count != 0)
        {
            OfferAmount.Text = PromotionDto.Promotion[0].OfferAmount.ToString("N2");
            ManagementHelper.SelectListItem(OfferType, PromotionDto.Promotion[0].OfferType);
        }
    }
Пример #6
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            // Bind segments
            TargetSegments.DataSource = SegmentManager.GetSegmentDto();
            TargetSegments.DataBind();

            if (_campaign != null)
            {
                //first check permissions
                //if permissions not present, deny
                SecurityManager.CheckRolePermission("marketing:campaigns:mng:edit");

                CampaignDto.CampaignRow row = _campaign.Campaign[0];
                CampaignName.Text        = row.Name;
                this.AvailableFrom.Value = ManagementHelper.GetUserDateTime(row.StartDate);
                this.ExpiresOn.Value     = ManagementHelper.GetUserDateTime(row.EndDate);
                IsActive.IsSelected      = row.IsActive;
                IsArchived.IsSelected    = row.IsArchived;
                Comments.Text            = row.Comments;

                foreach (CampaignDto.CampaignSegmentRow segmentRow in row.GetCampaignSegmentRows())
                {
                    ManagementHelper.SelectListItem(TargetSegments, segmentRow.SegmentId.ToString(), false);
                }
            }
            else
            {
                //first check permissions
                //if permissions not present, deny
                SecurityManager.CheckRolePermission("marketing:campaigns:mng:create");

                this.AvailableFrom.Value = ManagementHelper.GetUserDateTimeNow();
                this.ExpiresOn.Value     = ManagementHelper.GetUserDateTimeNow().AddMonths(1);
            }
        }
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            // bind available Shipping gateway classes
            BindClassNames();

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

                    this.lblShippingMethodId.Text = shippingRow.ShippingOptionId.ToString();
                    this.tbName.Text        = shippingRow.Name;
                    this.tbDescription.Text = shippingRow.Description;
                    this.tbSystemName.Text  = shippingRow.SystemKeyword;

                    ManagementHelper.SelectListItem(ddlClassName, shippingRow.ClassName);

                    // do not allow to change system name
                    this.tbSystemName.Enabled = false;
                }
                catch (Exception ex)
                {
                    DisplayErrorMessage("Error during binding form: " + ex.Message);
                }
            }
            else
            {
                // set default form values
                this.tbSystemName.Enabled = true;
            }
        }
Пример #8
0
    /// <summary>
    /// Binds the form.
    /// </summary>
    private void BindForm()
    {
        if (Config != null)
        {
            Description.Text = Config.Description;
        }

        OfferAmount.Text = "0";

        if (PromotionDto != null && PromotionDto.Promotion.Count != 0)
        {
            PromotionDto.PromotionRow row = PromotionDto.Promotion[0];
            object settingsObj            = DeseralizeSettings(typeof(Settings));
            if (settingsObj != null)
            {
                Settings settings = (Settings)settingsObj;
                EntryXFilter.SelectedEntryCode = settings.EntryXFilter;
                EntryYFilter.SelectedEntryCode = settings.EntryYFilter;
                SourceQuantity.Text            = settings.SourceQuantity.ToString();
                TargetQuantity.Text            = settings.TargetQuantity.ToString();
            }

            OfferAmount.Text = PromotionDto.Promotion[0].OfferAmount.ToString("N2");
            ManagementHelper.SelectListItem(OfferType, PromotionDto.Promotion[0].OfferType);
        }
    }
Пример #9
0
        protected void AddValue_Click(object sender, System.EventArgs e)
        {
            DataTable dt = DictionaryItemsTable;

            if (dt == null)
            {
                dt = new DataTable();
                dt.Columns.AddRange(new DataColumn[] { new DataColumn("Id", typeof(int)), new DataColumn("Value", typeof(string)) });
            }

            if (MetaMultiValueCtrl.Items.FindByText(MetaValueCtrl.Text) == null)
            {
                DataRow row = dt.NewRow();
                row["Id"]    = -1;
                row["Value"] = MetaValueCtrl.Text;
                dt.Rows.Add(row);

                DictionaryItemsTable = dt;
            }

            this.MetaMultiValueCtrl.DataSource = dt;
            this.MetaMultiValueCtrl.DataBind();

            MetaValueCtrl.Text = String.Empty;

            if (MetaObject != null)
            {
                MetaDictionaryItem[] items = MetaObject.GetDictionaryItems(MetaField);
                foreach (MetaDictionaryItem item in items)
                {
                    ManagementHelper.SelectListItem(MetaMultiValueCtrl, item.Id, false);
                }
            }
        }
Пример #10
0
    /// <summary>
    /// Binds the form.
    /// </summary>
    private void BindForm()
    {
        if (Config != null)
        {
            Description.Text = Config.Description;
        }

        OfferAmount.Text     = "0";
        MaxQuantity.Text     = "0";
        ExcludeEntry.Checked = false;

        Settings settings = GetSettings();

        if (settings != null)
        {
            EntryYFilter.SelectedEntryCode = settings.EntryYFilter;
            ExcludeEntry.Checked           = settings.Exclude;
            PersistSkuEntrys     = settings.EntryXSkuSet;
            MaxQuantity.Text     = settings.MaxYQuantity.ToString();
            EntryList.DataSource = new SkuEntryHelper(settings.EntryXSkuSet);
            EntryList.DataBind();
        }
        if (PromotionDto != null && PromotionDto.Promotion.Count != 0)
        {
            OfferAmount.Text = PromotionDto.Promotion[0].OfferAmount.ToString("N2");
            ManagementHelper.SelectListItem(OfferType, PromotionDto.Promotion[0].OfferType);
        }
    }
Пример #11
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            // Bind Meta classes
            MetaClass catalogEntry = MetaClass.Load(CatalogContext.MetaDataContext, "CatalogEntry");

            MetaClassList.Items.Clear();
            if (catalogEntry != null)
            {
                MetaClassCollection metaClasses = catalogEntry.ChildClasses;
                foreach (MetaClass metaClass in metaClasses)
                {
                    MetaClassList.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Id.ToString()));
                }

                MetaClassList.DataBind();
            }

            // Bind Templates
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter             = "TemplateType = 'entry'";
                DisplayTemplate.DataSource = view;
                DisplayTemplate.DataBind();
            }

            if (CatalogEntryId > 0)
            {
                if (_CatalogEntryDto.CatalogEntry.Count > 0)
                {
                    Name.Text           = _CatalogEntryDto.CatalogEntry[0].Name;
                    AvailableFrom.Value = ManagementHelper.GetUserDateTime(_CatalogEntryDto.CatalogEntry[0].StartDate);
                    ExpiresOn.Value     = ManagementHelper.GetUserDateTime(_CatalogEntryDto.CatalogEntry[0].EndDate);
                    CodeText.Text       = _CatalogEntryDto.CatalogEntry[0].Code;
                    IsActive.IsSelected = _CatalogEntryDto.CatalogEntry[0].IsActive;

                    ManagementHelper.SelectListItem(DisplayTemplate, _CatalogEntryDto.CatalogEntry[0].TemplateName);
                    ManagementHelper.SelectListItem(MetaClassList, _CatalogEntryDto.CatalogEntry[0].MetaClassId);

                    // Bind Sort order
                    foreach (CatalogRelationDto.NodeEntryRelationRow row in _CatalogRelationDto.NodeEntryRelation)
                    {
                        if (row.CatalogEntryId == _CatalogEntryDto.CatalogEntry[0].CatalogEntryId &&
                            row.CatalogId == this.ParentCatalogId &&
                            row.CatalogNodeId == this.ParentCatalogNodeId)
                        {
                            SortOrder.Text = row.SortOrder.ToString();
                        }
                    }
                }
            }
            else
            {
                this.AvailableFrom.Value = ManagementHelper.GetUserDateTime(DateTime.UtcNow);
                this.ExpiresOn.Value     = ManagementHelper.GetUserDateTime(DateTime.UtcNow).AddYears(1);
            }
        }
Пример #12
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        public void BindData()
        {
            BindCancelStatusesDropDown();
            BindDefaultTransactionTypesDropDown();

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

                // TestMode parameter
                param = GetParameterByName(AuthorizeTokenExGateway.TestParameterName);
                if (param != null)
                {
                    bool testFlag;
                    bool.TryParse(param.Value, out testFlag);
                    TestFlagYes.Checked = testFlag;
                    TestFlagNo.Checked  = !testFlag;
                }

                param = GetParameterByName(AuthorizeTokenExGateway.UserParameterName);
                if (param != null)
                {
                    User.Text = param.Value;
                }

                param = GetParameterByName(AuthorizeTokenExGateway.TransactionKeyParameterName);
                if (param != null)
                {
                    Password.Text = param.Value;
                }

                param = GetParameterByName(AuthorizeTokenExGateway.PaymentOptionParameterName);
                if (param != null)
                {
                    ListItem li = RadioButtonListOptions.Items.FindByValue(param.Value);
                    if (li != null)
                    {
                        li.Selected = true;
                    }
                }

                param = GetParameterByName(AuthorizeTokenExGateway.RecurringMethodParameterName);
                if (param != null)
                {
                    ManagementHelper.SelectListItem(ddlRecurringMethod, param.Value, StringComparer.Ordinal);
                }

                param = GetParameterByName(AuthorizeTokenExGateway.CancelStatusParameterName);
                if (param != null)
                {
                    ManagementHelper.SelectListItem(ddlCancelStatus, param.Value, StringComparer.Ordinal);
                }
            }
            else
            {
                this.Visible = false;
            }
        }
Пример #13
0
 /// <summary>
 /// Loads the expression categories.
 /// </summary>
 private void LoadExpressionCategories()
 {
     foreach (string key in ExpressionCategory.Categories.Keys)
     {
         ddlExpressionCategory.Items.Add(new ListItem(ExpressionCategory.Categories[key], key));
     }
     ManagementHelper.SelectListItem(ddlExpressionCategory, CurrentExpressionCategory);
 }
Пример #14
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            LoadPolicyGroups();
            LoadPromotionTypes();

            if (_promotion != null)
            {
                PromotionDto.PromotionRow promo = _promotion.Promotion[0];
                PromotionName.Text          = promo.Name;
                this.AvailableFrom.Value    = ManagementHelper.GetUserDateTime(promo.StartDate);
                this.ExpiresOn.Value        = ManagementHelper.GetUserDateTime(promo.EndDate);
                Priority.Text               = promo.Priority.ToString();
                CouponCode.Text             = promo.CouponCode;
                MaxTotalRedemptions.Text    = promo.ApplicationLimit.ToString();
                MaxCustomerRedemptions.Text = promo.CustomerLimit.ToString();
                MaxOrderRedemptions.Text    = promo.PerOrderLimit.ToString();

                // Get existing statistics
                DataTable usageStatistics = PromotionManager.GetPromotionUsageStatistics();

                // Get total used
                int totalUsed = 0;

                System.Data.DataRow[] rows = usageStatistics.Select(String.Format("PromotionId = {0}", promo.PromotionId));
                if (rows != null && rows.Length > 0)
                {
                    totalUsed = (int)rows[0]["TotalUsed"];
                }

                MaxTotalRedemptionsUsed.Text = totalUsed.ToString();

                //OfferAmount.Text = promo.OfferAmount.ToString();
                ComboBoxItem item = CampaignFilter.Items.FindByValue(promo.CampaignId.ToString());
                if (item != null)
                {
                    CampaignFilter.SelectedItem = item;
                }

                //CampaignFilter.SelectedIndex = 0;
                //ManagementHelper.SelectListItem(OfferType, promo.OfferType);
                //ManagementHelper.SelectListItem(PromotionGroupsList, promo.PromotionGroup);
                ManagementHelper.SelectListItem(ExclusivityType, promo.ExclusivityType);
                ManagementHelper.SelectListItem(PromotionStatus, promo.Status);
                ManagementHelper.SelectListItem(PromotionTypeList, promo.PromotionType);
                PromotionTypeList.Enabled = false;
            }
            else
            {
                ManagementHelper.SelectListItem(PromotionTypeList, Request.QueryString["type"]);
                PromotionTypeList.Enabled = true;
                this.AvailableFrom.Value  = ManagementHelper.GetUserDateTimeNow();
                this.ExpiresOn.Value      = ManagementHelper.GetUserDateTimeNow().AddMonths(1);
                Priority.Text             = "1";
                //OfferAmount.Text = "0";
            }

            BindPromotionLanguagesList();
        }
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            MetaLabelCtrl.Text = String.Format("{0} ({1})", MetaField.FriendlyName, LanguageCode);

            ManagementHelper.SelectListItem(MetaValueCtrl, MetaObject == null ? "" : MetaObject.GetInt32(MetaField).ToString());

            MetaDescriptionCtrl.Text = MetaField.Description;
            //RequiredFieldValidator1.ErrorMessage = String.Format("the {0} field is required", MetaField.FriendlyName);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindTargetItems();
                BindLanguagesList();
                ManagementHelper.SelectListItem(ListLanguages, CommonSettingsManager.GetDefaultLanguage());

                BindCatalogsList();
            }
        }
Пример #17
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        private void LoadDataAndDataBind()
        {
            BindLanguagesList();
            ManagementHelper.SelectListItem(ListLanguages, CommonSettingsManager.GetDefaultLanguage());

            BindCatalogsList();

            StringBuilder script = new StringBuilder("this.disabled = true;\r\n");

            script.AppendFormat("__doPostBack('{0}', '');", btnSearch.UniqueID);
            btnSearch.OnClientClick = script.ToString();
        }
Пример #18
0
        void OrderGroupTrigger_ValueChanged(object sender, EventArgs e)
        {
            LoadAddresses();

            if (_order != null && _order.OrderForms.Count > 0)
            {
                if (AddressesList.Items.Count > 0)
                {
                    ManagementHelper.SelectListItem(AddressesList, _order.OrderForms[0].BillingAddressId);
                }
            }
        }
Пример #19
0
        /// <summary>
        /// Handles the Click event of the SaveChangesButton 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 SaveChangesButton_Click(object sender, EventArgs e)
        {
            CatalogEntryDto.SalePriceRow row = null;

            if (SalePriceId != 0)             // find existing
            {
                row = _CatalogEntryDto.SalePrice.FindBySalePriceId(SalePriceId);
            }

            // if not found, create new
            if (row == null)
            {
                row          = _CatalogEntryDto.SalePrice.NewSalePriceRow();
                row.Currency = "";
                //row.ItemCode = "";
            }

            // update SalePrice fields
            if (row != null)
            {
                row.SaleCode = SaleCode.Text;

                decimal price = Decimal.Parse(UnitPrice.Text);
                row.UnitPrice = price;

                ListItem selectedItem = SaleTypeFilter.Items.FindByValue(SelectedSaleTypeField.Value);
                if (selectedItem != null)
                {
                    row.SaleType = Int32.Parse(selectedItem.Value);
                    ManagementHelper.SelectListItem(SaleTypeFilter, row.SaleType);
                }

                selectedItem = CurrencyFilter.Items.FindByValue(SelectedCurrencyField.Value);
                if (selectedItem != null)
                {
                    row.Currency = selectedItem.Value;
                    ManagementHelper.SelectListItem(CurrencyFilter, row.Currency);
                }

                row.MinQuantity = Decimal.Parse(MinQuantity.Text);
                row.StartDate   = StartDate.Value.ToUniversalTime();
                row.EndDate     = EndDate.Value.ToUniversalTime();

                if (row.RowState == DataRowState.Detached)
                {
                    _CatalogEntryDto.SalePrice.Rows.Add(row);
                }
            }

            ScriptManager.RegisterStartupScript(MetaDataTab, typeof(SalePriceEditPopup), "DialogClose", "SalePriceEdit_CloseDialog();", true);
        }
Пример #20
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            // Bind Languages
            BindLanguages();

            // Bind Currencies
            BindCurrency();

            if (CatalogId > 0)
            {
                CatalogDto dto = CatalogContext.Current.GetCatalogDto(CatalogId);
                this.CatalogName.Text    = dto.Catalog[0].Name;
                this.AvailableFrom.Value = ManagementHelper.GetUserDateTime(dto.Catalog[0].StartDate);
                this.ExpiresOn.Value     = ManagementHelper.GetUserDateTime(dto.Catalog[0].EndDate);
                this.SortOrder.Text      = dto.Catalog[0].SortOrder.ToString();

                // Bind other languages
                if (dto.CatalogLanguage.Count > 0)
                {
                    foreach (CatalogDto.CatalogLanguageRow row in dto.CatalogLanguage.Rows)
                    {
                        foreach (ListItem item in OtherLanguagesList.Items)
                        {
                            if (item.Value == row.LanguageCode)
                            {
                                item.Selected = true;
                            }
                        }
                    }
                }

                ManagementHelper.SelectListItem(DefaultLanguage, dto.Catalog[0].DefaultLanguage.ToLower());
                ManagementHelper.SelectListItem(DefaultCurrency, dto.Catalog[0].DefaultCurrency.ToLower());
                ManagementHelper.SelectListItem(BaseWeight, dto.Catalog[0].WeightBase);
                this.IsCatalogActive.IsSelected = dto.Catalog[0].IsActive;

                // Bind sites
                BindSites(dto);
            }
            else
            {
                this.AvailableFrom.Value = DateTime.Now;
                this.ExpiresOn.Value     = DateTime.Now.AddYears(1);
                this.SortOrder.Text      = "0";
                ManagementHelper.SelectListItem(DefaultCurrency, CommonSettingsManager.GetDefaultCurrency());
                ManagementHelper.SelectListItem(DefaultLanguage, CommonSettingsManager.GetDefaultLanguage());

                // Bind sites
                BindSites(null);
            }
        }
Пример #21
0
        private void BindData()
        {
            //foreach(string item in MetaField.DictionaryItems.Values)
            //{
            //    MetaMultiValueCtrl.Items.Add(new ListItem(item, item));
            //}

            if (this.IsPostBack && DictionaryItemsTable != null)
            {
                MetaMultiValueCtrl.DataSource = DictionaryItemsTable;
                MetaMultiValueCtrl.DataBind();
            }
            else
            {
                DataTable dt = new DataTable();
                dt.Columns.AddRange(new DataColumn[] { new DataColumn("Id", typeof(int)), new DataColumn("Value", typeof(string)) });

                MetaDictionary dictionary = MetaField.Dictionary;
                if (dictionary != null)
                {
                    foreach (MetaDictionaryItem item in dictionary)
                    {
                        DataRow row = dt.NewRow();
                        row["Id"]    = item.Id;
                        row["Value"] = item.Value;
                        dt.Rows.Add(row);
                    }
                }

                DictionaryItemsTable = dt;

                this.MetaMultiValueCtrl.DataSource = dt;
                this.MetaMultiValueCtrl.DataBind();
            }

            //if(MetaField.Value!=null)
            //foreach(string str in (string[])MetaField.Value)
            //{
            //    Util.CommonHelper.SelectListItem(MetaMultiValueCtrl, str, false);
            //}

            if (MetaObject != null)
            {
                MetaDictionaryItem[] items = MetaObject.GetDictionaryItems(MetaField);
                foreach (MetaDictionaryItem item in items)
                {
                    ManagementHelper.SelectListItem(MetaMultiValueCtrl, item.Id, false);
                }
            }
        }
Пример #22
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            // Bind Meta classes
            MetaClass catalogNode = MetaClass.Load(CatalogContext.MetaDataContext, "CatalogNode");

            MetaClassList.Items.Clear();
            if (catalogNode != null)
            {
                MetaClassCollection metaClasses = catalogNode.ChildClasses;
                foreach (MetaClass metaClass in metaClasses)
                {
                    MetaClassList.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Id.ToString()));
                }
                MetaClassList.DataBind();
            }

            // Bind Templates
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter             = "TemplateType = 'node'";
                DisplayTemplate.DataSource = view;
                DisplayTemplate.DataBind();
            }

            if (CatalogNodeId > 0)
            {
                if (_CatalogNodeDto.CatalogNode.Count > 0)
                {
                    Name.Text                      = _CatalogNodeDto.CatalogNode[0].Name;
                    AvailableFrom.Value            = ManagementHelper.GetUserDateTime(_CatalogNodeDto.CatalogNode[0].StartDate);
                    ExpiresOn.Value                = ManagementHelper.GetUserDateTime(_CatalogNodeDto.CatalogNode[0].EndDate);
                    CodeText.Text                  = _CatalogNodeDto.CatalogNode[0].Code;
                    SortOrder.Text                 = _CatalogNodeDto.CatalogNode[0].SortOrder.ToString();
                    IsCatalogNodeActive.IsSelected = _CatalogNodeDto.CatalogNode[0].IsActive;

                    ManagementHelper.SelectListItem(DisplayTemplate, _CatalogNodeDto.CatalogNode[0].TemplateName);
                    ManagementHelper.SelectListItem(MetaClassList, _CatalogNodeDto.CatalogNode[0].MetaClassId);
                }
            }
            else
            {
                this.AvailableFrom.Value = DateTime.Now;
                this.ExpiresOn.Value     = DateTime.Now.AddYears(1);
                this.SortOrder.Text      = "0";
            }
        }
Пример #23
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            // Bind Languages
            BindLanguages();

            // bind available payment gateway classes
            BindClassNames();

            if (_PaymentMethodDto != null && _PaymentMethodDto.PaymentMethod.Count > 0)
            {
                try
                {
                    PaymentMethodDto.PaymentMethodRow paymentRow = _PaymentMethodDto.PaymentMethod[0];

                    this.lblPaymentMethodId.Text      = paymentRow.PaymentMethodId.ToString();
                    this.tbName.Text                  = paymentRow.Name;
                    this.tbDescription.Text           = paymentRow.Description;
                    this.tbSystemName.Text            = paymentRow.SystemKeyword;
                    this.tbSortOrder.Text             = paymentRow.Ordering.ToString();
                    this.IsActive.IsSelected          = paymentRow.IsActive;
                    this.IsDefault.IsSelected         = paymentRow.IsDefault;
                    this.SupportsRecurring.IsSelected = paymentRow.SupportsRecurring;

                    ManagementHelper.SelectListItem(ddlLanguage, paymentRow.LanguageId);
                    ManagementHelper.SelectListItem(ddlClassName, paymentRow.ClassName);

                    // do not allow to change system name
                    this.tbSystemName.Enabled = false;

                    // set initial state of dual list
                    BindShippingMethodsList(paymentRow);
                }
                catch (Exception ex)
                {
                    DisplayErrorMessage("Error during binding form: " + ex.Message);
                }
            }
            else
            {
                // set default form values
                this.tbSortOrder.Text     = "0";
                this.tbSystemName.Enabled = true;

                BindShippingMethodsList(null);
            }
        }
        void lvMain_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem && lvMain.EditIndex != -1)
            {
                int id = Int32.Parse(lvMain.DataKeys[lvMain.EditIndex].Value.ToString());

                ShippingMethodDto.ShippingPackageRow shPackageRow = _ShippingMethodDto.ShippingPackage.FindByShippingPackageId(id);
                if (shPackageRow != null)
                {
                    // select package in packages DropDownList
                    DropDownList ddl = (DropDownList)e.Item.FindControl("PackagesList");
                    if (ddl != null)
                    {
                        ManagementHelper.SelectListItem(ddl, shPackageRow.PackageId.ToString());
                    }
                }
            }
        }
Пример #25
0
        /// <summary>
        /// Binds the type.
        /// </summary>
        private void BindType()
        {
            LblType.Visible = false;
            ddlType.Visible = false;

            if (ddlElement.Items.Count > 0)
            {
                int       SelectedClassId = int.Parse(ddlElement.SelectedValue);
                MetaClass mclass          = MetaClass.Load(MDContext, SelectedClassId);
                if (mclass.ChildClasses != null && mclass.ChildClasses.Count > 0)
                {
                    LblType.Visible = true;
                    ddlType.Visible = true;

                    ddlType.Items.Clear();

                    MetaClassCollection children = mclass.ChildClasses;
                    foreach (MetaClass child in children)
                    {
                        ddlType.Items.Add(new ListItem(child.FriendlyName, child.Id.ToString()));
                    }
                }
                if (ddlType.Items.Count > 0)
                {
                    MetaClass mc = null;
                    if (MetaClassId > 0 && !IsPostBack)
                    {
                        mc = MetaClass.Load(MDContext, MetaClassId);
                    }
                    if (mc != null)
                    {
                        ManagementHelper.SelectListItem(ddlType, MetaClassId.ToString());
                        BindFields(mc);
                    }
                    else
                    {
                        ManagementHelper.SelectListItem(ddlType, ddlType.Items[0].Value);
                        BindFields(MetaClass.Load(MDContext, int.Parse(ddlType.SelectedValue)));
                    }
                }
            }
        }
Пример #26
0
        private void BindData()
        {
            if (MetaField != null && !MetaField.AllowNulls)
            {
                RequiredFieldValidator1.Enabled = true;
            }
            else
            {
                RequiredFieldValidator1.Enabled = false;
            }

            MetaLabelCtrl.Text = String.Format("{0} ({1})", MetaField.FriendlyName, LanguageCode);

            MetaDescriptionCtrl.Text             = MetaField.Description;
            RequiredFieldValidator1.ErrorMessage = String.Format("the {0} field is required", MetaField.FriendlyName);

            if (MetaField.AllowNulls)
            {
                DicSingleValueCtrl.Items.Add(new ListItem("[" + RM.GetString("SINGLEVALUECONTROL_EMPTY_VALUE") + "]", ""));
            }

            MetaDictionary dictionary = MetaField.Dictionary;

            if (dictionary != null)
            {
                foreach (MetaDictionaryItem item in dictionary)
                {
                    DicSingleValueCtrl.Items.Add(new ListItem(item.Value.ToString(), item.Value.ToString()));
                }
            }

            if (DicSingleValueCtrl.Items.Count > 0)
            {
                try
                {
                    ManagementHelper.SelectListItem(DicSingleValueCtrl, MetaObject.GetDictionaryItem(MetaField).Value);
                }
                catch
                {
                }
            }
        }
        void lvMain_ItemEditing(object sender, ListViewEditEventArgs e)
        {
            // set the ListView to Edit mode
            lvMain.EditIndex = e.NewEditIndex;

            int id = Int32.Parse(lvMain.DataKeys[lvMain.EditIndex].Value.ToString());

            ShippingMethodDto.ShippingPackageRow shPackageRow = _ShippingMethodDto.ShippingPackage.FindByShippingPackageId(id);
            if (shPackageRow != null)
            {
                // select package in package dropdown
                DropDownList ddl = (DropDownList)lvMain.Items[e.NewEditIndex].FindControl("PackageList");
                if (ddl != null)
                {
                    ManagementHelper.SelectListItem(ddl, shPackageRow.PackageId);
                }
            }

            // bind the ListView
            BindForm();
        }
Пример #28
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            LoadExpressions();

            if (_Policy != null)
            {
                //first check permissions
                //if permissions not present, deny
                SecurityManager.CheckRolePermission("marketing:policies:mng:edit");

                PolicyDto.PolicyRow row = _Policy.Policy[0];
                PolicyName.Text    = row.Name;
                tbStatus.Text      = row.Status;
                IsLocal.IsSelected = row.IsLocal;
                ManagementHelper.SelectListItem(ddlExpression, row.ExpressionId);

                /*if (row.IsLocal)
                 *      PolicyGroupRow.Visible = false;
                 * else
                 * {*/
                LoadPolicyGroups();
                foreach (PolicyDto.GroupPolicyRow gpRow in row.GetGroupPolicyRows())
                {
                    ManagementHelper.SelectListItem(GroupsListBox, gpRow.GroupName, false);
                }
                //}
            }
            else
            {
                //first check permissions
                //if permissions not present, deny
                SecurityManager.CheckRolePermission("marketing:policies:mng:create");

                //PolicyGroupRow.Visible = true;
                LoadPolicyGroups();
                ManagementHelper.SelectListItem(GroupsListBox, CurrentPolicyGroup, true);
            }
        }
Пример #29
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="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (_PaymentMethodDto?.PaymentMethodParameter != null)
                {
                    var param = GetParameterByName(_TransactionTypeParameterName);
                    if (!string.IsNullOrEmpty(param?.Value))
                    {
                        ManagementHelper.SelectListItem(TransactionTypeList, param.Value, StringComparer.OrdinalIgnoreCase);
                    }

                    param = GetParameterByName(_GatewayParameterName);
                    if (!string.IsNullOrEmpty(param?.Value))
                    {
                        ManagementHelper.SelectListItem(Gateways, param.Value, StringComparer.OrdinalIgnoreCase);
                    }

                    BindData();
                    SortGatewayList();
                }
            }
        }
Пример #30
0
    /// <summary>
    /// Binds the form.
    /// </summary>
    private void BindForm()
    {
        if (Config != null)
        {
            Description.Text = Config.Description;
        }

        OfferAmount.Text    = "0";
        MinOrderAmount.Text = "0";

        if (PromotionDto != null && PromotionDto.Promotion.Count != 0)
        {
            PromotionDto.PromotionRow row = PromotionDto.Promotion[0];
            object settingsObj            = DeseralizeSettings(typeof(Settings));
            if (settingsObj != null)
            {
                Settings settings = (Settings)settingsObj;
                MinOrderAmount.Text = settings.MinOrderAmount.ToString();
            }

            OfferAmount.Text = PromotionDto.Promotion[0].OfferAmount.ToString("N2");
            ManagementHelper.SelectListItem(OfferType, PromotionDto.Promotion[0]);
        }
    }