public static void SetWords()
            {
                words= new List<string>();

            string[] splitter = { ",","\n","\r" };
           
            int i = 0;
            string[] kwords = new string[140];

            Journal[] j=DataManager.GetJournalData();

            foreach(Journal journal in j)
            {
                
                kwords[i] = journal.Keywords;
                i++;
            
            }
           

                foreach(string tword in kwords)
                {
                    string[] tempKeywords = tword.Split(splitter, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string keyword in tempKeywords)
                    {
                        string temp = keyword;
                        temp = temp.TrimEnd();
                        temp = temp.TrimStart();
                        temp = temp.Replace("(", " ");
                        temp = temp.Replace(")", " ");
                        temp = temp.Replace("'", "");
                        temp = temp.Replace("\n", "");
                        temp = temp.Replace("\r", "");
                        temp = temp.Replace("\\", "");
                        temp = temp.Replace("/", ",");
                        temp = temp.Replace(" ", "-");
                        temp = temp.ToLower();

                        if (words.Contains(temp))
                        { }
                        else
                        {
                           
                            words.Add(temp);
                        }
                    }
                }

               
            }
Exemplo n.º 2
0
        public static float matchACMCloudComputing(string[] keywords)
        {
            savedDataFromACMCC = DataManager.GetData(TableNames.ACM.CloudComputing);
            float perc = 0;

            int totalKeywords = keywords.Length;
            int matched = 0;

            foreach (string word in keywords)
            {

                if (savedDataFromACMCC.Contains(word))
                    matched++;

            }

            perc = ((float)matched / (float)totalKeywords) * 100f;

            return perc;
        }
Exemplo n.º 3
0
        public static float matchACMArtificialIntelligence(string[] keywords)
        {
            savedDataFromACMAI = DataManager.GetData(TableNames.ACM.AI);
            float perc = 0;

            int totalKeywords = keywords.Length;
            int matched = 0;

            foreach (string word in keywords)
            {

                if (savedDataFromACMAI.Contains(word))
                    matched++;

            }

            perc = ((float)matched / (float)totalKeywords) * 100f;

            return perc;
        }
            public static string[] PrepareUserKeywords(string SampleKeywordsText)
            {
                List<string> Keywords = new List<string>();
                try
                {
                    int i=0;
                    string[] splitter = { ".", " ", ":", ",", ";", "'", "\"", "(", ")" };
                    string[] UserWords = SampleKeywordsText.Split(splitter, StringSplitOptions.RemoveEmptyEntries);


                    SetWords();

                    foreach (string uWord in UserWords)
                    {

                        foreach (string word in words)
                        {

                        if (word.Contains("-") && i<UserWords.Length-1 )
                        {
                            int k=i+1;
                            if (word.ToLower() == uWord.ToLower()+"-"+UserWords[k].ToLower())
                            {

                                Keywords.Add(word);
                                break;
                            }
                        }
                        else
                        {
                            if (word.ToLower() == uWord.ToLower())
                            {

                                Keywords.Add(word);
                                break;
                            }

                        }

                        }

                        i++;
                    }
                }
                catch (Exception es)
                { }

                List<string> newWords = new List<string>();


                foreach (string temp in Keywords)
                {

                    if (newWords.Contains(temp))
                    {

                    }
                    else
                    {

                        newWords.Add(temp);
                    
                    }
                
                }


                words = new List<string>();
                StreamReader read = new StreamReader(HttpContext.Current.Server.MapPath("~/App_Data/Words.txt"));

                string lineRead = read.ReadLine();

                while (lineRead != null)
                {

                    words.Add(lineRead);
                    try
                    {
                        lineRead = read.ReadLine();
                    }
                    catch (NullReferenceException ec)
                    {
                        break;
                    }
                }
                read.Close();
                read.Dispose();


                foreach (string word in words)
                {

                    if (newWords.Contains(word))
                    {

                        newWords.Remove(word);
                    }
                
                }

                return newWords.ToArray();
            }
            public static string ProcessWords(string text)
            {
                ///////////////////////// Get words list ////////////////////////////////
                StreamReader read = new StreamReader(HttpContext.Current.Server.MapPath("~/App_Data/Words.txt"));

                string lineRead = read.ReadLine();

                while (lineRead != null)
                {

                    words.Add(lineRead);
                    try
                    {
                        lineRead = read.ReadLine();
                    }
                    catch (NullReferenceException ec)
                    {
                        break;
                    }
                }
                read.Close();
                read.Dispose();
                /////////////////////////////////////////////////////////////////////////
                string[] splitter = { "," };
                string[] wordsArray = text.Split(splitter, StringSplitOptions.RemoveEmptyEntries);


                //////////////////// Check if words is /////////////////////////////////
                foreach (string word in words)
                {
                    for (int count = 0; count < wordsArray.Length; count++)
                    {
                        if (wordsArray[count].ToLower() == word.ToLower())
                            wordsArray[count] = "";




                    }


                }
                ///////////////////////////////////////////////////////////////////////



                List<string> listString = wordsArray.ToList();



                listString.RemoveAll(item => item == "");


                List<string> newWords = new List<string>();


                foreach (string word in listString)
                {


                    if (newWords.Contains(word))
                    {

                    }
                    else
                    {
                        newWords.Add(word);

                    }

                }

                text = String.Join(",", newWords.ToArray());
                return text;
            }
Exemplo n.º 6
0
        private void LogIn()
        {
            if (Text1.Value != "")
            {
                if (Text2.Value != "")
                {
                    User u = new User();

                    List<string> listOfUsers = new List<string>();

                    string connectionString = WebConfigurationManager.ConnectionStrings["JE-Banken"].ConnectionString;
                    NpgsqlConnection conn = new NpgsqlConnection(connectionString);

                    string sql = "SELECT username FROM employees";

                    NpgsqlCommand cmd = new NpgsqlCommand(sql, conn);
                    conn.Open();
                    NpgsqlDataReader dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        listOfUsers.Add(dr["username"].ToString());
                    }
                    conn.Close();

                    if (listOfUsers.Contains(Text1.Value))
                    {
                        string sql2 = "SELECT * FROM employees WHERE username='******'";

                        NpgsqlCommand cmd2 = new NpgsqlCommand(sql2, conn);
                        conn.Open();
                        NpgsqlDataReader dr2 = cmd2.ExecuteReader();

                        while (dr2.Read())
                        {
                            u.password = dr2["password"].ToString();
                            u.employeenumber = Convert.ToInt32(dr2["employeenumber"]);
                            if (Convert.ToString(dr2["licensed"]) == "")
                            {
                                u.licensed = null;
                            }
                            else
                            {
                                u.licensed = Convert.ToBoolean(dr2["licensed"]);
                            }
                        }
                        if (u.password == Text2.Value)
                        {
                            u.password = Text2.Value;
                            u.username = Text1.Value;

                            Session["user"] = u;
                            if(u.username == "Admin")
                            {
                                Response.Redirect("~/Admin.aspx");
                            }
                            else
                            {
                                Response.Redirect("~/Formular.aspx");
                            }

                        }
                        else
                        {
                            Label1.Text = "Fel lösenord.";
                        }
                    }
                    else
                    {
                        Label1.Text = "Fel användarnamn.";
                    }
                }
                else
                {
                    Label1.Text = "Ange lösenord.";
                }
            }
            else
            {
                Label1.Text = "Ange användarnamn.";
            }
        }
Exemplo n.º 7
0
        public static float matchSpringerTCS(string[] keywords)
        {
            savedDataFromSpringerTCS = DataManager.GetData(TableNames.Springer.TheoriticalComputerScience);
            float perc = 0;

            int totalKeywords = keywords.Length;
            int matched = 0;

            foreach (string word in keywords)
            {

                if (savedDataFromSpringerTCS.Contains(word))
                    matched++;

            }

            perc = ((float)matched / (float)totalKeywords) * 100f;

            return perc;
        }
Exemplo n.º 8
0
        public static float matchSpringerMCP(string[] keywords)
        {
            savedDataFromSpringerMCP = DataManager.GetData(TableNames.Springer.MathematicalAndComputationalPhysics);
            float perc = 0;

            int totalKeywords = keywords.Length;
            int matched = 0;

            foreach (string word in keywords)
            {

                if (savedDataFromSpringerMCP.Contains(word))
                    matched++;

            }

            perc = ((float)matched / (float)totalKeywords) * 100f;

            return perc;
        }
Exemplo n.º 9
0
        public static float matchSpringerIS(string[] keywords)
        {
            savedDataFromSpringerIS = DataManager.GetData(TableNames.Springer.InformationSystems);
            float perc = 0;

            int totalKeywords = keywords.Length;
            int matched = 0;

            foreach (string word in keywords)
            {

                if (savedDataFromSpringerIS.Contains(word))
                    matched++;

            }

            perc = ((float)matched / (float)totalKeywords) * 100f;

            return perc;
        }
Exemplo n.º 10
0
        public static float matchElsevierSoftwareEngineering(string[] keywords)
        {
            savedDataFromElsevierSE = DataManager.GetData(TableNames.Elsevier.SoftwareEngineering);
            float perc = 0;

            int totalKeywords = keywords.Length;
            int matched = 0;

            foreach (string word in keywords)
            {

                if (savedDataFromElsevierSE.Contains(word))
                    matched++;

            }

            perc = ((float)matched / (float)totalKeywords) * 100f;

            return perc;
        }
Exemplo n.º 11
0
        public static float matchElsevierDistributedDatabase(string[] keywords)
        {
            savedDataFromElsevierDDB = DataManager.GetData(TableNames.Elsevier.DistributedDatabase);
            float perc = 0;

            int totalKeywords = keywords.Length;
            int matched = 0;

            foreach (string word in keywords)
            {

                if (savedDataFromElsevierDDB.Contains(word))
                    matched++;

            }

            perc = ((float)matched / (float)totalKeywords) * 100f;

            return perc;
        }
Exemplo n.º 12
0
        //searches for classes that are available this quarter that student meets requirements for
        protected List<string> QtrClassSearch()
        {
            List<string> currentClasses = new List<string>();
            List<string> needed = new List<string>();
            List<int> reqList = new List<int>();
            int count;

            if (date[1] == 3 || date[1] == 4) count = SummerN;
            else count = QtrN;

            //if you still need intro courses, you can't take any else
            if (introNeeded)
            {
                reqList = new List<int>(introReqID);
                reqList.Sort();
                foreach (int ReqID in reqList)
                {
                    //gets classes offered that have met prereqs
                    needed = ClassesOffered(ReqID);
                    while (count > 0 && needed.Count() > 0 && ReqIDNumberNeeded[ReqID] > 0)
                    {
                        string course = needed[0];
                        needed.Remove(course);
                        ReqIDClassesNeeded[ReqID].Remove(course);

                        if (!studentHistory.Contains(course) && !currentClasses.Contains(course))
                        {
                            ReqIDNumberNeeded[ReqID] = ReqIDNumberNeeded[ReqID] - 1;
                            count = count - 1;
                            currentClasses.Add(course);
                        }
                    }
                }
                if (checkIntro()) introNeeded = false;
            }
            //searches for main courses
            else
            {
                reqList = new List<int>(mainReqID);
                reqList.Sort();
                foreach (int ReqID in reqList)
                {
                    //gets classes offered that have met prereqs
                    needed = ClassesOffered(ReqID);
                    while (count > 0 && needed.Count() > 0 && ReqIDNumberNeeded[ReqID] > 0)
                    {
                        string course = needed[0];
                        needed.Remove(course);
                        ReqIDClassesNeeded[ReqID].Remove(course);

                        //if(course == "GAM 690") resultsBox.Items.Add(new ListItem("Looking at " + course + "in qtrSearch", course));

                        if (!studentHistory.Contains(course) && !currentClasses.Contains(course))
                        {
                            ReqIDNumberNeeded[ReqID] = ReqIDNumberNeeded[ReqID] - 1;
                            count = count - 1;
                            currentClasses.Add(course);
                        }
                    }
                }
            }
            //adds classes to studenthistory
            foreach (string cl in currentClasses) { studentHistory.Add(cl); }
            return currentClasses;
        }