/// <summary> /// Binds the form. /// </summary> /// <param name="reset">if set to <c>true</c> [reset].</param> private void BindForm(bool reset) { CultureInfo ci = ManagementContext.Current.ConsoleUICulture; if (TaxCategoriesList.Items.Count == 1) { BindTaxCategories(); } if (reset) { BindJurisdictionGroups(); } TaxDto.TaxValueRow selectedRow = null; if (TaxValueId != 0) { selectedRow = _Tax.TaxValue.FindByTaxValueId(TaxValueId); } if (selectedRow != null) { if (reset) { SetFormFieldsValues(selectedRow.AffectiveDate, selectedRow.Percentage.ToString("#0.000", ci), selectedRow.JurisdictionGroupId, selectedRow.TaxCategory); } } else if (reset) { SetFormFieldsValues(ManagementHelper.GetUserDateTimeNow(), ((double)0).ToString("#0.000", ci), -1, String.Empty); } }
/// <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() { 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(); }