Ejemplo n.º 1
0
        public CustomerListViewModel(ObservableCollection <DataModel> source) : base(source)
        {
            DisplayName = "Asiakkaat";
            Filter      = new CustomerFilterViewModel();

            Invoice = new CommandViewModel("Laskuta", "Luo uusi lasku tälle asiakkaalle.", OnInvoice, CanEdit);
            Commands.Copy.Visibility = System.Windows.Visibility.Collapsed;
        }
Ejemplo n.º 2
0
        public FileViewModel(string filePath)
        {
            FilePath = filePath;

            OpenFile   = new CommandViewModel("Avaa tiedosto", OnOpenFile, CanOpenFile);
            OpenFolder = new CommandViewModel("Avaa tiedostosijainti", OnOpenFolder, CanOpenFolder);
            Copy       = new CommandViewModel("Kopioi leikepöydälle", OnCopyFile, CanCopyFile);
            Delete     = new CommandViewModel("Poista", OnDelete, CanDelete);
        }
Ejemplo n.º 3
0
        public EditCompanyViewModel(Company company) : base(company)
        {
            EditEnabled = true;
            Validator   = new Validation.CompanyValidator(this);

            MainMenuViewModel.SelectedCompany.ModelChanged += OnModelChanged;

            if (Model.IsNew)
            {
                DisplayName = "Uusi yritys";

                Model.InvoiceID     = Properties.Settings.Default.DefaultInvoiceID;
                Model.ReferenceBase = Properties.Settings.Default.DefaultReference;

                Model.Tax = Properties.Settings.Default.DefaultTax;

                Model.CompanyExpire     = Properties.Settings.Default.MinCompanyExpire;
                Model.CompanyInterest   = Properties.Settings.Default.MaxInterest;
                Model.CompanyAnnotation = Properties.Settings.Default.DefaultAnnotation;

                Model.PersonExpire     = Properties.Settings.Default.MinPersonExpire;
                Model.PersonInterest   = Properties.Settings.Default.MaxInterest;
                Model.PersonAnnotation = Properties.Settings.Default.DefaultAnnotation;
            }
            else
            {
                DisplayName = Name;
            }

            Tax = Model.Tax.ToString();

            CompanyExpire     = Model.CompanyExpire.ToString();
            CompanyInterest   = Model.CompanyInterest.ToString("0.0");
            CompanyAnnotation = Model.CompanyAnnotation.ToString();

            PersonExpire     = Model.PersonExpire.ToString();
            PersonInterest   = Model.PersonInterest.ToString("0.0");
            PersonAnnotation = Model.PersonAnnotation.ToString();

            LogoManager           = new ImageManagerViewModel(System.IO.Directory.GetCurrentDirectory() + @"\userdata\" + company.ID, Model.Logo);
            LogoManager.FileTypes = new List <string> {
                ".png", ".jpg", ".jpeg"
            };

            EditID   = new CommandViewModel("Muokkaa", OnEditID, CanEditID);
            SaveID   = new CommandViewModel("Aseta numero", OnSaveID);
            CancelID = new CommandViewModel("Peruuta", OnCancelID);

            SaveID.Visibility   = Visibility.Collapsed;
            CancelID.Visibility = Visibility.Collapsed;
            ReadOnlyID          = !Model.IsNew;
        }
Ejemplo n.º 4
0
        public FileManagerViewModel(string path)
        {
            Path         = path;
            deletedFiles = new List <FileViewModel>();

            if (Files == null)
            {
                Files = new ObservableCollection <FileViewModel>();
            }

            if (FileTypes == null)
            {
                FileTypes = new List <string>();
            }

            New = new CommandViewModel("Lisää tiedosto", OnGetFile, CanGetFile);
        }
        public EditInvoiceViewModel(Invoice invoice) : base(invoice)
        {
            EditEnabled = true;
            Validator   = new Validation.InvoiceValidator(this);

            if (Model.IsNew)
            {
                DisplayName = "Uusi lasku";
                if (Model.Titles.Count < 1)
                {
                    NewTitle.Execute();
                }
            }
            else
            {
                DisplayName = "Lasku " + (InvoiceID == null ? Status : InvoiceID.ToString()) + (Customer == null ? null : " - " + Customer.Name);
            }

            if (Paid != null)
            {
                IsEnabled = false;
            }

            CustomerList = new CustomerListViewModel(Resources.GetModels <Customer>());
            if (Model.Customer != null)
            {
                CustomerList.SelectedItem = CustomerList.FindByID(Model.Customer.ID) as CustomerViewModel;
            }

            CustomerList.SelectionChanged += CustomerListSelectionChanged;

            Send      = new CommandViewModel("Laskuta", OnSend, CanSend);
            Pay       = new CommandViewModel("Merkitse maksupäivä", OnPay, CanPay);
            SavePay   = new CommandViewModel("Aseta päiväys", OnSavePay);
            CancelPay = new CommandViewModel("Peruuta", OnCancelPay);
        }
 public InvoiceListViewModel(ObservableCollection <DataModel> source) : base(source)
 {
     CreateFile = new CommandViewModel("Vie PDF:ksi", "Tallenna tiedosto PDF-muodossa.", OnCreateFile, CanCreateFile);
 }