コード例 #1
0
        private async void SearchAction(object obj)
        {
            try
            {
                RefreshSource();
                var stt    = Convert.ToInt32(obj);
                var result = await MainVM.PenjualanCollection.GetItemBySTT(stt);

                if (result != null)
                {
                    var newmodel = new STTCreateModel(result);
                    STTModel = newmodel;
                    STTModel.OnChangePrice += STTModel_OnChangePrice;
                }

                else
                {
                    STTModel = new STTCreateModel(stt);
                    throw new SystemException("Data Tidak Ditemukan !");
                }

                await Task.Delay(1000);
            }
            catch (Exception ex)
            {
                ModernDialog.ShowMessage(ex.Message, "Error", System.Windows.MessageBoxButton.OK);
            }
        }
コード例 #2
0
        private async void CreateNewSTT()
        {
            RefreshSource();
            var STTnumber = await MainVM.PenjualanCollection.NewSTT();

            if (STTnumber <= 0)
            {
                STTnumber = 1;
            }
            STTModel                = new STTCreateModel(STTnumber);
            STTModel.ChangeDate     = DateTime.Now;
            STTModel.OnChangePrice += STTModel_OnChangePrice;
        }
コード例 #3
0
        public PenjualanCreateVM()
        {
            this.MainVM        = ResourcesBase.GetMainWindowViewModel();
            this.AppConfig     = MainVM.SystemConfiguration;
            this.TypeOfWeights = ResourcesBase.GetEnumCollection <TypeOfWeight>();
            this.PortTypes     = ResourcesBase.GetEnumCollection <PortType>();
            this.PayTypes      = ResourcesBase.GetEnumCollection <PayType>();

            STTModel = new STTCreateModel(0)
            {
                ChangeDate = DateTime.Now
            };

            // ShiperControl=new CustomerControl();

            CitiesSource = new ObservableCollection <ModelsShared.Models.City>(MainVM.CityCollection.Source);

            this.Origins      = (CollectionView)CollectionViewSource.GetDefaultView(CitiesSource);
            this.Destinations = (CollectionView)CollectionViewSource.GetDefaultView(CitiesSource);
            Save = new CommandHandler {
                CanExecuteAction = x => SaveValidation(), ExecuteAction = SaveAction
            };
            Print = new CommandHandler {
                CanExecuteAction = x => PrintSelected != null, ExecuteAction = x => PrintAction()
            };
            PrintWithForm = new CommandHandler {
                CanExecuteAction = x => PrintSelected != null, ExecuteAction = x => PrintFormAction()
            };
            SaveAndPrint = new CommandHandler {
                CanExecuteAction = x => SaveValidation(), ExecuteAction = x => SaveAndPrintAction()
            };
            Cancel = new CommandHandler {
                CanExecuteAction = x => true, ExecuteAction = x => CancalAction()
            };
            Search = new CommandHandler {
                ExecuteAction = SearchAction
            };
            ChangeWeight = new CommandHandler {
                ExecuteAction = x => ChangeWeightAction()
            };
            PriceUpdate = new CommandHandler {
                CanExecuteAction = PriceUpdateValidation, ExecuteAction = PriceUpdateAction
            };
            CreateNewSTT();
        }