Пример #1
0
        public void SelectFuncCalisiyormu()
        {
            //fakülteler tablosunda HFTTF varmı?
            DB_Operation    db = new DB_Operation();
            List <string[]> ll = db.Select(sqlConnectionString.fakulteIsimleri);

            Assert.AreEqual("HFTTF", ll[0][1]);
        }
Пример #2
0
        internal static Dictionary <Person, double> queryUser(HashSet <string> np)
        {
            Dictionary <Person, double> result   = new Dictionary <Person, double>();
            Dictionary <Person, double> s_result = new Dictionary <Person, double>();

            foreach (string nnp in np)
            {
                Dictionary <string, string> users = DB_Operation.queryUser(nnp);
                foreach (string u in users.Keys)
                {
                    Person p = new Person();
                    p.userLogin = u;
                    //p.email = DB_Operation.GetEmailByUserLogin(u);
                    p.email       = "";
                    p.homepageurl = Tools.GetHomepageByUserLogin(u);
                    double score = Convert.ToDouble(users[u]);
                    //string keywordsList = users[u];
                    //List<Tuple<string, double>> kList = Tools.StringToTupleList(keywordsList);
                    //foreach (Tuple<string, double> t in kList)
                    //{
                    //    if (Tools.SimScore(t.Item1, nnp) > 0.8)
                    //    {
                    //        string k = nnp.ToLower();
                    //        if (result.ContainsKey(p))
                    //        {
                    //            double curScore = result[p];
                    //            curScore += t.Item2;
                    //            result[p] = curScore;
                    //        }
                    //        else
                    //            result.Add(p, t.Item2);
                    //    }
                    if (result.ContainsKey(p))
                    {
                        result[p] += score;
                    }
                    else
                    {
                        result.Add(p, score);
                    }
                }
            }
            int stop      = 10 < result.Count ? 10 : result.Count;
            var sortedDic = from entry in result orderby entry.Value descending select entry;
            int topcount  = 0;

            foreach (var s in sortedDic)
            {
                //s.Key.email = DB_Operation.GetEmailByUserLogin(s.Key.userLogin);
                s_result.Add(s.Key, s.Value);
                topcount++;
                if (topcount >= stop)
                {
                    break;
                }
            }
            return(s_result);
        }
Пример #3
0
        public void SaveFuncCalisiyormu()
        {
            //personellere veri ekleyebiliyormu ?
            DB_Operation  db   = new DB_Operation();
            List <string> test = new List <string>()
            {
                "XXX", "YYY"
            };
            bool result = db.Save(sqlConnectionString.personelEkle, sqlConnectionString.personelParam, test);

            Assert.AreEqual(true, result);
        }
Пример #4
0
        internal static Dictionary <Project, double> queryProject(HashSet <string> np)
        {
            Dictionary <Project, double> result   = new Dictionary <Project, double>();
            Dictionary <Project, double> s_result = new Dictionary <Project, double>();

            foreach (string nnp in np)
            {
                Dictionary <string, string> repos = DB_Operation.queryProject(nnp);
                //Console.WriteLine("projects for keyword:{0}", nnp);
                foreach (string r in repos.Keys)
                {
                    Project pr = new Project();
                    //pr.projectDescription =
                    string description = repos[r];
                    pr.projectName        = r;
                    pr.projectDescription = Tools.HashToOutput(Tools.deDuplicateBy(description, ','));
                    pr.creator            = Tools.GetPersonByProjectName(r);
                    pr.projectUrl         = Tools.GetHomepageByProjectName(r);
                    HashSet <string> list = Tools.deDuplicateBy(description, ',');
                    //List<Tuple<string, double>> kList = Tools.StringToTupleList(keywordsList);
                    foreach (string descrip in list)
                    {
                        string[] compo = description.Split(' ');
                        foreach (string c in compo)
                        {
                            double ssscore = Tools.SimScore(c, nnp);
                            if (ssscore > 0.8)
                            {
                                string k = nnp.ToLower();
                                if (result.ContainsKey(pr))
                                {
                                    double curScore = result[pr];
                                    curScore  += ssscore;
                                    result[pr] = curScore;
                                }
                                else
                                {
                                    result.Add(pr, ssscore);
                                }
                            }
                        }
                    }
                    //foreach (Tuple<string, double> t in kList)
                    //{
                    //    if (Tools.SimScore(t.Item1, nnp) > 0.8)
                    //    {
                    //        string k = nnp.ToLower();
                    //        if (result.ContainsKey(u))
                    //        {
                    //            double curScore = result[k];
                    //            curScore += t.Item2;
                    //            result[u] = curScore;
                    //        }
                    //        else
                    //            result.Add(u, t.Item2);
                    //    }

                    //}
                }
            }
            int stop      = 10 < result.Count ? 10 : result.Count;
            var sortedDic = from entry in result orderby entry.Value descending select entry;
            int topcount  = 0;

            foreach (var s in sortedDic)
            {
                s_result.Add(s.Key, s.Value);
                topcount++;
                if (topcount >= stop)
                {
                    break;
                }
            }
            return(s_result);
        }