public void Reload() { System.Threading.ThreadPool.QueueUserWorkItem(delegate { try { ShowLoading(StringResources.captionInformation, StringResources.msgLoading); var articleList = Factory.Resolve <IBaseDataDS>().SearchArticle(new ArticleSearchEntity() { SearchText = this.SearchText }); var categoryList = Factory.Resolve <IBaseDataDS>().SearchCategories(new CategorySearchEntity() { SearchText = "" }); HideLoading(); //display to UI Application.Current.Dispatcher.Invoke(new Action(() => { ArticleList = articleList; SelectedArticle = ArticleList.FirstOrDefault(); CategoryList = categoryList; })); } catch (Exception ex) { HideLoading(); ShowMessageBox(StringResources.captionError, ex.ToString(), MessageBoxButton.OK); } }); }
public void DeleteArticleFromList(ArticleEntity newEntity) { ArticleEntity oldEntity = ArticleList.FirstOrDefault <ArticleEntity>(p => p.ArticleId == newEntity.ArticleId); if (oldEntity != null) { ArticleList.Remove(oldEntity); } ArticleList = new List <ArticleEntity>(_articleList); }
public void AddOrUpdateArticle(ArticleEntity newEntity) { ArticleEntity oldEntity = ArticleList.FirstOrDefault <ArticleEntity>(p => p.ArticleNo == newEntity.ArticleNo); if (oldEntity == null) { ArticleList.Insert(0, newEntity); } else { int index = ArticleList.IndexOf(oldEntity); ArticleList.Remove(oldEntity); ArticleList.Insert(index, newEntity); } ArticleList = new List <ArticleEntity>(_articleList); }
public void AddOrderline() { if (SelectedArticle == null) { SelectedArticle = ArticleList.FirstOrDefault(); } if (SelectedOrder != null && SelectedOrder.OrderId > 0 && SelectedArticle != null && SelectedArticle.ArticleId > 0) { System.Threading.ThreadPool.QueueUserWorkItem(delegate { try { ShowLoading(StringResources.captionInformation, StringResources.msgLoading); OrderlineEntity newEntity = new OrderlineEntity() { OrderId = SelectedOrder.OrderId, ArticleId = SelectedArticle.ArticleId, Quantity = 0, RemainingQuantity = 0, Price = 0, PayDate = DateTime.Now.AddDays(7) }; var updatedEntity = Factory.Resolve <IOrderDS>().AddOrUpdateOrderline(newEntity); HideLoading(); //display to UI Application.Current.Dispatcher.Invoke(new Action(() => { AddOrUpdateOrderlineToList(updatedEntity); })); } catch (Exception ex) { HideLoading(); ShowMessageBox(StringResources.captionError, ex.ToString(), MessageBoxButton.OK); } }); } }