コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();
#if !DEBUG
            this.Activated   += window_Activated;
            this.Deactivated += window_Deactivated;
#endif
            try
            {
                string[] args = Environment.GetCommandLineArgs();
                if (args.Length < 3)
                {
                    throw new Exception("Nombre d'argument insuffisant");
                }

                BaseCialAbstract.setDefaultParams(args[1], args[2]);
                doPiece = args[3];

                repos = new LockRepository();

                Title    = $"Activer/Désactiver doc {doPiece}";
                IsVerrou = repos.isVerrou(doPiece);
                updateUi();
            }
            catch (Exception e)
            {
                Debug.Print(e.ToString());
                MessageBox.Show(e.ToString());
            }
        }
コード例 #2
0
        public MainViewModel()
        {
            try
            {
                if (System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime)
                {
                    // Design time logic
                    BaseCialAbstract.setDefaultParams("G:\\_SOCIETES\\DEV\\SMODEV.gcm");
                }
                else
                {
                    string[] args = Environment.GetCommandLineArgs();
                    if (args.Length < 2)
                    {
                        throw new Exception("Nombre d'argument insuffisant");
                    }
                    BaseCialAbstract.setDefaultParams(args[1], args[2]);
                }

                _lockLoggingRepository = new LockLoggingRepository();
                LoadDatas();

                _timer          = new Timer(2000);
                _timer.Elapsed += OnTick;
                _timer.Enabled  = true;
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("Application", ex.ToString());
                MessageBox.Show(ex.Message);
                throw;
            }
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public MainViewModel(IDataService dataService)
 {
     _dataService = dataService;
     if (IsInDesignMode)
     {
         DoPiece = "VDE06191";
         BaseCialAbstract.setDefaultParams("\\\\SRVAD01\\GESTION\\_SOCIETES\\DEV\\SMODEV.gcm");
         WindowLoaded();
     }
     else
     {
         string[] args = Environment.GetCommandLineArgs();
         if (args.Length < 3)
         {
             throw new Exception("Nombre d'argument insuffisant");
         }
         BaseCialAbstract.setDefaultParams(args[1], args[2]);
         DoPiece = args[3];
     }
     Title = $"Articles DIVERS pour le document {DoPiece}";
     WindowLoadedCommand = new RelayCommand(WindowLoaded);
     SaveCommand         = new RelayCommand(Save);
     AddCommand          = new RelayCommand(Add);
     RemoveCommand       = new RelayCommand <Ligne>(Remove);
 }
コード例 #4
0
        public MainViewModel()
        {
            try
            {
                string[] args = Environment.GetCommandLineArgs();
                if (args.Length < 3)
                {
                    throw new Exception("Nombre d'argument insuffisant");
                }

                BaseCialAbstract.setDefaultParams(args[1], args[2]);
                _doPiece = args[3];

                CommandValider  = new Command(ActionValider);
                MainGridEnabled = true;
                ToggleCheckAll  = new Command(ActionToggleCheckAll);
                Title           = $"Contremarque {_doPiece}";
            }
            catch (Exception e)
            {
                //EventLog.WriteEntry("Application", e.ToString(), EventLogEntryType.Error);
                Debug.Print(e.ToString());
                MessageBox.Show(e.ToString());
            }
        }
コード例 #5
0
        public string EnregistrerArticle(ListRow row, string fichier, string ctNum)
        {
            BaseCialAbstract.setDefaultParams(fichier);
            Repository repos = new Repository();

            BaseCialAbstract.setDefaultParams(repos.getDbListFromContext().First(db => db.name.Contains("TARIF")).gcmFile);

            return(repos.EnregistrerArticle(row, ctNum));
        }
コード例 #6
0
        internal void SelectionChanged(Database db)
        {
            currentDb = db;

            if (currentDb.id == 0)
            {
                Users         = new ObservableCollection <User>();
                CanDisconnect = Users.Count > 0;
            }
            else
            {
                BaseCialAbstract.setDefaultParams(Repos.getFichierGescom(db.name));
                Load();
            }
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IDataService dataService)
        {
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length < 3)
            {
                throw new Exception("Nombre d'argument insuffisant");
            }

            BaseCialAbstract.setDefaultParams(args[1], args[2]);
            DoPiece = args[3];

            WelcomeTitle = $"Réception du Document {DoPiece}";
            CodeBarre    = string.Empty;

            _dataService = dataService;

            DatagridKeyDownCommand = new RelayCommand <object>(datagridKeyDown);
            SaveAndCloseCommand    = new RelayCommand(saveAndClose);
            WindowLoadedCommand    = new RelayCommand(WindowLoaded);
        }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IDataService dataService)
        {
            try
            {
                _dataService = dataService;

                if (IsInDesignMode)
                {
                    //DoPiece = "APC04560";
                    //BaseCialAbstract.setDefaultParams("\\\\SRVSQL04\\SI\\Sage\\DEV\\BODINDEV.gcm");
                    //WindowLoaded();
                }
                else
                {
                    string[] args = Environment.GetCommandLineArgs();
                    if (args.Length < 3)
                    {
                        throw new Exception("Nombre d'argument insuffisant");
                    }

                    BaseCialAbstract.setDefaultParams(args[1], args[2]);
                    DoPiece   = args[3];
                    _isImport = args.ElementAtOrDefault(5) == "import";
                }

                WindowLoadedCommand     = new RelayCommand(WindowLoaded);
                CodeBarreKeyDownCommand = new RelayCommand <DataGrid>(CodeBarreKeyDown);
                SelectionCommandClick   = new RelayCommand <int>((s) => SelectionCommand(s));
                SelectionChangedCommand = new RelayCommand <IList>((s) => SelectionChanged(s));
                UpdateTotalsCommand     = new RelayCommand(UpdateTotals);
                SaveCommand             = new RelayCommand(Save);
                CloseCommand            = new RelayCommand(Close);
                DoubleClickCommand      = new RelayCommand <object>(DoubleCLick);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                Application.Current.Shutdown();
            }
        }
コード例 #9
0
        public string this[string columnName]
        {
            get
            {
                string error = string.Empty;

                // Tant qu'elle n'est pas cochée, la ligne est valide
                if (RowChecked)
                {
                    switch (columnName)
                    {
                    case "Qte":
                        if (Qte == null && !IsCommentaire)
                        {
                            error = "La quantité est obligatoire";
                        }
                        break;

                    case "FournPrinc":
                        if (!IsInterMag)
                        {
                            if (string.IsNullOrEmpty(FournPrinc))
                            {
                                error = "Fournisseur principal obligatoire";
                            }
                            else if (!BaseCialAbstract.GetInstance().CptaApplication.FactoryFournisseur.ExistNumero(_fournPrinc))
                            {
                                error = $"Le fournisseur '{FournPrinc}' n'existe pas";
                            }
                        }
                        break;
                    }
                }

                _validProperties[columnName] = error == string.Empty;
                OnPropertyChanged("IsValid");

                return(error);
            }
        }