Exemple #1
0
 public ViewModelDokumnetySettings()
 {
     RodzajeDok          = new ObservableCollection <IHP_RODZAJDOK>(context.IHP_RODZAJDOK);
     RodzajDok           = new IHP_RODZAJDOK();
     AddNewProgCommand   = new RelayCommand(Save, CanSave);
     DelNewProgCommand   = new DelegateCommand(Del);
     UpdNewProgCommand   = new RelayCommand(Update, CanUpdate);
     ClearNewProgCommand = new DelegateCommand(Clear);
     NewRec = true;
 }
        public ViewModelDokumenty()
        {
            //https://www.rapidtables.com/web/color/blue-color.html
            Kolory = Color.FromRgb(255, 0, 0);
            Kolor  = Brushes.Red;
            RisePropertyChanged("Kolor");

            Samochody = new ObservableCollection <IHP_SAMOCHOD>(context.IHP_SAMOCHOD);
            Kierowcy  = new ObservableCollection <IHP_KIEROWCA>(context.IHP_KIEROWCA);

            KontrahsArch = new ObservableCollection <IHP_KONTRAHENT_ARCH>(context.IHP_KONTRAHENT_ARCH.Where(x => x.AKTYWNY == 1));
            Kartoteki    = new ObservableCollection <IHP_KARTOTEKA>(context.IHP_KARTOTEKA);
            RodzajeDok   = new ObservableCollection <IHP_RODZAJDOK>(context.IHP_RODZAJDOK);

            Dokumenty                   = new ObservableCollection <IHP_NAGLDOK>(context.IHP_NAGLDOK);
            DeleteCommand               = new RelayCommand(Delete, CanDelete);
            AddWazenieCommand           = new RelayCommand(WykonajWazenie, CanSave);
            ClearNewProgCommand         = new DelegateCommand(Clear);
            PrintCommand                = new DelegateCommand(Print);
            UpdNewProgCommand           = new RelayCommand(Update, CanUpdate);
            ItemSelSamochodCommand      = new DelegateCommand(SelectSamochod);
            ItemSelKontrahentCommand    = new DelegateCommand(SelectKonrahent);
            ItemSelKierowcaCommand      = new DelegateCommand(SelectKierowca);
            CommandPanelFiltr           = new DelegateCommand(PanelFiltr);
            CommandPanelListaWazen      = new DelegateCommand(PanelListaWazen);
            CommandPanelUtawienieDanych = new DelegateCommand(UstawienieDanychVd);
            ShowDokCommand              = new DelegateCommand(ShowDok);
            CommandFiltruj              = new DelegateCommand(Flitr);
            DayCommand                  = new DelegateCommand(UstawDzien);
            WeekCommand                 = new DelegateCommand(UstawTydzien);
            MonthCommand                = new DelegateCommand(UstawMiesiac);
            YearCommand                 = new DelegateCommand(UstawRok);

            rejmsg    = new RejWagaMessage();
            RodzajDok = new IHP_RODZAJDOK();

            LoadCollection();
            UstawienieDanych = true;
            wybierzdzien     = true;
            LoadDOkData();

            Messenger.Default.Register <List <IHP_KIEROWCA> >(this, OnMessageKierowca);
            Messenger.Default.Register <List <IHP_KONTRAHENT_ARCH> >(this, OnMessageKontrahent);
            Messenger.Default.Register <List <IHP_KARTOTEKA> >(this, OnMessageKartoteka);

            Messenger.Default.Register <int>(this, OnRefresh);
            Messenger.Default.Register <RejWagaMessage>(this, OnMessageDok);
            _timer = new Timer(TimerCallback, null, 1000, 1000);

            //  OnMessagewagaRamkaTest();
        }
Exemple #3
0
        private void Save()
        {
            string LastMessage;

            try
            {
                IHP_RODZAJDOK _rodzajdok = new IHP_RODZAJDOK();

                IHP_NUMERACJA numerrodzdok = GetId(7);
                if (numerrodzdok != null)
                {
                    numerrodzdok.NUMER++;
                }

                if (IsKierunek)
                {
                    _kierunekmag = 1;
                }
                else
                {
                    _kierunekmag = -1;
                }

                int idrodzajdok = numerrodzdok.NUMER;

                _rodzajdok.ID_IHP_RODZAJDOK = idrodzajdok;
                _rodzajdok.OPIS             = _opis;
                _rodzajdok.SKROTDOK         = _skrotdok;
                _rodzajdok.KIERUNEKMAG      = _kierunekmag;

                context.IHP_RODZAJDOK.Add(_rodzajdok);
                context.Entry(_rodzajdok).State = EntityState.Added;
                context.IHP_NUMERACJA.Add(numerrodzdok);
                context.Entry(numerrodzdok).State = EntityState.Modified;
                context.SaveChanges();
                Clear();
                LoadCollection();
                NewRec = true;
            }

            catch (Exception ex)
            {
                LastMessage = ex.ToString();
                if (LastMessage == String.Empty)
                {
                    LastMessage = ex.InnerException.ToString();
                }
                LogManager.WriteLogMessage(LogManager.LogType.Error, LastMessage);
                throw ex;
            }
        }
        private void Clear()
        {
            if (_samochod != null)
            {
                Samochod  = null;
                _samochod = null;
            }

            if (_kontrah != null)
            {
                _kontrah = null;
                Kontrah  = null;
            }

            if (_kontraharch != null)
            {
                _kontraharch = null;
                KontrahArch  = null;
            }

            if (_kierowca != null)
            {
                _kierowca = null;
                Kierowca  = null;
            }

            if (_rodzajdok != null)
            {
                _rodzajdok = null;
            }
            if (_wazenie != null)
            {
                Wazenie  = null;
                _wazenie = null;
            }
            _nrrej  = string.Empty;
            NrRej   = string.Empty;
            _nazwa  = string.Empty;
            Nazwa   = string.Empty;
            _wagakg = string.Empty;
            WagaKg  = string.Empty;
        }
        private void Clear()
        {
            if (_samochod != null)
            {
                Samochod  = null;
                _samochod = null;
            }

            if (_kontrah != null)
            {
                _kontrah = null;
                Kontrah  = null;
            }

            if (_kontraharch != null)
            {
                _kontraharch = null;
                KontrahArch  = null;
            }

            if (_kierowca != null)
            {
                _kierowca = null;
                Kierowca  = null;
            }

            if (_rodzajdok != null)
            {
                _rodzajdok = null;
            }
            if (_wazenie != null)
            {
                Wazenie  = null;
                _wazenie = null;
            }
            KierowcaNazwa   = string.Empty;
            KontrahentNazwa = string.Empty;
            NrRejNazwa      = string.Empty;
            Uwagi           = string.Empty;
            _ispopraw       = false;
            LoadCollection();
        }
        public ViewModelKontrahent()
        {
            Kontrahs          = new ObservableCollection <IHP_KONTRAHENT>(context.IHP_KONTRAHENT);
            DefCenyLst        = new ObservableCollection <IHP_DEFCENY>(context.IHP_DEFCENY);
            RodzajeDok        = new ObservableCollection <IHP_RODZAJDOK>(context.IHP_RODZAJDOK);
            ListaWystTrasy    = new ObservableCollection <WystTrasyKartView>();
            RodzajDok         = new IHP_RODZAJDOK();
            DeleteCommand     = new RelayCommand(Delete, CanDelete);
            CreateDokCommand  = new RelayCommand(WystaDok, CanWystDok);
            AddCommand        = new RelayCommand(Save, CanSave);
            ClearCommand      = new DelegateCommand(Clear);
            DelTrasaCommand   = new RelayCommand(DeleteWysTrasaKart, CanDelTrasa);
            UpdateCommand     = new RelayCommand(Update, CanUpdate);
            DodajTraseCommand = new DelegateCommand(pokazokno);
            FillDataCommand   = new DelegateCommand(LoadWystColection);
            //  ExportSubjectCommand = new RelayCommand(ExportSubject, CanExportSubject);
            //  ImportSubjectCommand = new DelegateCommand(ImportSubject);

            Messenger.Default.Register <List <IHP_KIEROWCA> >(this, OnMessageKierowca);
            Messenger.Default.Register <IHP_TRASY>(this, OnMessageTrasy);
            LoadCollection();
        }