Example #1
0
        private void ViewInventoryForm_Load(object sender, EventArgs e)
        {
            InventoryControl c = new InventoryControl();

            c.Dock = DockStyle.Fill;
            this.Controls.Add(c);
        }
Example #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                if (string.IsNullOrEmpty(OrderId))
                {
                    // Show Error
                    ucMessageBox.ShowWarning("Unable to locate that order.");
                }
                LoadOrder();

                if (!InventoryControl.CheckCurrentOrderhasInventoryProduct())
                {
                    btnDelete.OnClientClick += "return hcConfirm(event, 'Delete this order forever?');";
                }

                if (CurrentOrder.PaymentStatus != OrderPaymentStatus.Paid &&
                    CurrentOrder.PaymentStatus != OrderPaymentStatus.PartiallyPaid ||
                    CurrentOrder.PaymentStatus == OrderPaymentStatus.Overpaid)
                {
                    btnDelete.OnClientClick += "return hcConfirm(event, 'Delete this order forever?');";
                }
            }
        }
Example #3
0
        private void SearchItemForm_Load(object sender, EventArgs e)
        {
            InventoryControl c = new InventoryControl();

            c.Dock        = DockStyle.Fill;
            c.AllowSelect = true;

            kryptonPanel.Controls.Add(c);
        }
        public async Task <ICommandResult> Handle(AddInventoryControlCommand command)
        {
            command.Validate();

            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, "Dados de entrada in válidos.", null));
            }

            var produto = _productRepository.GetById(command.ProductId);

            if (produto == null)
            {
                AddNotification("Controle de Inventario.Produto", "Produto não cadastrado.");
            }

            if (command.Quantity <= 0)
            {
                AddNotification("Controle de Inventario.Quantidade", "O valor não pode ser menor de 0");
            }

            // Gerar as Entidades
            var inventoryControl = new InventoryControl(command.ProductId, command.Quantity, command.Operation);

            if (command.Operation == 1)
            {
                produto.IncreaseQuantity(command.Quantity);
            }
            else
            {
                produto.DecreseQuantity(command.Quantity);
            }

            if (produto.Quantity <= 0)
            {
                AddNotification("Controle de Inventario.Quantidade", "A quantidade de produtos requeridos ultrapassa o numero do estoque.");
            }


            // Agrupar as Validações
            AddNotifications(inventoryControl);

            // Checar as notificações
            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar o cadastro da turma", this));
            }

            // Salvar as Informações
            _inventoryControlRepository.Add(inventoryControl);
            _productRepository.Edit(produto);

            // Retornar informações
            return(new CommandResult(true, "Cadastro realizado com sucesso!", inventoryControl));
        }
        public static bool Prefix(ref InventoryUiUtils __instance, ref InventoryUiContext ___m_context)
        {
            try {
                var tab = __instance.Tab;
                if (tab != null)   // Restack online storage.
                {
                    if (tab is InventoryOnlineSlotPanelUi onlineTab)
                    {
                        var onlineCargo = onlineTab.GetCargo();

                        if (onlineCargo.ValidateUser(___m_context.User))
                        {
                            var resorter = new Resorter();

                            foreach (var inventory in onlineCargo.Inventories)
                            {
                                if (inventory.TryCast(out IInventorySlots inventorySlots))
                                {
                                    resorter.ExtractAllItemsToTemp(inventory, inventorySlots);
                                }
                            }

                            resorter.ResortTempList();
                            resorter.PutTempItemsInInventory(onlineCargo);
                        }
                    }
                    else     // Restack single inventory.
                    {
                        for (var i = 0; i < tab.InventoryCount; i++)
                        {
                            var inventoryView = tab[i];
                            if (inventoryView.Inventory.TryCast(out IInventorySlots _) && inventoryView.Inventory.ValidateUser(___m_context.User))
                            {
                                InventoryControl.Restack(inventoryView.Inventory);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                Debug.LogError($"Error resorting: {e}");
            }

            return(false);
        }
 private void Awake()
 {
     Control = this;
 }
Example #7
0
    private string itemFolder = "Prefabs/";                                         // Folder for item load

    void Awake()
    {
        Instance = this;                                                            // Make singleton Instance
    }
Example #8
0
 private void Start()
 {
     inv = GameObject.FindGameObjectWithTag("Inventory").GetComponent <InventoryControl>();
 }
        private static FrameworkElement ExtractList(DisplayOption option)
        {
            var drop = new Expander {
                Margin = new Thickness(5), Header = option.ReadableName
            };

            var listType = option.PropertyType.GetGenericArguments()[0];

            FrameworkElement ctrl;

            if (listType == typeof(Item) ||
                listType == typeof(Attribute) ||
                listType == typeof(VillagerRecipe) ||
                listType == typeof(PotionEffect) ||
                listType == typeof(BookPage) ||
                listType == typeof(Enchantment) ||
                listType == typeof(MapDecoration) ||
                listType == typeof(BlockType) ||
                listType == typeof(BannerPattern) ||
                listType == typeof(JsonTextElement))
            {
                if (!option.FixedSize || (option.Minimum == null || option.Maximum == null))
                {
                    var sPanel = new ItemListControl
                    {
                        SlotDescription  = { Text = option.Description },
                        AddRemoveButtons = { Visibility = option.FixedSize ? Visibility.Collapsed : Visibility.Visible }
                    };
                    sPanel.SetBinding(FrameworkElement.DataContextProperty, new Binding(option.PropertyName));
                    ctrl = sPanel;
                }
                else
                {
                    var invGrid = new InventoryControl
                    {
                        InvWidth            = (int)option.Minimum,
                        InvHeight           = (int)option.Maximum,
                        HorizontalAlignment = HorizontalAlignment.Center
                    };
                    invGrid.SetBinding(FrameworkElement.DataContextProperty, new Binding(option.PropertyName));

                    ctrl = invGrid;
                }
            }
            else
            {
                // ReSharper disable once UseObjectOrCollectionInitializer
                var ctrl2 = new DataGrid
                {
                    Margin = new Thickness(3),
                    AutoGenerateColumns = true,
                    CanUserAddRows      = !option.FixedSize,
                    MinHeight           = 50
                };

                ctrl2.AutoGeneratingColumn += (sender1, e1) =>
                {
                    var displayName = PropertyHelpers.GetPropertyDisplayName(e1.PropertyDescriptor);
                    if (e1.PropertyType == typeof(string))
                    {
                        ((DataGridTextColumn)e1.Column).EditingElementStyle = (Style)Application.Current.Resources["DataGridTextColumnStyle"];
                    }

                    if (!string.IsNullOrEmpty(displayName))
                    {
                        e1.Column.Header = displayName;
                    }
                    else
                    {
                        e1.Cancel = true;
                    }
                };

                if (option.DataGridRowHeaderPath != null)
                {
                    var rowHeaderStyle = new Style(typeof(DataGridRowHeader));
                    rowHeaderStyle.Setters.Add(new Setter(ContentControl.ContentProperty, new Binding(option.DataGridRowHeaderPath)));
                    ctrl2.RowHeaderStyle = rowHeaderStyle;
                }
                ctrl2.Margin = new Thickness(15, 0, 0, 0);
                ctrl         = ctrl2;
                ctrl.SetBinding(ItemsControl.ItemsSourceProperty, new Binding(option.PropertyName));
            }


            drop.Content = ctrl;
            drop.SetValue(Grid.ColumnSpanProperty, 2);
            return(drop);
        }
Example #10
0
 void Start()
 {
     // Cache component lookups at startup instead of every frame
     thisTransform = transform;
     cam = Camera.main;
     navi = GetComponent<NavMeshAgent>();
     _inventory = GetComponent<InventoryControl>();
     gd = GameObject.FindObjectOfType<GizmoDebug>().GetComponent<GizmoDebug>();
     CCScript = GameObject.Find("CameraControl").GetComponent<CameraControl>();
     _characterAction = CharacterAction.None;
     gs = GameState.GetInstance();
     //ameObject.Find("root").BroadcastMessage("Start");
     GameObject.Find("root").BroadcastMessage("Load");
     //		thisTransform.Rotate(gs.GetVector3("PlayerRot"));
     //		navi.Warp(gs.GetVector3("PlayerPos"));
     //		targetLocation = transform.position = gs.GetVector3("PlayerPos");
 }