Ejemplo n.º 1
0
 protected override void OnInitialized()
 {
     base.OnInitialized();
     WebApiOperate.StatiCargoInfoModels = WebApiOperate.GetAllCargoInfoModels().Result;
     WebApiOperate.StatiCargosGroups    = WebApiOperate.GetAllGroup().Result;
     WebApiOperate.StatiCargosUnits     = WebApiOperate.GetAllUnit().Result;
     Cargos = GetCollection().Result;
     s1     = "6666";
 }
Ejemplo n.º 2
0
        public MainViewModel()
        {
            WebApiOperate.StatiCargoInfoModels = WebApiOperate.GetAllCargoInfoModels();
            WebApiOperate.StatiCargosGroups    = WebApiOperate.GetAllGroup();
            _CargosCollection    = WebApiOperate.StatiCargoInfoModels;
            _GroupsCollection    = WebApiOperate.StatiCargosGroups;
            _CartItemsCollection = new ObservableCollection <CartItem>();

            SelectByGroupName = new RelayCommand <string>(s =>
            {
                var result       = WebApiOperate.StatiCargoInfoModels.Where(i => i.PDGroup == s).ToList();
                CargosCollection = new ObservableCollection <CargoInfoModel>(result);
            });

            SelectBystring = new RelayCommand <string>(s =>
            {
                var reslut       = WebApiOperate.StatiCargoInfoModels.Where(i => i.PDGroup == s || i.PDCode.Contains(s) || i.PDName.Contains(s) || i.PDSubName.Contains(s)).ToList();
                CargosCollection = new ObservableCollection <CargoInfoModel>(reslut);
            });
            AddToCart = new RelayCommand <CargoInfoModel>(i =>
            {
                double Pdcnt = 1;
                if (i.IsWeighedNeeded)
                {
                    Thread.Sleep(500);
                    Pdcnt = 2;
                }

                CartItemsCollection.Add(new CartItem
                {
                    Count        = Pdcnt,
                    PDName       = i.PDName,
                    PDSn         = i.PDCode,
                    UnitPrice    = i.PDSellPrice,
                    PDTotalPrice = Pdcnt * i.PDSellPrice
                });
                CartCost  = CartItemsCollection.Sum(a => a.PDTotalPrice);
                CartCount = CartItemsCollection.Count;
            });
            DeleCargoBycode = new RelayCommand <string>(s =>
            {
                WebApiOperate.StatiCargoInfoModels = WebApiOperate.DeleCargo(s);
                CargosCollection = WebApiOperate.StatiCargoInfoModels;
            });
            RefreshCommand = new RelayCommand <RefreshView>(rv =>
            {
                rv.IsRefreshing = true;
                WebApiOperate.StatiCargoInfoModels = WebApiOperate.GetAllCargoInfoModels();
                WebApiOperate.StatiCargosGroups    = WebApiOperate.GetAllGroup();
                CargosCollection = WebApiOperate.StatiCargoInfoModels;
                GroupsCollection = WebApiOperate.StatiCargosGroups;
                rv.IsRefreshing  = false;
            });
        }
Ejemplo n.º 3
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            Scan.GetSerialPort("COM5");
            Scan.OpenPort();
            WebApiOperate.StatiCargoInfoModels = WebApiOperate.GetAllCargoInfoModels().Result;
            WebApiOperate.StatiCargosGroups    = WebApiOperate.GetAllGroup().Result;
            WebApiOperate.StatiCargosUnits     = WebApiOperate.GetAllUnit().Result;
            var Win = MainWin.View.MainWindow.GetInstance();

            WindowsStatus.MainWindowOpen = true;
            Win.Show();
        }