Ejemplo n.º 1
0
        public Guid GetRackLevl()
        {
            using (var session = NhibernateLayer.OpenSession())
            {
                using (var Transaction = session.BeginTransaction())
                {
                    ItemUnitTest itemtest = new ItemUnitTest();
                    RackUnitTest racktest = new RackUnitTest();

                    var item1 = itemtest.GetItem();
                    var rack1 = racktest.GetRack();

                    Item Item = session.Get <Item>(item1);
                    Rack Rack = session.Get <Rack>(rack1);

                    RackItemLevel RackItemLevel = new RackItemLevel()
                    {
                        CurrentQty = 6,
                        InQty      = 10,
                        OutQty     = 4,
                        Item1      = Item,
                        Rack1      = Rack
                    };
                    session.Save(RackItemLevel);

                    Transaction.Commit();

                    var Res = session.Get <RackItemLevel>(RackItemLevel.Id);
                    return(Res.Id);
                }
            }
        }
        public Guid GetPurchaseOrderItem()
        {
            using (var Session = NhibernateLayer.OpenSession())
            {
                using (var Transaction = Session.BeginTransaction())
                {
                    ItemUnitTest itemTest = new ItemUnitTest();
                    RackUnitTest rackTest = new RackUnitTest();

                    var ItemId = itemTest.GetItem();
                    var RackId = rackTest.GetRack();

                    Item item = Session.Get <Item>(ItemId);
                    Rack rack = Session.Get <Rack>(RackId);


                    Market.Entities.ShouldMap.PurchaseOrderItem PurchaseOrderItem1 =
                        new Market.Entities.ShouldMap.PurchaseOrderItem()
                    {
                        Name       = "khodkar",
                        QTY        = 10,
                        NetPrice   = 800,
                        TotalPrice = 10 * 800,
                        UnitPrice  = 800,
                        Item1      = item,
                        //Rack1 = rack
                    };

                    Session.Save(PurchaseOrderItem1);

                    Transaction.Commit();
                    var Res = Session.Get <Market.Entities.ShouldMap.PurchaseOrderItem>(PurchaseOrderItem1.Id);

                    return(Res.Id);
                }
            }
        }