Beispiel #1
0
        private void LoadData()
        {
            var filePath      = HttpContext.Current.Server.MapPath(string.Format("~/Data/{0}", ConfigurationHelper.DataFile));
            var list          = ReadDataHelper.Read(filePath);
            var sanityList    = list.Where(x => !string.IsNullOrEmpty(x.Documento)).ToList();
            var distinctItems = sanityList.Distinct(new DistinctItemComparer()).ToList();
            var databasePath  = HttpContext.Current.Server.MapPath(string.Format("~/Data/{0}", ConfigurationHelper.DatabaseFile));

            // Open database (or create if not exits)
            using (var db = new LiteDatabase(databasePath))
            {
                // Get customer collection
                var customers = db.GetCollection <AfiliadoModel>("customers");

                if (customers.Count() > 0)
                {
                    db.DropCollection("customers");
                    customers.DropIndex("Documento");
                }

                // Inserting a high volume of documents (Id will be auto-incremented)
                customers.InsertBulk(distinctItems);
                // Index document using a document property
                customers.EnsureIndex(x => x.Documento);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Ako ne kuzis idi kroz metode i skuzit ces.
        /// Ako jos uvijek ne kuzis, pitaj Jakova.
        /// </summary>
        private void NasAlgoritamEvaluacija()
        {
            string sviPodaciTekst = ReadDataHelper.ProcitajCSVPodatke();

            string[]            sviRedci       = ReadDataHelper.PrepoznajRetkeIzTeksta(sviPodaciTekst, '\n');
            List <CSVGameModel> ListaSvihIgara = ReadDataHelper.DohvatiListuIgara(sviRedci, ',');

            EvaluationHelper.EvalutateList(ListaSvihIgara);
            List <CSVGameModel> orderedList = ListaSvihIgara.OrderByDescending(x => x.Score).ToList();

            label1st.Text = orderedList[0].GameName + "  - ukupan broj bodova: " + orderedList[0].Score;
            label2nd.Text = orderedList[1].GameName + "  - ukupan broj bodova: " + orderedList[1].Score;
            label3rd.Text = orderedList[2].GameName + "  - ukupan broj bodova: " + orderedList[2].Score;
        }