public void Refresh() { OnRefreshing(); try { resources = new ItemList<Resource>(); HiveServiceLocator.Instance.CallHiveService(service => { service.GetSlaveGroups().ForEach(g => resources.Add(g)); service.GetSlaves().ForEach(s => resources.Add(s)); }); } catch { throw; } finally { OnRefreshed(); } }
public void OnActionExecuted(ActionExecutedContext filterContext) { object model = filterContext.Controller.ViewData.Model; IItemList itemlist = model as IItemList; if (itemlist != null) { IPageOfList pagedList = itemlist.Items as IPageOfList; if (pagedList != null) { pagedList.PageIndex = 1; pagedList.PageSize = int.MaxValue; filterContext.Result = new ExcelResult(itemlist.Items, pagedList.GetType().GetGenericArguments()[0], _securityHelper); } } EcardModelReportRequest report = model as EcardModelReportRequest; if (report != null) { report.PageIndex = 1; report.PageSize = int.MaxValue; filterContext.Result = new ExcelTableResult(report.Table); } }
public void RefreshCalendar() { if (downtimeForResourceId != null && downtimeForResourceId != Guid.Empty) { OnRefreshing(); try { downtimes = new ItemList<Downtime>(); HiveServiceLocator.Instance.CallHiveService(service => { service.GetDowntimesForResource(downtimeForResourceId).ForEach(d => downtimes.Add(d)); }); } catch { throw; } finally { OnRefreshed(); } } }
public ReadOnlyItemList(IItemList <T> list) : base(list) { }
public MultiOperator() : base() { this.operators = new ItemList <T>(); Initialize(); }
protected MultiOperator(MultiOperator <T> original, Cloner cloner) : base(original, cloner) { this.operators = cloner.Clone <IItemList <T> >(original.operators); Initialize(); }
public NextItemCommand(IItemList ItemList) { list = ItemList; }
private void UpdateResources() { ResetView(); try { if (!Access.UserInformation.Instance.UserExists) { //do a refresh just in case that the user has changed his usr and pwd in between Access.UserInformation.Instance.Refresh(); } HiveAdminClient.Instance.Refresh(); Content = HiveAdminClient.Instance.Resources; } catch (MessageSecurityException) { ShowMessageSecurityException(); } catch (AnonymousUserException) { ShowHiveInformationDialog(); } }
public PreviousItemCommand(IItemList ItemList) { list = ItemList; }
public ItemController(IItemList _acontext) { acontext = _acontext; }
private void dg_ItemsSourceChanged(object sender, EventArgs e) { if (settingUp) { return; } DataGrid dataGrid = (DataGrid)sender; IItemList list = GetDataList(scen); for (int r = 0; r < dataGrid.Items.Count; r++) { DataRowView item = dataGrid.Items[r] as DataRowView; if (item == null) { continue; } int id = (int)item["id"]; T p = (T)list.GetGameObject(id); if (p == null) { p = Activator.CreateInstance <T>(); list.Add(p); } FieldInfo[] fields = getFieldInfos(); PropertyInfo[] properties = getPropertyInfos(); foreach (FieldInfo i in fields) { string iName = getColumnName(i.Name); if (i.FieldType.IsEnum) { i.SetValue(p, (Int32)Enum.ToObject(i.FieldType, item[iName])); } else if (i.FieldType == typeof(InfluenceKind)) { i.SetValue(p, scen.GameCommonData.AllInfluenceKinds.GetInfluenceKind((int)item[iName])); } else if (i.FieldType == typeof(ConditionKind)) { i.SetValue(p, scen.GameCommonData.AllConditionKinds.GetConditionKind((int)item[iName])); } else if (i.FieldType == typeof(TitleKind)) { i.SetValue(p, scen.GameCommonData.AllTitleKinds.GetTitleKind((int)item[iName])); } else if (i.FieldType == typeof(GameObjects.ArchitectureDetail.EventEffect.EventEffectKind)) { i.SetValue(p, scen.GameCommonData.AllEventEffectKinds.GetEventEffectKind((int)item[iName])); } else if (i.FieldType == typeof(GameObjects.TroopDetail.EventEffect.EventEffectKind)) { i.SetValue(p, scen.GameCommonData.AllTroopEventEffectKinds.GetEventEffectKind((int)item[iName])); } else if (i.FieldType == typeof(List <int>)) { i.SetValue(p, item[iName].ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select((x) => int.Parse(x)).ToList()); } else { if (item[iName] != DBNull.Value) { i.SetValue(p, item[iName]); } } } foreach (PropertyInfo i in properties) { string iName = getColumnName(i.Name); if (i.PropertyType.IsEnum) { i.SetValue(p, (Int32)Enum.ToObject(i.PropertyType, item[iName])); } else if (i.PropertyType == typeof(InfluenceKind)) { i.SetValue(p, scen.GameCommonData.AllInfluenceKinds.GetInfluenceKind((int)item[iName])); } else if (i.PropertyType == typeof(ConditionKind)) { i.SetValue(p, scen.GameCommonData.AllConditionKinds.GetConditionKind((int)item[iName])); } else if (i.PropertyType == typeof(TitleKind)) { i.SetValue(p, scen.GameCommonData.AllTitleKinds.GetTitleKind((int)item[iName])); } else if (i.PropertyType == typeof(GameObjects.ArchitectureDetail.EventEffect.EventEffectKind)) { i.SetValue(p, scen.GameCommonData.AllEventEffectKinds.GetEventEffectKind((int)item[iName])); } else if (i.PropertyType == typeof(GameObjects.TroopDetail.EventEffect.EventEffectKind)) { i.SetValue(p, scen.GameCommonData.AllTroopEventEffectKinds.GetEventEffectKind((int)item[iName])); } else if (i.PropertyType == typeof(List <int>)) { i.SetValue(p, item[iName].ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select((x) => int.Parse(x)).ToList()); } else { if (item[iName] != DBNull.Value) { i.SetValue(p, item[iName]); } } } } }
public LibraryPageVM(IItemList itemList, IItemViewer itemViewer) { ItemList = itemList; ItemViewer = itemViewer; }
public ContainerPack(IItemList <ItemObject> innerItems, IRender render, GameObject container) { this.innerItems = innerItems; this.render = render; this.container = container; }
public IPromotionResult ApplyPromotion(IPromotionFactory promotionFactory, IPromotionRule promotion, IItemList items) { throw new NotImplementedException(); }
private void ApplyPromotionForItemsCombination(IPromotionRule promotion, IItemList items) { var discountCombinationItems = promotion.GetItemCombinationList(); var shoppingCartClone = items.GetItemList(); var itemsMarkedForDiscount = new List <KartItem>(); var eligibleForDiscount = false; foreach (var itemsCountsCombination in discountCombinationItems) { var shoppedItem = items.GetItemList() .Where(ci => ci.ItemObj == itemsCountsCombination.Key) .Select(ci => ci) .Single(); if (shoppedItem.Equals(new KeyValuePair <Item, int>())) { eligibleForDiscount = false; break; } if (shoppedItem.ItemQuantity >= itemsCountsCombination.Value) { eligibleForDiscount = true; itemsMarkedForDiscount.Add(new KartItem(shoppedItem.ItemObj, shoppedItem.ItemQuantity)); var prod = shoppedItem.ItemObj; shoppingCartClone.Remove(shoppedItem); var remainingCount = shoppedItem.ItemQuantity % itemsCountsCombination.Value; shoppingCartClone.Add(new KartItem(prod, remainingCount)); } } if (eligibleForDiscount) { int[] arr = new int[itemsMarkedForDiscount.Count]; int i = 0; // We need to iterate through the collection to get the multipler for promotional KartItem foreach (var it in itemsMarkedForDiscount) { arr[i] = it.ItemQuantity; i++; } int multiplier = arr.Min(); //Once we get the correct multipler, we need to correct Quantity in original Kart, so that correct amount can be calculated. foreach (var it in itemsMarkedForDiscount) { var shoppedItem = items.GetItemList() .Where(ci => ci.ItemObj == it.ItemObj) .Select(ci => ci) .Single(); shoppedItem.ItemQuantity += it.ItemQuantity - multiplier; shoppedItem.AmountPayable = shoppedItem.ItemQuantity * shoppedItem.ItemObj.ItemPrice; } //Here we are adding new KartItem for promotion items. double amount = promotion.PromotionAmount * multiplier; Item itm = new Item(); itm.ItemName = promotion.PromotionName; itm.ItemPrice = promotion.PromotionAmount; KartItem ktm = new KartItem(itm, multiplier); items.AddKartItem(ktm); } else //reverse and restore { itemsMarkedForDiscount.ForEach(it => { shoppingCartClone.Remove(shoppingCartClone.Find(p => p.ItemObj == it.ItemObj)); shoppingCartClone.Add(it); }); } }
public void ApplyPromotion(IPromotionRule promotion, IItemList items) { ApplyPromotionForItemsCombination(promotion, items); }