public void Initialize(BasicWarehouse warehouse)
 {
     _warehouse    = warehouse;
     _dbservicewms = new DBServiceWMS(_warehouse);
     try
     {
         DataList = new ObservableCollection <CommandERPViewModel>();
         DateFrom = new HistoryDateTimePickerViewModel {
             TimeStamp = DateTime.Now.AddDays(-1)
         };
         DateFrom.Initialize(_warehouse);
         DateTo = new HistoryDateTimePickerViewModel {
             TimeStamp = DateTime.Now.AddHours(+1)
         };
         DateTo.Initialize(_warehouse);
         Records     = 0;
         _accessUser = "";
         Messenger.Default.Register <MessageAccessLevel>(this, (mc) => { AccessLevel = mc.AccessLevel; _accessUser = mc.User; });
         Messenger.Default.Register <MessageViewChanged>(this, vm => ExecuteViewActivated(vm.ViewModel));
     }
     catch (Exception e)
     {
         _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, e.Message);
         throw new Exception(string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
     }
 }
Example #2
0
        public void ExecuteViewActivated(ViewModelBase vm)
        {
            try
            {
                if (vm is HistoryCommandsViewModel)
                {
                    HistoryDateTimePickerViewModel d;
                    d = new HistoryDateTimePickerViewModel {
                        TimeStamp = DateTime.Now.AddDays(-1)
                    };
                    d.Initialize(_warehouse);
                    DateFrom = d;

                    d = new HistoryDateTimePickerViewModel {
                        TimeStamp = DateTime.Now.AddHours(+1)
                    };
                    d.Initialize(_warehouse);
                    DateTo = d;
                }
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception,
                                    string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }
Example #3
0
 public void Initialize(BasicWarehouse warehouse)
 {
     try
     {
         _warehouse = warehouse;
         DateFrom   = new HistoryDateTimePickerViewModel {
             TimeStamp = DateTime.Now.AddDays(-1)
         };
         DateFrom.Initialize(_warehouse);
         DateTo = new HistoryDateTimePickerViewModel {
             TimeStamp = DateTime.Now.AddHours(+1)
         };
         DateTo.Initialize(_warehouse);
         Messenger.Default.Register <MessageViewChanged>(this, vm => ExecuteViewActivated(vm.ViewModel));
     }
     catch (Exception e)
     {
         _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, e.Message);
         throw new Exception(string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
     }
 }