public void RefreshCount()
 {
     NotifyPropertyChanged("CurrentCount");
     NotifyPropertyChanged("CentralStorageCount");
     MaterialListNotificator.Notify(Item.MaterialId, "StockAvailable");
     MaterialListNotificator.Notify(Item.MaterialId, "ExternStorageCount");
 }
 public void Reload()
 {
     MaterialListNotificator.Clear();
     _materialsData = null;
     NotifyPropertyChanged("MaterialsData");
     _materialOrdersData = null;
     NotifyPropertyChanged("MaterialOrdersData");
     _productOrdersData = null;
     NotifyPropertyChanged("ProductOrdersData");
     _externStorageMaterialsData = null;
     NotifyPropertyChanged("ExternStorageMaterialsData");
 }
 private void ExecuteAddOrderCommand(object param)
 {
     try
     {
         ProductOrderViewModel newItem = Add(CreateData(param));
         MaterialListNotificator.RegisterListener(newItem);
         newItem.RefreshStatisticItems();
         _newOrderViewModel.Code = String.Empty;
     }
     catch (MaterialOrderAlreadyExistException)
     {
         UIApplication.MessageDialogs.Error("MaterialOrderAlreadyExists".Localize());
     }
     catch (DatabaseLockedException)
     {
         UIApplication.MessageDialogs.Error("DatabaseLockedException".Localize());
     }
 }
        private void ExecuteDeleteOrderCommand(object param)
        {
            ProductOrderViewModel viewModel = (ProductOrderViewModel)param;

            StringBuilder question = new StringBuilder();

            question.AppendLine("QuestionRemoveOrder".Localize());
            question.AppendFormat("QuestionRemoveOrderDetail".Localize(), viewModel.NameDescription, viewModel.Code);

            if (UIApplication.MessageDialogs.Question(question.ToString()) == QuestionResult.Negative)
            {
                return;
            }

            Remove(viewModel);
            MaterialListNotificator.UnregisterListener(viewModel);
            MaterialListNotificator.Notify(viewModel.MaterialId, "OrderCount");
        }
        public void Reload(ILongOperationResult result)
        {
            try
            {
                if (result == null)
                {
                    return;
                }

                if (result.CustomAction != null)
                {
                    result.CustomAction();
                }

                if (result.RefreshAll)
                {
                    Reload();
                    return;
                }

                if (result.DataPublished)
                {
                    UIApplication.MessageDialogs.Info("DataSaved".Localize());
                    Reload();
                    return;
                }

                if (result.RefreshProductOrders)
                {
                    _productOrdersData = null;
                    NotifyPropertyChanged("ProductOrdersData");
                }

                if (result.RefreshMaterialOrders)
                {
                    _materialOrdersData = null;
                    NotifyPropertyChanged("MaterialOrdersData");
                }

                if (result.RefreshExternStorageStats)
                {
                    _externStorageMaterialsData = null;
                    NotifyPropertyChanged("ExternStorageMaterialsData");
                }

                if (result.RefreshAllMaterial)
                {
                    _materialsData = null;
                    NotifyPropertyChanged("MaterialsData");
                }

                if (result.MaterialRefreshList != null)
                {
                    foreach (ObjectId materialId in result.MaterialRefreshList)
                    {
                        MaterialListNotificator.Notify(materialId);
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationContext.Log.Error(GetType(), ex);
            }
        }