private void BindReadmes() { IList <Readme> readmes = ReadmeDataSource.LoadAll("DisplayName"); int index = readmes.IndexOf(_ReadmeId); if (index > -1) { readmes.RemoveAt(index); } ReadmeList.DataSource = readmes; ReadmeList.DataBind(); }
private void InitializeForm(bool forceRefresh) { int digitalGoodId = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]); _DigitalGood = DigitalGoodDataSource.Load(digitalGoodId); if (_DigitalGood == null) { Response.Redirect(CancelButton.NavigateUrl); } RenameFileExtensions.Text = AbleContext.Current.Store.Settings.FileExt_DigitalGoods; if (!Page.IsPostBack || forceRefresh) { Name.Text = _DigitalGood.Name; FileName.Text = _DigitalGood.FileName; MediaKey.Text = _DigitalGood.MediaKey; ListItem item = ActivationMode.Items.FindByValue(_DigitalGood.ActivationModeId.ToString()); if (item != null) { item.Selected = true; } if (_DigitalGood.MaxDownloads > 0) { MaxDownloads.Text = _DigitalGood.MaxDownloads.ToString(); } int days, hours, minutes; DigitalGood.ParseTimeout(_DigitalGood.ActivationTimeout, out days, out hours, out minutes); if (days > 0) { ActivationTimeoutDays.Text = days.ToString(); } if (hours > 0) { ActivationTimeoutHours.Text = hours.ToString(); } if (minutes > 0) { ActivationTimeoutMinutes.Text = minutes.ToString(); } DigitalGood.ParseTimeout(_DigitalGood.DownloadTimeout, out days, out hours, out minutes); if (days > 0) { DownloadTimeoutDays.Text = days.ToString(); } if (hours > 0) { DownloadTimeoutHours.Text = hours.ToString(); } if (minutes > 0) { DownloadTimeoutMinutes.Text = minutes.ToString(); } //bind license agreements LicenseAgreement.DataSource = LicenseAgreementDataSource.LoadAll(); LicenseAgreement.DataBind(); item = LicenseAgreement.Items.FindByValue(_DigitalGood.LicenseAgreementId.ToString()); if (item != null) { LicenseAgreement.SelectedIndex = LicenseAgreement.Items.IndexOf(item); } item = LicenseAgreementMode.Items.FindByValue(_DigitalGood.LicenseAgreementModeId.ToString()); if (item != null) { LicenseAgreementMode.SelectedIndex = LicenseAgreementMode.Items.IndexOf(item); } // BIND GROUPs Groups.DataBind(); Groups.ClearSelection(); foreach (DigitalGoodGroup dgg in _DigitalGood.DigitalGoodGroups) { item = Groups.Items.FindByValue(dgg.Group.Id.ToString()); if (item != null) { item.Selected = true; } } //bind readmes Readme.DataSource = ReadmeDataSource.LoadAll(); Readme.DataBind(); item = Readme.Items.FindByValue(_DigitalGood.ReadmeId.ToString()); if (item != null) { Readme.SelectedIndex = Readme.Items.IndexOf(item); } EnableSerialKeys.Checked = _DigitalGood.EnableSerialKeys; // INITIALIZE SERIAL KEY PROVIDERS KeySource.Items.Clear(); KeySource.Items.Add(new ListItem("Manual Entry", "0")); // ADD PROVIDERS IList <ISerialKeyProvider> providers = SerialKeyProviderDataSource.GetSerialKeyProviders(); foreach (ISerialKeyProvider provider in providers) { string classId = Misc.GetClassId(provider.GetType()); ListItem providerItem; // (BUG # 8347) ABLECOMMERCE DEFAULT KEY PROVIDER SHOULD BE NAMED AS "Managed List of Keys" if (provider.GetType() == typeof(DefaultSerialKeyProvider)) { providerItem = new ListItem("Managed List of Keys", classId); } else { providerItem = new ListItem(provider.Name, classId); } KeySource.Items.Add(providerItem); } //SELECT CORRECT PROVIDER if (_DigitalGood.SerialKeyProviderId != null) { ListItem providerItem = KeySource.Items.FindByValue(_DigitalGood.SerialKeyProviderId); if (providerItem != null) { KeySource.SelectedIndex = KeySource.Items.IndexOf(providerItem); } } IList <EmailTemplate> templates = EmailTemplateDataSource.LoadAll(); foreach (EmailTemplate template in templates) { ListItem activationItem = new ListItem(template.Name, template.Id.ToString()); ListItem fulfillItem = new ListItem(template.Name, template.Id.ToString()); if (_DigitalGood.ActivationEmailId == template.Id) { activationItem.Selected = true; } if (_DigitalGood.FulfillmentEmailId == template.Id) { fulfillItem.Selected = true; } ActivationEmailTemplateList.Items.Add(activationItem); FulfillmentEmailTemplateList.Items.Add(fulfillItem); } if (_DigitalGood.FulfillmentMode == CommerceBuilder.DigitalDelivery.FulfillmentMode.Manual) { FulfillmentMode.SelectedIndex = 0; } else if (_DigitalGood.FulfillmentMode == CommerceBuilder.DigitalDelivery.FulfillmentMode.OnOrder) { FulfillmentMode.SelectedIndex = 1; } else { FulfillmentMode.SelectedIndex = 2; } ToggleConfigureProvider(); } }