コード例 #1
0
        /// <summary>
        /// Manipulates item Trans based on material nature
        /// </summary>
        /// <param name="itemNature"></param>
        /// <param name="itemTrans"></param>
        /// <param name="itemTransDef"></param>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public static void ItemNatureHandler(WarehouseItemNatureEnum itemNature, WarehouseTransaction itemTrans,
                                             TransWarehouseDef itemTransDef)
        {
            switch (itemNature)
            {
            case WarehouseItemNatureEnum.WarehouseItemNatureUndefined:
                throw new ArgumentOutOfRangeException();

            case WarehouseItemNatureEnum.WarehouseItemNatureMaterial:
                itemTrans.InventoryAction      = itemTransDef.MaterialInventoryAction;
                itemTrans.InventoryValueAction = itemTransDef.MaterialInventoryValueAction;
                itemTrans.InvoicedVolumeAction = itemTransDef.MaterialInvoicedVolumeAction;
                itemTrans.InvoicedValueAction  = itemTransDef.MaterialInvoicedValueAction;
                break;

            case WarehouseItemNatureEnum.WarehouseItemNatureService:
                itemTrans.InventoryAction      = itemTransDef.ServiceInventoryAction;
                itemTrans.InventoryValueAction = itemTransDef.ServiceInventoryValueAction;
                itemTrans.InvoicedVolumeAction = itemTransDef.MaterialInvoicedVolumeAction;
                itemTrans.InvoicedValueAction  = itemTransDef.MaterialInvoicedValueAction;
                break;

            case WarehouseItemNatureEnum.WarehouseItemNatureExpense:
                itemTrans.InventoryAction      = itemTransDef.ExpenseInventoryAction;
                itemTrans.InventoryValueAction = itemTransDef.ExpenseInventoryValueAction;
                itemTrans.InvoicedVolumeAction = itemTransDef.MaterialInvoicedVolumeAction;
                itemTrans.InvoicedValueAction  = itemTransDef.MaterialInvoicedValueAction;
                break;

            case WarehouseItemNatureEnum.WarehouseItemNatureIncome:
                itemTrans.InventoryAction      = itemTransDef.IncomeInventoryAction;
                itemTrans.InventoryValueAction = itemTransDef.IncomeInventoryValueAction;
                itemTrans.InvoicedVolumeAction = itemTransDef.MaterialInvoicedVolumeAction;
                itemTrans.InvoicedValueAction  = itemTransDef.MaterialInvoicedValueAction;
                break;

            case WarehouseItemNatureEnum.WarehouseItemNatureFixedAsset:
                itemTrans.InventoryAction      = itemTransDef.FixedAssetInventoryAction;
                itemTrans.InventoryValueAction = itemTransDef.FixedAssetInventoryValueAction;
                itemTrans.InvoicedVolumeAction = itemTransDef.MaterialInvoicedVolumeAction;
                itemTrans.InvoicedValueAction  = itemTransDef.MaterialInvoicedValueAction;
                break;

            case WarehouseItemNatureEnum.WarehouseItemNatureRawMaterial:
                itemTrans.InventoryAction      = itemTransDef.RawMaterialInventoryAction;
                itemTrans.InventoryValueAction = itemTransDef.RawMaterialInventoryValueAction;
                itemTrans.InvoicedVolumeAction = itemTransDef.MaterialInvoicedVolumeAction;
                itemTrans.InvoicedValueAction  = itemTransDef.MaterialInvoicedValueAction;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TransWarehouseDef = await _context.TransWarehouseDefs
                                .Include(t => t.Company)
                                .FirstOrDefaultAsync(m => m.Id == id);

            if (TransWarehouseDef == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TransWarehouseDef = await _context.TransWarehouseDefs.FindAsync(id);

            if (TransWarehouseDef != null)
            {
                _context.TransWarehouseDefs.Remove(TransWarehouseDef);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }