Exemplo n.º 1
0
        public static DB.ITM_Movement Populate(Int64 itemId, DataContext dataContext)
        {
            DB.VW_LineItem  inventory = dataContext.ReadonlyContext.VW_LineItem.FirstOrDefault(n => n.Id == itemId);
            DB.ITM_Movement movement  = New;
            movement.OnHand      = inventory.OnHand;
            movement.OnReserve   = inventory.OnReserve;
            movement.OnOrder     = inventory.OnOrder;
            movement.UnitPrice   = inventory.UnitPrice;
            movement.UnitCost    = inventory.UnitCost;
            movement.UnitAverage = inventory.UnitAverage;
            movement.OnHold      = inventory.OnHold;

            return(movement);
        }
Exemplo n.º 2
0
        internal static String Save(DB.ITM_Movement entry, DataContext dataContext)
        {
            try
            {
                if (dataContext.EntityInventoryContext.GetEntityState(entry) == EntityState.Detached)
                {
                    dataContext.EntityInventoryContext.ITM_Movement.Add(entry);
                }

                Validation.ValidateEntity(dataContext.EntityInventoryContext, entry);
            }
            catch (Validation.EntityValidationException)
            {
                return(dataContext.PackageValidationException());
            }

            return("Success");
        }