Exemplo n.º 1
0
 public InventoryFormat(InventoryFormat thiz)
 {
     ID = thiz.ID;
     Specification = thiz.Specification;
     Quantity = thiz.Quantity;
     Memo = thiz.Memo;
     ProductID = thiz.ProductID;
     MakerID = thiz.MakerID;
     MeasureID = thiz.MeasureID;
 }
        public InventoryS3BucketDestination Unmarshall(XmlUnmarshallerContext context)
        {
            InventoryS3BucketDestination condition = new InventoryS3BucketDestination();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("AccountId", targetDepth))
                    {
                        condition.AccountId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Bucket", targetDepth))
                    {
                        condition.BucketName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Format", targetDepth))
                    {
                        condition.InventoryFormat = InventoryFormat.FindValue(StringUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("Prefix", targetDepth))
                    {
                        condition.Prefix = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Encryption", targetDepth))
                    {
                        condition.InventoryEncryption = InventoryEncryptionUnmarshaller.Instance.Unmarshall(context);
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(condition);
                }
            }



            return(condition);
        }
        public InventoryS3BucketDestination Unmarshall(XmlUnmarshallerContext context)
        {
            InventoryS3BucketDestination inventoryS3BucketDestination = new InventoryS3BucketDestination();
            int currentDepth = context.get_CurrentDepth();
            int num          = currentDepth + 1;

            if (context.get_IsStartOfDocument())
            {
                num += 2;
            }
            while (context.Read())
            {
                if (context.get_IsStartElement() || context.get_IsAttribute())
                {
                    if (context.TestExpression("AccountId", num))
                    {
                        inventoryS3BucketDestination.AccountId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    }
                    else if (context.TestExpression("Bucket", num))
                    {
                        inventoryS3BucketDestination.BucketName = StringUnmarshaller.GetInstance().Unmarshall(context);
                    }
                    else if (context.TestExpression("Format", num))
                    {
                        inventoryS3BucketDestination.InventoryFormat = InventoryFormat.FindValue(StringUnmarshaller.GetInstance().Unmarshall(context));
                    }
                    else if (context.TestExpression("Prefix", num))
                    {
                        inventoryS3BucketDestination.Prefix = StringUnmarshaller.GetInstance().Unmarshall(context);
                    }
                }
                else if (context.get_IsEndElement() && context.get_CurrentDepth() < currentDepth)
                {
                    return(inventoryS3BucketDestination);
                }
            }
            return(inventoryS3BucketDestination);
        }
Exemplo n.º 4
0
 public ObservableInventory(InventoryFormat invf)
 {
     _fmt = invf;
     InitializeProperties(invf);
 }
Exemplo n.º 5
0
 private ObservableInventory()
 {
     _fmt = new InventoryFormat();
 }
Exemplo n.º 6
0
 protected void InitializeProperties(InventoryFormat fmt)
 {
     var ofd = DataDirector.GetInstance();
     product = ofd.SearchField<Product>(fmt.ProductID);
     measure = ofd.SearchField<Measure>(fmt.MeasureID);
     maker = ofd.SearchField<Maker>(fmt.MakerID);
 }
 public NonSaveObservableInventory(InventoryFormat inventory) : base(inventory)
 {
 }
        public void UnitPriceAndAccountQueryTest0()
        {
            DataDirector ddr = DataDirector.GetInstance();
            Observable<Product> prod = ddr.CopyFields<Product>().Random();
            InventoryFormat invf = new InventoryFormat() { ProductID = prod.ID, Specification = "some"};
            
            ddr.AddInventory(invf);

            ObservableInventory inv = DataDirector.GetInstance().SearchInventory(invf.ID);

            IOStockManagerViewModel vm = new IOStockManagerViewModel(inv);
            Assert.AreEqual(0, vm.UnitPrice); //입고 출고에 아무런 데이터가 없어서 자동적으로 0으로 초기화

            decimal price = vm.UnitPrice = 1500;
            vm.Insert(); //입고 넣기

            vm = new IOStockManagerViewModel(inv);
            Assert.AreEqual(price, vm.UnitPrice); //입고에 있는 값 불러옴

            vm.StockType = IOStockType.OUTGOING;
            Assert.AreEqual(price, vm.UnitPrice); //출고지만 자료가 없어 입고 값으로 덮씌움
            price = vm.UnitPrice = 1700;

            vm.Insert(); //출고 넣기

            vm = new IOStockManagerViewModel(inv);
            vm.StockType = IOStockType.OUTGOING;
            Assert.AreEqual(price, vm.UnitPrice); //출고의 UnitPrice 가져옴
            Assert.IsNull(vm.SelectedAccount);
        }
        public void CreateInventoryThenCreateStock()
        {
            var prod = DataDirector.GetInstance().CopyFields<Product>().Random();
            InventoryFormat inv = new InventoryFormat();
            inv.ProductID = prod.ID;
            inv.ID = Guid.NewGuid().ToString();

            DataDirector.GetInstance().AddInventory(inv);

            var vm = new IOStockManagerViewModel(prod);
            vm.SelectedInventory = vm.Inventories.Random();
            vm.Quantity = 10;
            vm.UnitPrice = 1000;

            vm.Insert();
        }
        private InventoryFormat CreateInventoryFormat()
        {
            InventoryFormat format = new InventoryFormat();
            format.ProductID = _product.ID;
            if (Maker != null)
                format.MakerID = Maker.ID;
            if (Measure != null)
                format.MeasureID = Measure.ID;
            format.Specification = Specification;
            format.Memo = Memo;

            return format;
        }