Example #1
0
        private void AutoButton_Click(object sender, RoutedEventArgs e)
        {
            var ud = _UserDevice;

            if (ud == null)
            {
                return;
            }
            var description = Attributes.GetDescription(_MappedTo);
            var form        = new MessageBoxWindow();
            var buttons     = MessageBoxButton.YesNo;
            var text        = string.Format("Do you want to fill {0} settings automatically?", description);

            if (ud.Device == null && !TestDeviceHelper.ProductGuid.Equals(ud.ProductGuid))
            {
                text    = string.Format("Device is off-line. Please connect device to fill {0} settings automatically.", description);
                buttons = MessageBoxButton.OK;
            }
            var result = form.ShowDialog(text, "Fill Controller Settings", buttons, MessageBoxImage.Question);

            if (result != MessageBoxResult.Yes)
            {
                return;
            }
            var ps = AutoMapHelper.GetAutoPreset(ud);

            _PadSetting.Load(ps);
        }
Example #2
0
        public bool EditSubCategory(SubCategoryViewModel model)
        {
            pub_SubCategoryEntity entity = AutoMapHelper.ToEntity <SubCategoryViewModel, pub_SubCategoryEntity>(model);

            if (entity.Id == 0)
            {
                entity.SubCategoryId = IDHelper.Create("S");
                categoryRepository.InsertSubCategory(entity);
            }
            else
            {
                categoryRepository.UpdateSubCategory(entity);
            }
            return(true);
        }
Example #3
0
        public bool EditArticle(ArticleViewModel model)
        {
            ArticleEntity entity = AutoMapHelper.ToEntity <ArticleViewModel, ArticleEntity>(model);

            if (entity.Id == 0)
            {
                entity.ArticleId = IDHelper.Create("A");
                articleRepository.InsertArticle(entity);
            }
            else
            {
                var last = articleRepository.GetArticleById(entity.Id);
                entity.CreateTime = last.CreateTime;
                entity.ArticleId  = last.ArticleId;
                articleRepository.UpdateArticle(entity);
            }
            return(true);
        }
 /// <inheritdoc/>
 public NOPInput ConvertInput(RecentQuota source)
 => AutoMapHelper.Map <NOPInput>(source);
Example #5
0
        public List <SubCategoryViewModel> GetSubCategoryByCategoryId(string categoryId)
        {
            var result = categoryRepository.GetSubCategoryByCategoryId(categoryId);

            return(AutoMapHelper.ToList <pub_SubCategoryEntity, SubCategoryViewModel>(result));
        }
Example #6
0
        public List <CategoryViewModel> GetCategory()
        {
            var result = categoryRepository.GetCategory();

            return(AutoMapHelper.ToList <pub_CategoryEntity, CategoryViewModel>(result));
        }
Example #7
0
        public ListCategoryViewModel GetListCategoryById(string id, string subid)
        {
            var result = categoryRepository.GetListCategoryById(id, subid);

            return(AutoMapHelper.ToEntity <ListCategoryDto, ListCategoryViewModel>(result));
        }
Example #8
0
        public List <ArticleDtoViewModel> GetLatestArticle()
        {
            var result = articleRepository.GetLatestArticle();

            return(AutoMapHelper.ToList <ArticleDto, ArticleDtoViewModel>(result));
        }
Example #9
0
        public int InsertComment(CommentViewModel model)
        {
            ArticleCommentEntity entity = AutoMapHelper.ToEntity <CommentViewModel, ArticleCommentEntity>(model);

            return(articleRepository.InsertComment(entity));
        }
Example #10
0
        public List <CommentViewModel> GetCommentByArticleId(string ArticleId)
        {
            var result = articleRepository.GetCommentByArticleId(ArticleId);

            return(AutoMapHelper.ToList <ArticleCommentEntity, CommentViewModel>(result));
        }
Example #11
0
        public List <ArticleDtoViewModel> GetArticleDtoBySubCategoryId(string categoryId, string subCategoryId)
        {
            var result = articleRepository.GetArticleDtoBySubCategoryId(categoryId, subCategoryId);

            return(AutoMapHelper.ToList <ArticleDto, ArticleDtoViewModel>(result));
        }
Example #12
0
        public ArticleViewModel GetArticleByArticleId(string articleId)
        {
            var result = articleRepository.GetArticleByArticleId(articleId);

            return(AutoMapHelper.ToEntity <ArticleEntity, ArticleViewModel>(result));
        }
Example #13
0
        public List <ArticleViewModel> GetArticleBySubCategoryId(string subCategoryId)
        {
            var result = articleRepository.GetArticleBySubCategoryId(subCategoryId);

            return(AutoMapHelper.ToList <ArticleEntity, ArticleViewModel>(result));
        }