Exemplo n.º 1
0
        private void Add()
        {
            DateTime lDate = new DateTime();

            lDate = DateTime.Now;
            if (InwardDetail != null)
            {
                if (InwardDetail.Dated.Year != 1)
                {
                    lDate = InwardDetail.Dated;
                    if (lDate.Year == 1)
                    {
                        lDate = DateTime.Now;
                    }
                }
                else
                {
                    lDate = DateTime.Now;
                }
            }
            InwardDetail = new InwardDetail();
            InwardDetail.InwardDetailId = -1;

            InwardDetail.Dated = lDate;


            Product = null;
        }
Exemplo n.º 2
0
        private void SearchProductbyBarCode()
        {
            try
            {
                if (InwardDetail == null)
                {
                    InwardDetail = new InwardDetail();
                }

                NotifyPropertyChanged("IsBarCodeFocused");

                if (InwardDetail.BarCodeId == null)
                {
                    return;
                }
                if (InwardDetail.BarCodeId.Length == 0)
                {
                    return;
                }

                if (InwardDetail.Quantity != 0 && InwardDetail.ProductId != 0)
                {
                    return;
                }

                Product = Products.FirstOrDefault(p => p.BarCodeId == InwardDetail.BarCodeId);
                if (Product != null)
                {
                    InwardDetail.BarCodeId = Product.BarCodeId;
                    //InwardDetail.Price = Product.ProductPrice;
                    //InwardDetail.Quantity = 1.0;
                    InwardDetail.ProductName = Product.ProductName;
                    InwardDetail.ProductId   = Product.ProductId;
                    NotifyPropertyChanged("InwardDetail");
                    //bool retValue = Submit();
                    //if (retValue)
                    //{
                    //    IsBarCodeFocused = true;
                    //}
                }
                else
                {
                    System.Windows.MessageBox.Show("Invalid Barcode!");

                    //IsBarCodeFocused = false;
                    NotifyPropertyChanged("IsBarCodeFocused");
                }
            }
            catch (NullReferenceException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 3
0
        public InwardViewModel()
        {
            InwardSummary = new InwardSummary();
            InwardDetails = new ObservableCollection <InwardDetail>();
            //InwardDetails.Add(new InwardEntity{ BarCodeId ="1",ProductId=1,Dated=DateTime.Now,ProductName="xyz",Quantity=10});
            //InwardDetails.Add(new InwardEntity { BarCodeId = "2", ProductId = 3, Dated = DateTime.Now.AddDays(1), ProductName = "lmn", Quantity = 101 });

            OrderRepository orderRepository = new OrderRepository();

            InwardDetail = new InwardDetail();
            Product      = new Product();
            //Products = new ObservableCollection<Product>();
            Products = new ObservableCollection <Product>(orderRepository.getProductList());

            Products.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Products_CollectionChanged);

            Add();
        }