예제 #1
0
        public ActionResult alterarDadosPagamentos(EditableItem ViewModel)
        {
            var Retorno = OLogTituloReceitaPagamentoBL.alterarCampo(ViewModel.pk.toInt(), ViewModel.name, ViewModel.value, ViewModel.nomeCampoDisplay, ViewModel.oldValue, ViewModel.newValue);

            if (!Retorno.flagError)
            {
                if (ViewModel.name == "valorOriginal" && Retorno.flagError != true)
                {
                    this.onAtualizarValorTituloReceita.subscribe(new OnAtualizarValorTituloReceitaHandler());

                    this.onAtualizarValorTituloReceita.publish(Retorno.info);
                }

                var listaOutrosPagamentos = this.OTituloReceitaPagamentoBL.listar(Retorno.info.toInt()).Select(x => new { x.dtVencimento, x.id }).ToList();

                var id = ViewModel.pk.toInt();

                var OPagamento = listaOutrosPagamentos.FirstOrDefault(y => y.id == id);

                var flagHabilitarAtualizarTodos    = listaOutrosPagamentos.Count() > 1;
                var flagHabilitarAtualizarProximos = listaOutrosPagamentos.Any(x => x.dtVencimento > OPagamento.dtVencimento || (OPagamento.id > x.id && OPagamento.dtVencimento == x.dtVencimento));

                return(Json(new {
                    Retorno.flagError,
                    Retorno.listaErros,
                    flagHabilitarAtualizarTodos,
                    flagHabilitarAtualizarProximos,
                    ViewModel.nomeCampoDisplay,
                    ViewModel.oldValue,
                    ViewModel.newValue
                }));
            }

            return(Json(new { Retorno.flagError, Retorno.listaErros }));
        }
예제 #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("OMGHAI!");

            CompositeItem items = new CompositeItem();

            items.Add(EditableItem.Create(name: "+5 Dexterity Vest", sellIn: 10, quality: 20));
            items.Add(AgedBrie.Create(sellIn: 2, quality: 0));
            items.Add(EditableItem.Create(name: "Elixir of the Mongoose", sellIn: 5, quality: 7));
            items.Add(Sulfuras.Create(sellIn: 0, quality: 80));
            items.Add(Sulfuras.Create(sellIn: -1, quality: 80));
            items.Add(ConcertBackstagePass.Create(concertName: "TAFKAL80ETC", sellIn: 15, quality: 20));
            items.Add(ConcertBackstagePass.Create(concertName: "TAFKAL80ETC", sellIn: 10, quality: 49));
            items.Add(ConcertBackstagePass.Create(concertName: "TAFKAL80ETC", sellIn: 5, quality: 49));
            items.Add(Conjured.Create(name: "Conjured Mana Cake", sellIn: 3, quality: 6));

            GildedRose app = new GildedRose(items);


            for (var i = 0; i < 31; i++)
            {
                Console.WriteLine("-------- day " + i + " --------");
                Console.WriteLine("name, sellIn, quality");

                items.DisplayItems();

                app.UpdateItemsQualityAfterADay();
            }
        }
예제 #3
0
        private void CustomerSelected(CustomerModel customer)
        {
            EditableItem.CustomerID = customer.CustomerID;
            EditableItem.Customer   = customer;

            EditableItem.NotifyChanges();
        }
예제 #4
0
        private void ProductSelected(ProductModel product)
        {
            EditableItem.ProductID = product.ProductID;
            EditableItem.UnitPrice = product.ListPrice;
            EditableItem.Product   = product;

            EditableItem.NotifyChanges();
        }
    private void onObjectAdded(RectTransform item, int index)
    {
        EditableItem component = item.GetComponent <EditableItem>();

        component.ResetItem();
        component.SetEditable(isEditStateActive);
        Service.Get <EventDispatcher>().DispatchEvent(new EditableItemEvents.ItemReady(component, index));
    }
예제 #6
0
        public void decrementNormalItemQualityOnceAfterADay()
        {
            EditableItem item = EditableItem.Create("Berger", sellIn: 2, quality: 5);
            GildedRose   app  = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(4, item.Quality);
            Assert.AreEqual(1, item.SellIn);
        }
예제 #7
0
        private void PlaceSelected(PlaceModel place)
        {
            EditableItem.PlaceID         = place.PlaceID;
            EditableItem.ShipAddress     = place.Address;
            EditableItem.ShipCity        = place.City;
            EditableItem.ShipRegion      = place.Region;
            EditableItem.ShipCountryCode = place.CountryCode;
            EditableItem.ShipPostalCode  = place.PostalCode;
            EditableItem.Place           = place;

            EditableItem.NotifyChanges();
        }
예제 #8
0
        private void CustomerSelected(CustomerModel customer)
        {
            EditableItem.CustomerID      = customer.CustomerID;
            EditableItem.ShipAddress     = customer.AddressLine1;
            EditableItem.ShipCity        = customer.City;
            EditableItem.ShipRegion      = customer.Region;
            EditableItem.ShipCountryCode = customer.CountryCode;
            EditableItem.ShipPostalCode  = customer.PostalCode;
            EditableItem.Customer        = customer;

            EditableItem.NotifyChanges();
        }
    private void onEditableItemPrefabLoaded(string path, GameObject editableItemPrefab)
    {
        editableItemInstance = UnityEngine.Object.Instantiate(editableItemPrefab);
        EditableItem componentInChildren = editableItemInstance.GetComponentInChildren <EditableItem>();

        if (componentInChildren != null)
        {
            EditableItem editableItem = componentInChildren;
            editableItem.OnContentLoaded = (Action <GameObject>)Delegate.Combine(editableItem.OnContentLoaded, new Action <GameObject>(onEditableItemContentLoaded));
            componentInChildren.LoadContentPrefab(prefabContentKey);
        }
    }
    private void removeItem(EditableItem editableItem)
    {
        EquipmentIcon iconItem = editableItem.GetComponentInChildren <EquipmentIcon>();

        indexToRemove = editableItem.GetCurrentIndex();
        PromptDefinition promptDefinition = Service.Get <PromptManager>().GetPromptDefinition("DeleteEquipmentPrompt");
        PromptLoaderCMD  promptLoaderCMD  = new PromptLoaderCMD(this, promptDefinition, delegate(PromptLoaderCMD loader)
        {
            showRemoveItemPrompt(loader, iconItem);
        });

        promptLoaderCMD.Execute();
    }
예제 #11
0
        public void itemQualityNeverExceedsMaxWhenIncrementingPerDay()
        {
            EditableItem agedBrie      = AgedBrie.Create(sellIn: 3, quality: MAX_QUANTITY);
            EditableItem backstagePass =
                ConcertBackstagePass.Create(concertName: "TaylorFast", sellIn: 3, quality: MAX_QUANTITY);

            items.Add(agedBrie);
            items.Add(backstagePass);

            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(MAX_QUANTITY, agedBrie.Quality);
            Assert.AreEqual(MAX_QUANTITY, backstagePass.Quality);
        }
    private bool onItemReady(EditableItemEvents.ItemReady evt)
    {
        int           index = evt.Index;
        EditableItem  item  = evt.Item;
        EquipmentIcon componentInChildren = item.GetComponentInChildren <EquipmentIcon>();

        switch (index)
        {
        case 0:
            item.ShowActionButton = false;
            componentInChildren.SetupCreateButton();
            break;

        case 1:
            item.ShowActionButton = false;
            componentInChildren.SetupCatalogButton();
            break;

        default:
        {
            componentInChildren.SetupEquipmentButton();
            long key = model.DisplayedInventory[index - 2];
            InventoryIconModel <DCustomEquipment> inventoryIconModel = model.InventoryData.Inventory[key];
            item.ShowActionButton = true;
            item.Action           = EditableItem.ActionType.Delete;
            if (templateDefinitions.TryGetValue(inventoryIconModel.Data.DefinitionId, out TemplateDefinition value) && !value.IsEditable)
            {
                if (inventoryIconModel.IsHidden)
                {
                    item.Action = EditableItem.ActionType.Hide;
                }
                else
                {
                    item.Action = EditableItem.ActionType.Show;
                }
            }
            AccessibilitySettings component = componentInChildren.GetComponent <AccessibilitySettings>();
            if (component != null)
            {
                component.CustomToken = value.Name;
            }
            setItemView(componentInChildren, inventoryIconModel);
            break;
        }
        }
        return(false);
    }
        public ActionResult alterarDados(EditableItem ViewModel)
        {
            UtilRetorno ORetorno    = new UtilRetorno();
            int         idPagamento = ViewModel.pk.toInt();

            if (ORetorno.flagError == false)
            {
                ORetorno = OTituloReceitaPagamentoAlteracaoDadosBL.alterarCampo(idPagamento, ViewModel.name, ViewModel.value, ViewModel.nomeCampoDisplay, ViewModel.oldValue, ViewModel.newValue);
            }

            if (!ViewModel.viewName.isEmpty() && ORetorno.flagError)
            {
                return(PartialView(ViewModel.viewName, ViewModel));
            }

            return(Json(new { error = ORetorno.flagError, message = string.Join("<br />", ORetorno.listaErros), ViewModel.targetBox, ViewModel.value }));
        }
예제 #14
0
        public void itemQualityNeverNegative()
        {
            EditableItem item1         = EditableItem.Create("Syomay", sellIn: 5, quality: 0);
            EditableItem backstagePass = ConcertBackstagePass.Create("TaylorFast", sellIn: 0, quality: 0);
            EditableItem conjured      = Conjured.Create("Conjured", sellIn: 0, quality: 2);

            items.Add(item1);
            items.Add(backstagePass);
            items.Add(conjured);

            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(0, item1.Quality);
            Assert.AreEqual(0, backstagePass.Quality);
            Assert.AreEqual(0, conjured.Quality);
        }
        public ActionResult alterarDados(EditableItem ViewModel)
        {
            var Retorno = OAlteracaoDadoBL.alterarCampo(
                ViewModel.pk.toInt()
                , ViewModel.name
                , ViewModel.value
                , ViewModel.nomeCampoDisplay
                , ViewModel.oldValue
                , ViewModel.newValue);

            if (!ViewModel.viewName.isEmpty() && Retorno.flagError == true)
            {
                this.Flash(UtilMessage.TYPE_MESSAGE_ERROR, UtilMessage.error("Erro!", "Algo não funcionou como esperado, Contate o suporte técnico"));

                return(PartialView(ViewModel.viewName, ViewModel));
            }
            return(Json(
                       new { error = Retorno.flagError, message = string.Join("<br />", Retorno.listaErros), ViewModel.targetBox, ViewModel.value }));
        }
    private bool onEditableItemActionButtonClicked(EditableItemEvents.ActionButtonClicked evt)
    {
        EditableItem item = evt.Item;

        if (evt.Action == EditableItem.ActionType.Delete)
        {
            removeItem(item);
        }
        else if (evt.Action == EditableItem.ActionType.Hide)
        {
            EquipmentIcon componentInChildren = item.GetComponentInChildren <EquipmentIcon>();
            model.HideItem(componentInChildren.EquipmentId);
        }
        else if (evt.Action == EditableItem.ActionType.Show)
        {
            EquipmentIcon componentInChildren = item.GetComponentInChildren <EquipmentIcon>();
            model.ShowItem(componentInChildren.EquipmentId);
        }
        return(false);
    }
        public ActionResult modalAlterarTextEditor(EditableItem ViewModel)
        {
            ViewModel.viewName = "modal-alterar-texteditor";

            return(PartialView(ViewModel));
        }
예제 #18
0
 public ItemReady(EditableItem item, int index)
 {
     Item  = item;
     Index = index;
 }
예제 #19
0
 public GildedRose(EditableItem item)
 {
     validateItems(item);
     Item = item;
 }
예제 #20
0
 private void validateItems(EditableItem item)
 {
     item.ValidateInitialQuality();
 }
예제 #21
0
 public ItemDisappeared(EditableItem item)
 {
     Item = item;
 }
예제 #22
0
 public ActionButtonClicked(EditableItem item, EditableItem.ActionType action)
 {
     Item   = item;
     Action = action;
 }
예제 #23
0
        public void throwErrorWhenItemQualityIsInitiallyGreaterThan50()
        {
            EditableItem item = EditableItem.Create("Item", sellIn: 5, quality: MAX_QUANTITY + 1);

            Assert.Throws <QualityExceededLimitException>(() => new GildedRose(item));
        }
예제 #24
0
 public void Add(EditableItem item)
 {
     items.Add(item);
 }