Ejemplo n.º 1
0
        public IEnumerable <IArticleCode> GetMatchingArticleCodes(string codePart, ArticleCodeType codeType)
        {
            int codeTypeValue          = (int)codeType;
            List <IArticleCode> result = new List <IArticleCode>();

            using (StoreKeeperDataContext dataContext = new StoreKeeperDataContext())
            {
                foreach (Article article in dataContext.Articles.Where(a => a.Code.ToUpper().StartsWith(codePart.ToUpper())))
                {
                    if (article.Type == codeTypeValue || codeTypeValue == 0)
                    {
                        result.Add(new ArticleCode(article.Code, article.Name));
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public bool IsCodeValid(string code, ArticleCodeType codeType)
        {
            if (DatabaseStatus == DatabaseStatus.Blocked)
            {
                return(false);
            }

            int codeTypeValue = (int)codeType;

            using (StoreKeeperDataContext dataContext = new StoreKeeperDataContext())
            {
                Article article = dataContext.Articles.FirstOrDefault(a => a.Code.ToUpper() == code.ToUpper());
                if (article == null)
                {
                    return(false);
                }
                return(article.Type == codeTypeValue || codeTypeValue == 0);
            }
        }
Ejemplo n.º 3
0
 public NewOrderViewModel(ArticleCodeType codeType, Action <object> executeAction, Predicate <object> canExecutePredicate = null)
 {
     _codeType            = codeType;
     _executeAction       = executeAction;
     _canExecutePredicate = canExecutePredicate;
 }