示例#1
0
        public List <listcustomechart> PerVideoCount(WordType wt, LeapKinnectType lk)
        {
            return(_video.Include(x => x.Words)//.Include(x => x.User)
                   .Where(x => x.Words.WordType == wt && x.LeapKinnectType == lk)
                   .GroupBy(x => x.Words.Name)
                   .Select(c => new listcustomechart
            {
                wordname = c.Key,
                count = c.Count()                    //g.Select(m => m.Name).Count()
            }).ToList());

            /*return _word.Include(x => x.Languages)//.Include(x => x.User)
             *                  .Where(x => x.WordType == wt)
             *                  .GroupBy(x => x.Name)
             *                  .Select(c => new listcustomechart
             *                  {
             *                      wordname = c.Key,
             *                      count = c.Count()//g.Select(m => m.Name).Count()
             *                  }).ToList();*/
            //var results = (from v in _video
            //              join w in _word on v.Words.word_id equals w.word_id
            //              where v.Words.WordType == wt
            //              group w by w.Name into g
            //              select new listcustomechart
            //              {
            //                  wordname = g.Key,
            //                  count = g.Select(m => m.Name).Count()
            //              }).ToList();

            //return results;
            //return (from v in _video join w in _word on v.Words.word_id equals w.word_id where v.Words.WordType == wt select v).Count();

            //return _word.Count(x => x.WordType == wt);
        }
示例#2
0
        public int VideoCount(WordType wt, LeapKinnectType lk)
        {
            return((from v in _video
                    join w in _word on v.Words.word_id equals w.word_id
                    where v.Words.WordType == wt && v.LeapKinnectType == lk select v).Count());

            //return _word.Count(x => x.WordType == wt);
        }
示例#3
0
 public List <listcustomechart> PerVideoPartCount8(LeapKinnectType mlk)
 {
     return(word.PerVideoCount(WordType.Arbitrary_Sentences, mlk));
 }
示例#4
0
 public List <listcustomechart> PerVideoPartCount7(LeapKinnectType mlk)
 {
     return(word.PerVideoCount(WordType.Sentences_By_Signs, mlk));
 }
示例#5
0
 public List <listcustomechart> PerVideoPartCount5(LeapKinnectType mlk)
 {
     return(word.PerVideoCount(WordType.Words_By_Letters, mlk));
 }
示例#6
0
 public List <listcustomechart> PerVideoPartCount2(LeapKinnectType mlk)
 {
     return(word.PerVideoCount(WordType.Numberslarger10, mlk));
 }
示例#7
0
 public int VideoCount8(LeapKinnectType mlk)
 {
     return(word.VideoCount(WordType.Arbitrary_Sentences, mlk));
 }
示例#8
0
 public int VideoCount7(LeapKinnectType mlk)
 {
     return(word.VideoCount(WordType.Sentences_By_Signs, mlk));
 }
示例#9
0
 public int VideoCount5(LeapKinnectType mlk)
 {
     return(word.VideoCount(WordType.Words_By_Letters, mlk));
 }
示例#10
0
 public int VideoCount4(LeapKinnectType mlk)
 {
     return(word.VideoCount(WordType.Words_By_Signs, mlk));
 }
示例#11
0
 public int VideoCount2(LeapKinnectType mlk)
 {
     return(word.VideoCount(WordType.Numberslarger10, mlk));
 }
示例#12
0
 public int VideoCount1(LeapKinnectType mlk)
 {
     return(word.VideoCount(WordType.Numberslitle10, mlk));
 }
示例#13
0
        public WordVideoVM(VideoModel model, int videostyp, int?word_id, LeapKinnectType thisleaporkin, IUnitOfWork uw)
        {
            Contract.Requires(model != null);
            _uow      = uw;
            videotype = videostyp;
            VideoInfo = model;
            video     = new VideoService(_uow);
            word      = new WordsService(_uow);
            option    = new OptionService(_uow);
            user      = new UserService(_uow);
            listitem  = new ListItems();

            wordid = word_id;
            //AllLanguages = GetAllLanguages();
            //allWordTypes = listitem.GetWordType();
            app = option.GetAll();

            lk = thisleaporkin;
            //app.FileUrl = "c:";


            RefreshProducts();

            chatmodel = new MSChartVM();
            //chatmodel.BarChart();
            charttest = chatmodel.BarSeriesCollection;// PerVideoPartCount();


            if (model != null /* && UtilityClass.CheckIntHasValue(model.video_id)*/)
            {
                //wordType = model.Words.WordType;
                //elang = model.Words.Languages;
                //Name = model.Words.Name;
                eword = model.Words;

                if (!string.IsNullOrEmpty(model.KinnectFilePath) && videotype == 1)
                {
                    //euser = model.User;
                    //if (model.User_id.HasValue)
                    //    User_id = model.User_id.Value;

                    _attachPicture = new Uri(app.FileUrl + @"\" + model.KinnectFilePath);//UtilityClass.ByteToStream(app.FileUrl + model.FilePath);
                    selectedpic    = model.KinnectFilePath;
                    prevpic        = model.KinnectFilePath;
                }
                else if (!string.IsNullOrEmpty(model.LeapFilePath) && videotype != 1)
                {
                    //euser = model.User;
                    //if (model.User_id.HasValue)
                    //    User_id = model.User_id.Value;

                    _attachPicture = new Uri(app.FileUrl + @"\" + model.LeapFilePath);//UtilityClass.ByteToStream(app.FileUrl + model.FilePath);
                    selectedpic    = model.LeapFilePath;
                    prevpic        = model.LeapFilePath;
                }
            }


            ConfigureValidationRules();
            Validator.ResultChanged += OnValidationResultChanged;
        }
示例#14
0
        public ObservableCollection <VideoModel> GetWords(int start, int
                                                          itemCount, string sortColumn, bool ascending, out int totalItems, int?wordid, LeapKinnectType lk)
        {
            //using (var context = new MyDbContext())
            //{
            IList <VideoModel> allpats = ((wordid.HasValue)?_video.Include(x => x.User)
                                          .Include(x => x.Words)
                                          .Where(x => x.word_id == wordid.Value && x.LeapKinnectType == lk)
                                          .Select(c => new VideoModel
            {
                video_id = c.video_id,
                KinnectFilePath = c.KinnectFilePath,
                LeapFilePath = c.LeapFilePath,
                User_id = c.User_id.Value,
                User = c.User,
                Words = c.Words,
                word_id = c.word_id
            }).ToList():
                                          _video.Include(x => x.User)
                                          .Include(x => x.Words)
                                          .Where(x => x.LeapKinnectType == lk)
                                          .Select(c => new VideoModel
            {
                video_id = c.video_id,
                KinnectFilePath = c.KinnectFilePath,
                LeapFilePath = c.LeapFilePath,
                User_id = c.User_id.Value,
                User = c.User,
                Words = c.Words,
                word_id = c.word_id
            }).ToList());

            totalItems = allpats.Count;
            ObservableCollection <VideoModel> sortedProducts = new
                                                               ObservableCollection <VideoModel>();

            // Sort the products. In reality, the items should be stored in a  database and
            // use SQL statements for sorting and querying items.
            switch (sortColumn)
            {
            case ("video_id"):
                sortedProducts = new ObservableCollection <VideoModel>
                                 (
                    from p in allpats
                    orderby p.video_id
                    select p
                                 );
                break;
            }
            sortedProducts = ascending ? sortedProducts : new
                             ObservableCollection <VideoModel>(sortedProducts.Reverse());
            ObservableCollection <VideoModel> filteredProducts = new
                                                                 ObservableCollection <VideoModel>();

            for (int i = start; i < start + itemCount && i < totalItems; i++)
            {
                filteredProducts.Add(sortedProducts[i]);
            }
            return(filteredProducts);
            //}
        }