public async Task <IQueryResponse> GetOperations(Guid id, Criteria <OperationCriteria> criteria) { criteria.AddFilter("accountId", id.ToString(), typeof(Guid)); var query = _queryProcessorRegistry.FindQueryProcessor <OperationCriteria>(); var response = await query.ProcessAsync(new QueryRequest <OperationCriteria>(criteria)); return(response);; }
/// <summary> /// Finds a singular item. /// </summary> /// <param name="type">The type.</param> /// <param name="field">The field.</param> /// <param name="value">The value.</param> /// <returns></returns> public static ActiveRecordBase FindOneByProperty(Type type, string field, object value) { Criteria criteria = Criteria.For(type); criteria .AddFilter(criteria.Eq(field, value)); return(ActiveRecordBase.FindOne(type, criteria)); }
protected void Display_View() { pnl_viewall.Visible = false; List<OrderData> orderList = new List<OrderData>(); List<AddressData> aAddreses = new List<AddressData>(); List<Ektron.Cms.Commerce.Basket> basketList; OrderApi orderApi = new OrderApi(); BasketApi basketApi = new BasketApi(); // customer cCustomer = CustomerManager.GetItem(this.m_iID); m_iCustomerId = cCustomer.Id; this.ltr_id.Text = cCustomer.Id.ToString(); this.ltr_uname.Text = cCustomer.UserName; this.ltr_fname.Text = cCustomer.FirstName; this.ltr_lname.Text = cCustomer.LastName; this.ltr_dname.Text = cCustomer.DisplayName; this.ltr_ordertotal.Text = cCustomer.TotalOrders.ToString(); this.ltr_orderval.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(cCustomer.TotalOrderValue, defaultCurrency.CultureCode); this.ltr_pervalue.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(cCustomer.AverageOrderValue, defaultCurrency.CultureCode); // customer // orders Criteria<OrderProperty> orderCriteria = new Criteria<OrderProperty>(); orderCriteria.AddFilter(OrderProperty.CustomerId, CriteriaFilterOperator.EqualTo, m_iID); orderList = orderApi.GetList(orderCriteria); if (orderList.Count == 0) { ltr_orders.Text = this.GetMessage("lbl no orders"); } dg_orders.DataSource = orderList; dg_orders.DataBind(); // orders // addresses aAddreses = AddressManager.GetList(m_iID); if (aAddreses.Count == 0) { ltr_address.Text = this.GetMessage("lbl no addresses"); } dg_address.DataSource = aAddreses; dg_address.DataBind(); // addresses // baskets if (this.m_iID > 0) { basketList = basketApi.GetList(this.m_iID); if (basketList.Count == 0) { ltr_baskets.Text = this.GetMessage("lbl no baskets"); } dg_baskets.DataSource = basketList; dg_baskets.DataBind(); } }
/// <summary> /// Check if the criteria return results. /// </summary> /// <param name="type">The type.</param> /// <param name="id">The id.</param> /// <returns></returns> public static bool Exists(Type type, object id) { PrimaryKeyAttribute pk = ActiveRecordMaster.GetPrimaryKey(type); Criteria criteria = Criteria.For(type); criteria .AddFilter(criteria.Eq(pk.CurrentPropertyInfo.Name, id)); return(ActiveRecordBase.Exists(type, criteria)); }
protected override void SetEmbeds(IEmbedCollectionExpression embeds, AccountDto root) { foreach (var embed in embeds.Embeds) { switch (embed.Name) { case "operations": var criteria = new Criteria <OperationCriteria>(); criteria.AddFilter("accountId", root.Id.ToString(), typeof(Guid)); root.Operations = (IEnumerable <OperationDto>)ProcessAsync(criteria).Result; break; } } }
public async Task <ActionResult <AccountDto> > Get(Guid id, Criteria <AccountCriteria> criteria) { criteria.AddFilter("id", id.ToString(), typeof(Guid)); var query = _queryProcessorRegistry.FindQueryProcessor <AccountCriteria>(); var response = await query.ProcessAsync(new QueryRequest <AccountCriteria>(criteria)); if (response.Data.Count.Equals(0)) { return((AccountDto)response.Data.GetEnumerator().Current); } return(NotFound()); }
/// <summary> /// Tries the find by property. /// </summary> /// <param name="field">The field.</param> /// <param name="value">The value.</param> /// <param name="result">The result.</param> /// <returns></returns> public static bool TryFindByProperty(string field, object value, out TMappedClass result) { try { Criteria criteria = Criteria.For(typeof(TMappedClass)); criteria .AddFilter(criteria.Eq(field, value)); TMappedClass item = ActiveRecordBase <TMappedClass> .TryFind(criteria); result = item; return(item != null); } catch (Exception ex) { LogManager.Log("Monty.ActiveRecord", LogCategory.Error, String.Format("Error when tries to execute ActiveRecordBase<>.TryFindByProperty(type: [{0}])", typeof(TMappedClass)), ex); result = null; return(false); } }
private void Bind() { TargetedContent targetContentManager = new TargetedContent(_contentApi.RequestInformationRef); Criteria<TargetedContentProperty> criteria = new Criteria<TargetedContentProperty>(); criteria.AddFilter(TargetedContentProperty.IsGlobal, CriteriaFilterOperator.EqualTo, true); criteria.PagingInfo.RecordsPerPage = _contentApi.RequestInformationRef.PagingSize; criteria.PagingInfo.CurrentPage = ucPaging.SelectedPage + 1; List<TargetedContentData> targetContentList = targetContentManager.GetList(criteria); if (criteria.PagingInfo.TotalPages < 2) { ucPaging.Visible = false; } else { ucPaging.TotalPages = criteria.PagingInfo.TotalPages; ucPaging.CurrentPageIndex = ucPaging.SelectedPage; } ViewAllRepeater.DataSource = targetContentList; ViewAllRepeater.DataBind(); }
private void AddFolders(long[] parentFolders, string topPath, bool showNameOnly, ref Dictionary<long, string> folders, ref List<long> orderedFolders) { List<FolderData> folderList = null; Ektron.Cms.Framework.Core.Folder.Folder folder = new Ektron.Cms.Framework.Core.Folder.Folder(); Criteria<FolderProperty> criteria = new Criteria<FolderProperty>(FolderProperty.FolderPath, EkEnumeration.OrderByDirection.Ascending); if (parentFolders.Length > 0) { criteria.AddFilter(FolderProperty.ParentId, CriteriaFilterOperator.In, parentFolders); folderList = folder.GetList(criteria); } List<long> oldIds = new List<long>(orderedFolders); if (folderList == null || folderList.Count == 0) return; foreach (FolderData f in folderList) { if (!folders.ContainsKey(f.Id)) { folders.Add(f.Id, showNameOnly ? f.Name : ("/" + f.NameWithPath.Substring(topPath.Length - 1))); } } // Add in the IDs for sorting List<long> ids; foreach (long parentId in parentFolders) { ids = folderList.Where(x => x.ParentId == parentId).Select<FolderData, long>(x => x.Id).ToList(); orderedFolders.InsertRange(orderedFolders.IndexOf(parentId) + 1, ids); } ids = folderList.Select<FolderData, long>(x => x.Id).ToList(); ids = ids.ToList().Where(x => !oldIds.Contains(x)).ToList(); AddFolders(ids.ToArray(), topPath, showNameOnly, ref folders, ref orderedFolders); }
private List<CouponEntryData> GetTaxonomyList() { //instantiate coupon service field _CouponService = _CouponService == null ? new Coupon(_CouponApi.RequestInformationRef) : _CouponService; // taxonomies Criteria<CouponEntryProperty> taxonomyCriteria = new Criteria<CouponEntryProperty>(); taxonomyCriteria.AddFilter(CouponEntryProperty.CouponId, CriteriaFilterOperator.EqualTo, this.CouponPublishedData.Id); taxonomyCriteria.AddFilter(CouponEntryProperty.IsIncluded, CriteriaFilterOperator.EqualTo, this.Scope == CouponScope.Exclude ? false : true); List<CouponEntryData> taxonomyList = _CouponService.GetTaxonomyList(taxonomyCriteria); return taxonomyList; }
public Criteria<OrderProperty> Util_GetDates(Criteria<OrderProperty> orderCriteria) { Intervals = 7; StartDate = DateTime.Now.Subtract(new TimeSpan(Intervals, 0, 0, 0)); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, StartDate); TrendTimeLineChart.TimeUnitInterval = controls_reports_TimeLineChart.TimeUnit.Day; return orderCriteria; }
private void Display_PricingTab(EntryData versionData) { Currency m_refCurrency = new Currency(m_refContentApi.RequestInformationRef); Ektron.Cms.Workarea.workareabase workarearef = new Ektron.Cms.Workarea.workareabase(); List<CurrencyData> activeCurrencyList = m_refCurrency.GetActiveCurrencyList(); List<ExchangeRateData> exchangeRateList = new List<ExchangeRateData>(); if (activeCurrencyList.Count > 1) { ExchangeRateApi exchangeRateApi = new ExchangeRateApi(); Criteria<ExchangeRateProperty> exchangeRateCriteria = new Criteria<ExchangeRateProperty>(); List<long> currencyIDList = new List<long>(); for (int i = 0; i <= (activeCurrencyList.Count - 1); i++) { currencyIDList.Add(activeCurrencyList[i].Id); } exchangeRateCriteria.AddFilter(ExchangeRateProperty.BaseCurrencyId, CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.CommerceSettings.DefaultCurrencyId); exchangeRateCriteria.AddFilter(ExchangeRateProperty.ExchangeCurrencyId, CriteriaFilterOperator.In, currencyIDList.ToArray()); exchangeRateList = exchangeRateApi.GetCurrentList(exchangeRateCriteria); } ltr_pricing.Text = workarearef.CommerceLibrary.GetPricingMarkup(versionData.Pricing, activeCurrencyList, exchangeRateList, entry_data.EntryType, false, workareaCommerce.ModeType.View); }
private void SetCulture(string langType) { if (!String.IsNullOrEmpty(langType)) { try { LocaleData currentlocale = null; String cacheKey = String.Format(CACHE_KEY_FORMAT, langType); if (HttpContext.Current.Cache[cacheKey] == null) { lock (padlock) { if (HttpContext.Current.Cache[cacheKey] == null) { // Look up culture information from CMS LocaleManager localeManager = new LocaleManager(Ektron.Cms.Framework.ApiAccessMode.Admin); Criteria<LocaleProperty> criteria = new Criteria<LocaleProperty>(); criteria.AddFilter(LocaleProperty.Id, CriteriaFilterOperator.EqualTo, langType); List<LocaleData> matchingLocals = localeManager.GetList(criteria); if (matchingLocals != null && matchingLocals.Count > 0) { currentlocale = matchingLocals[0]; HttpContext.Current.Cache.Insert(cacheKey, currentlocale); } } } } if (HttpContext.Current.Cache[cacheKey] != null) { currentlocale = (LocaleData)HttpContext.Current.Cache[cacheKey]; // Set asp.net culture property. Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(currentlocale.Culture); Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(currentlocale.UICulture); } } catch (Exception exc) { _error = exc.Message; } } }
private void SetSearch(ref Criteria<CouponProperty> couponCriteria) { couponCriteria.AddFilter(CouponProperty.Code, CriteriaFilterOperator.Contains, _SearchText); couponCriteria.Condition = LogicalOperation.Or; couponCriteria.AddFilter(CouponProperty.Description, CriteriaFilterOperator.Contains, _SearchText); }
private MailServerData GetNotificationEmailServer() { IMailServer emailServerApi = ObjectFactory.GetMailServer(); MailServerData mailServerData = new MailServerData(); Criteria<MailServerProperty> criteria = new Criteria<MailServerProperty>(); criteria.AddFilter(MailServerProperty.Type, CriteriaFilterOperator.EqualTo, MailServerType.CommunityEmailNotification); List<MailServerData> servers = emailServerApi.GetList(criteria); if (servers.Count > 0) { mailServerData = servers[0]; } return mailServerData; }
public Criteria<OrderProperty> Util_GetDates(Criteria<OrderProperty> orderCriteria) { SetTitle(GetMessage("lbl sales trend label")); if (drp_period.Items.Count == 0) { drp_period.Items.Add(new ListItem(GetMessage("lbl sync daily"), "#daily")); drp_period.Items.Add(new ListItem(GetMessage("lbl sync monthly"), "#monthly")); } switch (hdn_filter.Value) { //case "#weekly": // periodpulldown = "<a href=\"#periodMenu" + ClientID + "\" class=\"commerceperiod" + ClientID + " commerceperiodlink\">" + GetMessage("lbl sync weekly") + "</a>"; // orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(90, 0, 0, 0))); // break; case "#monthly": drp_period.SelectedIndex = 1; Intervals = 6; StartDate = DateTime.Now.AddMonths(Intervals * -1); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, StartDate); TrendTimeLineChart.TimeUnitInterval = controls_reports_TimeLineChart.TimeUnit.Month; break; //case "#quarterly": // periodpulldown = "<a href=\"#periodMenu" + ClientID + "\" class=\"commerceperiod" + ClientID + " commerceperiodlink\">" + GetMessage("lbl quarterly") + "</a>"; // orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.AddYears(-1)); // break; //case "#yearly": // periodpulldown = "<a href=\"#periodMenu" + ClientID + "\" class=\"commerceperiod" + ClientID + " commerceperiodlink\">" + GetMessage("lbl yearly") + "</a>"; // orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.AddYears(-3)); // break; default : // "#daily": drp_period.SelectedIndex = 0; Intervals = 7; StartDate = DateTime.Now.Subtract(new TimeSpan(Intervals, 0, 0, 0)); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, StartDate); TrendTimeLineChart.TimeUnitInterval = controls_reports_TimeLineChart.TimeUnit.Day; break; } return orderCriteria; }
private Ektron.Cms.Common.Criteria<RegionProperty> Util_AddCountrySearch(Ektron.Cms.Common.Criteria<RegionProperty> regionCriteria) { System.Collections.Generic.List<long> IdList = new System.Collections.Generic.List<long>(); Criteria<CountryProperty> countryListCriteria = new Criteria<CountryProperty>(); countryListCriteria.AddFilter(CountryProperty.Name, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchCriteria); _CountryList = _CountryApi.GetList(countryListCriteria); for (int i = 0; i <= (_CountryList.Count - 1); i++) { IdList.Add(_CountryList[i].Id); } if (IdList.Count > 0) { regionCriteria.AddFilter(RegionProperty.CountryId, Ektron.Cms.Common.CriteriaFilterOperator.In, IdList.ToArray()); } return regionCriteria; }
protected Type() { _CurrencyCriteria = new Criteria<CurrencyProperty>(); _CurrencyCriteria.AddFilter(CurrencyProperty.Enabled, CriteriaFilterOperator.EqualTo, true); _CurrencyData = _CurrencyApi.GetList(_CurrencyCriteria); }
/// <summary> /// Set Output /// </summary> protected void SetOutput() { ContentAPI contentApi = new ContentAPI(); Criteria<ContentProperty> criteria = new Criteria<ContentProperty>(); if (DaysLimit != 0) criteria.AddFilter(ContentProperty.DateModified, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.AddDays(-DaysLimit)); criteria.AddFilter(ContentProperty.Type, CriteriaFilterOperator.NotEqualTo, "1111"); criteria.AddFilter(ContentProperty.FolderName, CriteriaFilterOperator.NotEqualTo, "Workspace"); criteria.AddFilter(ContentProperty.FolderName, CriteriaFilterOperator.NotEqualTo, "_meta_"); criteria.AddFilter(ContentProperty.Status, CriteriaFilterOperator.EqualTo, "A"); if (ItemLimit > 0) { PagingInfo _pageInfo = new PagingInfo(ItemLimit); criteria.PagingInfo = _pageInfo; } contentList = contentApi.GetList(criteria); if (contentList.Count > 0) { LoadData(); grdData.Style.Add("display", "table"); } else { ltrlNoRecords.Text = GetMessage("lbl no records"); } //Set Title string title = ""; if (ItemLimit > PageSize) title = "Content Edited (" + grdData.Items.Count.ToString() + ")"; else title = "Content Edited (" + GetCountText(grdData.Items.Count) + ")"; SetTitle(title); //ltrlViewAll.Text = GetMessage("lbl view all") + " (" + GetCountText(grdData.Items.Count) + ")"; //lnkViewAll.OnClientClick = "top.showContentInWorkarea('" + EkFunctions.UrlEncode("reports.aspx?action=viewsubmitted") + "', 'Reports')"; }
protected void Display_ViewCustom() { List<OrderData> orderList = new List<OrderData>(); Criteria<OrderProperty> reportCriteria = new Criteria<OrderProperty>(); if (Request.QueryString["sites"] != "") { string[] sites = Request.QueryString["sites"].Split(",".ToCharArray()); List<string> tempSiteList = new List<string>(); for (int i = 0; i <= (sites.Length - 1); i++) { if (sites[i] != "") { tempSiteList.Add(sites[i]); } } reportCriteria.AddFilter(OrderProperty.Site, CriteriaFilterOperator.In, tempSiteList.ToArray()); } orderList = orderApi.GetList(reportCriteria); dg_orders.DataSource = orderList; dg_orders.DataBind(); Util_ShowSites(); }
protected void Display_ByDates() { DateTime startDate = Convert.ToDateTime(Request.QueryString["startdate"]); DateTime endDate = Convert.ToDateTime(Request.QueryString["enddate"]); List<OrderData> orderList = new List<OrderData>(); Criteria<OrderProperty> reportCriteria = new Criteria<OrderProperty>(); bool Toggle = true; reportCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, startDate); reportCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.LessThanOrEqualTo, endDate); reportCriteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize; reportCriteria.PagingInfo.CurrentPage = _currentPageNumber; orderList = orderApi.GetList(reportCriteria); if (orderList.Count > 0) { TotalPagesNumber = System.Convert.ToInt32(reportCriteria.PagingInfo.TotalPages); PagingInfo(TotalPagesNumber, Toggle); this.dg_orders.DataSource = orderList; this.dg_orders.DataBind(); } else { Toggle = false; PagingInfo(TotalPagesNumber, Toggle); literal1.Text = this.GetMessage("lbl no orders"); } }
public Dictionary<long, string> GetFolderList(int rootFolder, bool showNameOnly) { Dictionary<long, string> folders = new Dictionary<long, string>(); Ektron.Cms.Framework.Core.Folder.Folder folder = new Ektron.Cms.Framework.Core.Folder.Folder(); Criteria<FolderProperty> criteria = new Criteria<FolderProperty>(); criteria.AddFilter(FolderProperty.Id, CriteriaFilterOperator.EqualTo, rootFolder); criteria.PagingInfo.RecordsPerPage = int.MaxValue - 1; List<FolderData> folderList = folder.GetList(criteria); if (folderList == null || folderList.Count == 0) return folders; string root = folderList[0].NameWithPath; folders.Add(rootFolder, showNameOnly ? folderList[0].Name : "/"); List<long> orderedFolders = new List<long>(); orderedFolders.Add(rootFolder); AddFolders(new long[] { rootFolder }, root, showNameOnly, ref folders, ref orderedFolders); // Need to sort Dictionary<long, string> ordered = new Dictionary<long, string>(); for (int i = 0; i < orderedFolders.Count; i++) if (!ordered.ContainsKey(orderedFolders[i])) ordered.Add(orderedFolders[i], folders[orderedFolders[i]]); return ordered; }
public Dictionary<int, string> GetShortLocaleList() { _shortLocaleList = (Dictionary<int, string>)Cache[shortLocaleCacheKey]; if (_shortLocaleList == null) lock (_shortLocaleListLock) if (_shortLocaleList == null) { Ektron.Cms.Framework.Localization.LocaleManager locale = new Ektron.Cms.Framework.Localization.LocaleManager(); Criteria<Ektron.Cms.Localization.LocaleProperty> criteria = new Criteria<Ektron.Cms.Localization.LocaleProperty>(Ektron.Cms.Localization.LocaleProperty.LangCode, EkEnumeration.OrderByDirection.Ascending); criteria.AddFilter(Ektron.Cms.Localization.LocaleProperty.Enabled, CriteriaFilterOperator.EqualTo, true); criteria.PagingInfo.RecordsPerPage = int.MaxValue - 1; List<Ektron.Cms.Localization.LocaleData> locales = locale.GetList(criteria); _shortLocaleList = new Dictionary<int, string>(); foreach (Ektron.Cms.Localization.LocaleData l in locales) if (!_shortLocaleList.ContainsKey(l.Id)) _shortLocaleList.Add(l.Id, l.Loc); Cache.Add(shortLocaleCacheKey, _shortLocaleList, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 20, 0), System.Web.Caching.CacheItemPriority.Normal, null); } return _shortLocaleList; }
public Criteria<OrderPaymentProperty> Util_GetCriteria(Criteria<OrderPaymentProperty> paymentCriteria) { // paymentCriteria.PagingInfo = new PagingInfo(5); paymentCriteria.OrderByDirection = EkEnumeration.OrderByDirection.Ascending; paymentCriteria.OrderByField = OrderPaymentProperty.CapturedDate; paymentCriteria.AddFilter(OrderPaymentProperty.CapturedDate, CriteriaFilterOperator.GreaterThanOrEqualTo, EkFunctions.ReadDbDate(hdn_filter_start.Value)); paymentCriteria.AddFilter(OrderPaymentProperty.CapturedDate, CriteriaFilterOperator.LessThanOrEqualTo, EkFunctions.ReadDbDate(hdn_filter_end.Value)); SetTitle(GetMessage("lbl payments label")); ltr_period.Text = GetMessage("lbl coupon start date") + ":<a href=\"#dateMenu" + ClientID + "start\" class=\"commerceperiod" + ClientID + "start commerceperiodlink\" id=\"commerceperiod" + ClientID + "start\">" + startDate.ToShortDateString() + "</a>   " + GetMessage("lbl end date") + ":<a href=\"#dateMenu" + ClientID + "end\" class=\"commerceperiod" + ClientID + "end commerceperiodlink\" id=\"commerceperiod" + ClientID + "end\">" + endDate.ToShortDateString() + "</a> - <a href=\"#doMenu" + ClientID + "\" class=\"commerceaction" + ClientID + " commerceactionlink\">" + GetMessage("lbl set new dates") + "</a>"; return paymentCriteria; }
/// <summary> /// Saves the supplied TargetedContent Configuration. /// </summary> /// <param name="targetConfiguration"></param> public void SaveConfiguration(TargetedContentData targetConfiguration) { //update TargetedContentConfiguration properties with current widget configuration targetConfiguration.PageData.Zones[0].Columns = Ektron.Cms.PageBuilder.ColumnData.ConvertToColumnDataSerializeList(_currentColumns); //get list of child column Ids List<Guid> columnIdList = new List<Guid>(); _currentColumns.ForEach(c => columnIdList.Add(c.Guid)); //Get all widgets that targeted content uses. Ektron.Cms.PageBuilder.PageBuilder pb = this.Page as Ektron.Cms.PageBuilder.PageBuilder; targetConfiguration.PageData.Widgets = pb.Pagedata.Widgets.FindAll(w => columnIdList.Contains(w.ColumnGuid)); //remove targetcontent widgets from pagebuilder page. //they wil be added at runtime when the targeted content configuration is loaded. //targetConfiguration.PageData.Widgets.ForEach(w => pb.Pagedata.Widgets.Remove(w)); if (targetConfiguration.Id == 0) { Criteria<TargetedContentProperty> criteria = new Criteria<TargetedContentProperty>(); criteria.AddFilter(TargetedContentProperty.Name, CriteriaFilterOperator.Contains, targetConfiguration.Name); List<TargetedContentData> list = TargetContentManager.GetList(criteria); if (list.Count > 0) { targetConfiguration.Name = string.Format("{0}({1})", targetConfiguration.Name, list.Count); } TargetContentManager.Add(targetConfiguration); } else { TargetContentManager.Update(targetConfiguration); } TargetConfigurationId = targetConfiguration.Id; }
public void RaiseCallbackEvent(string eventArgs) { _PostBackResult = true; if (eventArgs != String.Empty) { //set up coupon code search List<CouponData> couponList; Criteria<CouponProperty> couponCriteria = new Criteria<CouponProperty>(); //set search criteria couponCriteria.AddFilter(CouponProperty.Code, CriteriaFilterOperator.EqualTo, eventArgs); //retreive coupon list data couponList = _CouponApi.GetList(couponCriteria); //if couponList is greater than zero the couponCode is already in use (return false) //if coupoinList is zero couponCode is NOT in use (return true) _PostBackResult = couponList.Count > 0 ? false : true; } _CallbackResult = _PostBackResult.ToString().ToLower(); }
/// <summary> /// Method to display the List of Inventory based of the selection. /// </summary> private void Display_Viewall() { List<InventoryData> _inventoryList = new System.Collections.Generic.List<InventoryData>(); Criteria<InventoryProperty> inventoryCriteria = new Criteria<InventoryProperty>(); switch (this.m_sPageAction) { case "byproduct": inventoryCriteria.AddFilter(InventoryProperty.EntryType, CriteriaFilterOperator.EqualTo, EkEnumeration.CatalogEntryType.Product); break; case "bykit": inventoryCriteria.AddFilter(InventoryProperty.EntryType, CriteriaFilterOperator.EqualTo, EkEnumeration.CatalogEntryType.Kit); break; case "bycomplexproduct": inventoryCriteria.AddFilter(InventoryProperty.EntryType, CriteriaFilterOperator.EqualTo, EkEnumeration.CatalogEntryType.ComplexProduct); break; case "bybundle": inventoryCriteria.AddFilter(InventoryProperty.EntryType, CriteriaFilterOperator.EqualTo, EkEnumeration.CatalogEntryType.Bundle); break; case "bysubscriptionproduct": inventoryCriteria.AddFilter(InventoryProperty.EntryType, CriteriaFilterOperator.EqualTo, EkEnumeration.CatalogEntryType.SubscriptionProduct); break; } if (_sortCriteria.IndexOf("-") > -1) { inventoryCriteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Descending; } else { inventoryCriteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending; } switch (_sortCriteria.Replace("-", "")) { case "name": inventoryCriteria.OrderByField = InventoryProperty.EntryTitle; break; case "unitsinstock": inventoryCriteria.OrderByField = InventoryProperty.UnitsInStock; break; case "reorderlevel": inventoryCriteria.OrderByField = InventoryProperty.ReorderLevel; break; case "unitsonorder": inventoryCriteria.OrderByField = InventoryProperty.UnitsOnOrder; break; default: inventoryCriteria.OrderByField = InventoryProperty.EntryTitle; break; } inventoryCriteria.PagingInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize; inventoryCriteria.PagingInfo.CurrentPage = _currentPageNumber; _inventoryList = _inventoryApi.GetList(inventoryCriteria); TotalPagesNumber = System.Convert.ToInt32(inventoryCriteria.PagingInfo.TotalPages); if (TotalPagesNumber <= 1) { TotalPages.Visible = false; CurrentPage.Visible = false; lnkBtnPreviousPage.Visible = false; NextPage.Visible = false; LastPage.Visible = false; FirstPage.Visible = false; PageLabel.Visible = false; OfLabel.Visible = false; } else { lnkBtnPreviousPage.Enabled = true; FirstPage.Enabled = true; LastPage.Enabled = true; NextPage.Enabled = true; TotalPages.Visible = true; CurrentPage.Visible = true; lnkBtnPreviousPage.Visible = true; NextPage.Visible = true; LastPage.Visible = true; FirstPage.Visible = true; PageLabel.Visible = true; OfLabel.Visible = true; TotalPages.Text = (System.Math.Ceiling(Convert.ToDecimal(TotalPagesNumber))).ToString(); TotalPages.ToolTip = TotalPages.Text; CurrentPage.Text = _currentPageNumber.ToString(); CurrentPage.ToolTip = CurrentPage.Text; if (_currentPageNumber == 1) { lnkBtnPreviousPage.Enabled = false; FirstPage.Enabled = false; } else if (_currentPageNumber == TotalPagesNumber) { NextPage.Enabled = false; LastPage.Enabled = false; } } dg_inventorylines.DataSource = _inventoryList; dg_inventorylines.DataBind(); }
private void Display_PricingTab() { List<CurrencyData> activeCurrencyList = m_refCurrency.GetActiveCurrencyList(); List<ExchangeRateData> exchangeRateList = new List<ExchangeRateData>(); if (activeCurrencyList.Count > 1) { ExchangeRateApi exchangeRateApi = new ExchangeRateApi(); Criteria<ExchangeRateProperty> exchangeRateCriteria = new Criteria<ExchangeRateProperty>(); List<long> currencyIDList = new List<long>(); for (int i = 0; i <= (activeCurrencyList.Count - 1); i++) { currencyIDList.Add(activeCurrencyList[i].Id); } exchangeRateCriteria.AddFilter(ExchangeRateProperty.BaseCurrencyId, CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.CommerceSettings.DefaultCurrencyId); exchangeRateCriteria.AddFilter(ExchangeRateProperty.ExchangeCurrencyId, CriteriaFilterOperator.In, currencyIDList.ToArray()); exchangeRateList = exchangeRateApi.GetCurrentList(exchangeRateCriteria); } bool showPricingTier = this.ShowPricingTier(); ltr_pricing.Text = this.CommerceLibrary.GetPricingMarkup(entry_edit_data.Pricing, activeCurrencyList, exchangeRateList, entry_edit_data.EntryType, showPricingTier, Util_GetMode()); }
public Criteria<OrderProperty> Util_GetDates(Criteria<OrderProperty> orderCriteria) { string periodText = String.Empty; switch (hdn_filter.Value) { case "#yesterday": periodText = GetMessage("lbl yesterday"); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.LessThanOrEqualTo, DateTime.Now.Date); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Date.Subtract(new TimeSpan(1, 0, 0, 0))); break; case "#thisweek": periodText = GetMessage("lbl this week"); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(DateTime.Now.DayOfWeek.GetHashCode(), 0, 0, 0))); break; case "#last7days": periodText = GetMessage("lbl last seven days"); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0))); break; case "#thismonth": periodText = GetMessage("lbl this month"); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(DateTime.Now.Date.Day, 0, 0, 0))); break; case "#last30days": periodText = GetMessage("lbl last thirty days"); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(30, 0, 0, 0))); break; case "#thisyear": periodText = GetMessage("lbl this year"); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(DateTime.Now.DayOfYear, 0, 0, 0))); break; default: // "#today": periodText = GetMessage("today"); orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Date); break; } SetTitle(GetMessage("lbl top products label")); ltr_period.Text = "<a href=\"#periodMenu" + this.ClientID + "\" class=\"commerceperiod" + this.ClientID + " commerceperiodlink\">" + periodText + "</a>" + "   " + GetMessage("lbl quantity") + " " + "<a href=\"#\" class=\"quantitySection" + this.ClientID + " commerceactionlink\" >" + _qty.ToString() + "</a>"; return orderCriteria; }
private void Bind() { if (!IsPostBack) { hdnTargetContentSelectId.Value = "0"; } TargetedContent targetContentManager = new TargetedContent(_contentApi.RequestInformationRef); Criteria<TargetedContentProperty> criteria = new Criteria<TargetedContentProperty>(); criteria.PagingInfo.CurrentPage = ucPaging.SelectedPage; criteria.PagingInfo.RecordsPerPage = _contentApi.RequestInformationRef.PagingSize; criteria.AddFilter(TargetedContentProperty.IsGlobal, CriteriaFilterOperator.EqualTo, true); List<TargetedContentData> targetContentList = targetContentManager.GetList(criteria); ViewAllRepeater.DataSource = targetContentList; ViewAllRepeater.DataBind(); if (criteria.PagingInfo.TotalPages < 2) { ucPaging.Visible = false; } else { ucPaging.CurrentPageIndex = criteria.PagingInfo.CurrentPage - 1; ucPaging.TotalPages = criteria.PagingInfo.TotalPages; } hdnTargetContentListUrl.Value = targetContentManager.RequestInformation.SitePath + "widgets/targetedcontent/controls/targetcontentlist.aspx"; }
private void FillContentInfo() { //cConts = m_refContent.GetAllViewableChildContentInfoV4_2(cTmp) if (folderType == EkEnumeration.FolderType.Catalog) { CatalogEntryApi catalogAPI = new CatalogEntryApi(); Criteria<EntryProperty> criteria = new Criteria<EntryProperty>(); criteria.PagingInfo = new PagingInfo(m_refContentApi.RequestInformationRef.PagingSize); criteria.PagingInfo.CurrentPage = _currentPageNumber; criteria.AddFilter(EntryProperty.CatalogId, CriteriaFilterOperator.EqualTo, FolderId); criteria.AddFilter(EntryProperty.LanguageId, CriteriaFilterOperator.EqualTo, ContentLanguage); criteria.OrderByField = EntryProperty.Title; entryList = catalogAPI.GetList(criteria); TotalPagesNumber = System.Convert.ToInt32(criteria.PagingInfo.TotalPages); } else { cConts = m_refContent.GetAllViewableChildInfov5_0(cTmp, _currentPageNumber, m_refContentApi.RequestInformationRef.PagingSize, ref TotalPagesNumber, Ektron.Cms.Common.EkEnumeration.CMSContentType.NonLibraryContent, EkEnumeration.CMSContentSubtype.AllTypes); } if (overrideContentEnum == "calfolder" || TotalPagesNumber <= 1) { TotalPages.Visible = false; CurrentPage.Visible = false; lnkBtnPreviousPage.Visible = false; NextPage.Visible = false; LastPage.Visible = false; FirstPage.Visible = false; PageLabel.Visible = false; OfLabel.Visible = false; } else { TotalPages.Visible = true; CurrentPage.Visible = true; lnkBtnPreviousPage.Visible = true; NextPage.Visible = true; LastPage.Visible = true; FirstPage.Visible = true; PageLabel.Visible = true; OfLabel.Visible = true; TotalPages.Text = (System.Math.Ceiling(Convert.ToDouble(TotalPagesNumber))).ToString(); TotalPages.ToolTip = TotalPages.Text; CurrentPage.Text = _currentPageNumber.ToString(); CurrentPage.ToolTip = CurrentPage.Text; if (_currentPageNumber == 1) { lnkBtnPreviousPage.Enabled = false; if (TotalPagesNumber > 1) { NextPage.Enabled = true; } else { NextPage.Enabled = false; } } else { lnkBtnPreviousPage.Enabled = true; if (_currentPageNumber == TotalPagesNumber) { NextPage.Enabled = false; } else { NextPage.Enabled = true; } } } DrawData(); }
public Dictionary<int, string> GetShortLocaleList() { if (_shortLocaleList == null) lock (_shortLocaleListLock) if (_shortLocaleList == null) { Ektron.Cms.Framework.Localization.LocaleManager locale = new Ektron.Cms.Framework.Localization.LocaleManager(); Criteria<Ektron.Cms.Localization.LocaleProperty> criteria = new Criteria<Ektron.Cms.Localization.LocaleProperty>(); criteria.AddFilter(Ektron.Cms.Localization.LocaleProperty.Enabled, CriteriaFilterOperator.EqualTo, true); List<Ektron.Cms.Localization.LocaleData> locales = locale.GetList(criteria); _shortLocaleList = new Dictionary<int, string>(); foreach (Ektron.Cms.Localization.LocaleData l in locales) if (!_shortLocaleList.ContainsKey(l.LCID)) _shortLocaleList.Add(l.LCID, l.Loc); } return _shortLocaleList; }