public Dictionary <String, EnglishWord> getAll(string searchField, int page_num, int logged_id = -1)
        {
            Dictionary <String, EnglishWord> words = new Dictionary <String, EnglishWord>();

            using (SqlConnection connection = new SqlConnection(buildDefConnString()))
            {
                SqlCommand   sqlCmd = new SqlCommand(boworseQuerry, connection);
                SqlParameter p1     = new SqlParameter(@"@scale", 20);
                p1.SqlDbType = SqlDbType.Int;
                p1.Direction = ParameterDirection.Input;

                SqlParameter p2 = new SqlParameter(@"@pagenum", page_num);
                p2.SqlDbType = SqlDbType.Int;
                p2.Direction = ParameterDirection.Input;

                SqlParameter p3 = new SqlParameter(@"@search", searchField);
                p3.SqlDbType = SqlDbType.NVarChar;
                p3.Direction = ParameterDirection.Input;

                SqlParameter p4 = new SqlParameter(@"@felhaszId", logged_id);

                sqlCmd.Parameters.Add(p1);
                sqlCmd.Parameters.Add(p2);
                sqlCmd.Parameters.Add(p3);
                sqlCmd.Parameters.Add(p4);

                connection.Open();
                SqlDataReader reader = sqlCmd.ExecuteReader();
                while (reader.Read())
                {
                    if (!words.ContainsKey(reader.GetString(1)))
                    {
                        words.Add(reader.GetString(1), new EnglishWord(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(10), reader.GetInt32(3)));
                        HungarianWord tmp = new HungarianWord(reader.GetInt32(4), reader.GetString(5), reader.GetString(9), reader.GetInt32(6), reader.GetInt32(7), reader.GetInt32(8));
                        tmp.loggedreact = reader.GetString(11);
                        words[reader.GetString(1)].addTranslation(tmp);
                    }
                    else
                    {
                        HungarianWord tmp = new HungarianWord(reader.GetInt32(4), reader.GetString(5), reader.GetString(9), reader.GetInt32(6), reader.GetInt32(7), reader.GetInt32(8));
                        tmp.loggedreact = reader.GetString(11);
                        words[reader.GetString(1)].addTranslation(tmp);
                    }
                }
            }
            return(words);
        }
Exemple #2
0
        private void addOneRowMoultipleTrans(EnglishWord eng, HtmlTable table)
        {
            //addOneRow(eng.getWord(),"-----------", table);
            HtmlTableRow row     = new HtmlTableRow();
            ImageButton  dummy   = new ImageButton();
            ImageButton  like    = new ImageButton();
            ImageButton  dislike = new ImageButton();

            HtmlTableCell cell1 = new HtmlTableCell();
            HtmlTableCell cell2 = new HtmlTableCell();
            HtmlTableCell cell3 = new HtmlTableCell();
            HtmlTableCell cell4 = new HtmlTableCell();
            HtmlTableCell cell5 = new HtmlTableCell();

            ImageButton lenyit = new ImageButton();

            ImageButton addWord = new ImageButton();

            addWord.ImageUrl = "https://i.imgur.com/ceYONF2.png";
            addWord.Attributes.Add("class", "addbutton");
            addWord.Click += new ImageClickEventHandler(this.OpenWindow);
            addWord.ID     = "add_" + eng.getEngID();
            addWord.Attributes.Add("title", "Hozzáadás");

            ImageButton reportWord = new ImageButton();

            reportWord.ImageUrl = "https://i.imgur.com/9Ml0E1o.png";
            reportWord.Attributes.Add("class", "reportbutton");
            reportWord.CommandArgument = "E," + eng.getEngID();
            reportWord.Command        += new CommandEventHandler(this.OpenWindowReport);
            reportWord.ID = "rep_e_" + eng.getEngID();
            reportWord.Attributes.Add("title", "Jelentés");

            lenyit.ID = "Button_lenyit_" + eng.getWord();

            lenyit.Click += new ImageClickEventHandler(this.show_all);
            lenyit.Attributes.Add("runat", "server");


            if (showall[session_id].Contains(eng.getWord()))
            {
                lenyit.ImageUrl = "https://i.imgur.com/4Qv1V8L.png";//lenéz
            }
            else
            {
                lenyit.ImageUrl = "https://i.imgur.com/kkF7JDM.png";//felnéz
            }
            lenyit.Attributes.Add("class", "lenyitbutton");
            //cell1.InnerText = eng.getWord();
            //cell2.InnerText = eng.getTranslations()[0].getHunWord() + "\t";

            LinkButton engWorld = new LinkButton();

            engWorld.Text            = eng.getWord();
            engWorld.ID              = "eng_word_label_" + eng.getEngID();
            engWorld.CssClass        = "textStyle";
            engWorld.Command        += new CommandEventHandler(OpenWindowInfo);
            engWorld.CommandArgument = eng.getWord() + ";" + eng.getUser() + ";" + eng.getDesc();
            cell1.Controls.Add(engWorld);


            LinkButton hunWorld = new LinkButton();

            hunWorld.Text            = eng.getTranslations()[0].getHunWord();
            hunWorld.ID              = "hun_word_label_" + eng.getTranslations()[0].getHunID();
            hunWorld.CssClass        = "textStyle";
            hunWorld.Command        += new CommandEventHandler(OpenWindowInfo);
            hunWorld.CommandArgument = eng.getTranslations()[0].getHunWord() + ";" + eng.getTranslations()[0].getUser() + ";";
            cell2.Controls.Add(hunWorld);

            ImageButton reportWordHun = new ImageButton();

            reportWordHun.ImageUrl = "https://i.imgur.com/9Ml0E1o.png";
            reportWordHun.Attributes.Add("class", "reportbutton");
            reportWordHun.CommandArgument = "H," + eng.getTranslations()[0].getHunID();
            reportWordHun.Command        += new CommandEventHandler(this.OpenWindowReport);
            reportWordHun.ID = "rep_m_" + eng.getTranslations()[0].getHunID();
            reportWordHun.Attributes.Add("title", "Jelentés");

            cell2.Controls.Add(reportWordHun);
            cell2.Controls.Add(lenyit);

            row.Cells.Add(cell1);
            cell1.Controls.Add(addWord);
            cell1.Controls.Add(reportWord);

            row.Cells.Add(cell2);
            row.Cells.Add(cell4);

            row.Attributes.Add("class", "rowStyle");
            row.Attributes.Add("max-height", "30%");
            table.Rows.Add(row);

            /*
             * dummy.ImageUrl = "https://i.imgur.com/Oc1Ynsm.png";
             * dummy.Attributes.Add("class", "likebutton");
             * dummy.ID = "dummy_h_" + eng.getEngID();
             * cell4.Controls.Add(dummy);
             * cell5.Controls.Add(dummy);
             *
             * row.Cells.Add(cell4);
             * row.Cells.Add(cell5);
             */
            HungarianWord hun = eng.getTranslations()[0];

            like.ID = "Button_like_" + hun.getHunID();

            //like.Click += new ImageClickEventHandler(this.like_button_button_Click);
            like.CommandArgument += hun.getHunID();
            like.Command         += new CommandEventHandler(this.like_button_button_Click);

            like.Attributes.Add("runat", "server");

            if (hun.loggedreact == "L")
            {
                like.ImageUrl = "https://i.imgur.com/zQYyaiB.png";
            }
            else
            {
                like.ImageUrl = "https://i.imgur.com/WXVaypj.png";
            }

            like.Attributes.Add("class", "likebutton");

            dislike.ID = "Button_dislike_" + hun.getHunID();

            dummy.ImageUrl = "https://i.imgur.com/Oc1Ynsm.png";
            //dummy.Attributes.Add("class", "likebutton");
            dummy.CssClass = "likebutton";

            //dislike.Click+=new ImageClickEventHandler(this.dislike_button_button_Click);
            dislike.CommandArgument += hun.getHunID();
            dislike.Command         += new CommandEventHandler(this.dislike_button_button_Click);

            dislike.Attributes.Add("runat", "server");
            dislike.ImageUrl = "https://i.imgur.com/aXezCAu.png";
            if (hun.loggedreact == "D")
            {
                dislike.ImageUrl = "https://i.imgur.com/ypitBGN.png";
            }
            else
            {
                dislike.ImageUrl = "https://i.imgur.com/aXezCAu.png";
            }
            dislike.Attributes.Add("class", "likebutton");

            cell1.BgColor = "#101000";
            cell2.BgColor = "#101000";

            cell4.InnerText = "" + hun.getLike();
            cell4.Controls.Add(like);

            cell5.InnerText = "" + hun.getDislike();
            cell5.Controls.Add(dislike);

            row.Cells.Add(cell4);
            row.Cells.Add(cell5);

            if (showall[session_id].Contains(eng.getWord()))
            {
                //lenéz
                cell1.Attributes.Add("rowspan", Convert.ToString((eng.getTranslations().Count())));
                foreach (HungarianWord trans in eng.getTranslations())
                {
                    if (trans != eng.getTranslations()[0])
                    {
                        addOneRow(eng, trans, table, true, true);
                    }
                }
            }
        }
Exemple #3
0
        private void addOneRow(EnglishWord eng_world, HungarianWord hun, HtmlTable table, bool ismultiple, bool spawn = false)
        {
            string eng = eng_world.getWord();

            HtmlTableRow row = new HtmlTableRow();

            HtmlTableCell cell1 = new HtmlTableCell();
            HtmlTableCell cell3 = new HtmlTableCell();

            HtmlTableCell cell4 = new HtmlTableCell();

            ImageButton like    = new ImageButton();
            ImageButton dislike = new ImageButton();

            ImageButton dummy = new ImageButton();

            HtmlTableCell cell5 = new HtmlTableCell();

            LinkButton engWorld = new LinkButton();

            if (!ismultiple)
            {
                engWorld.Text     = eng;
                engWorld.CssClass = "textStyle";
                engWorld.ID       = "eng_word_label_" + eng_world.getEngID();
                //cell1.InnerText = eng;
                cell1.Controls.Add(engWorld);


                ImageButton addWord = new ImageButton();
                addWord.ImageUrl = "https://i.imgur.com/ceYONF2.png";
                addWord.Attributes.Add("class", "addbutton");
                addWord.Click += new ImageClickEventHandler(this.OpenWindow);
                addWord.ID     = "add_" + eng_world.getEngID();
                cell1.Controls.Add(addWord);
                addWord.Attributes.Add("title", "Hozzáadás");

                ImageButton reportWord = new ImageButton();
                reportWord.ImageUrl = "https://i.imgur.com/9Ml0E1o.png";
                reportWord.Attributes.Add("class", "reportbutton");
                reportWord.CommandArgument = "E," + eng_world.getEngID();
                reportWord.Command        += new CommandEventHandler(this.OpenWindowReport);
                reportWord.ID = "rep_e_" + eng_world.getEngID();
                reportWord.Attributes.Add("title", "Jelentés");
                cell1.Controls.Add(reportWord);


                engWorld.Command        += new CommandEventHandler(OpenWindowInfo);
                engWorld.CommandArgument = eng_world.getWord() + ";" + eng_world.getUser() + ";" + eng_world.getDesc();
            }


            //cell3.InnerText = hun.getHunWord();
            LinkButton hunWord = new LinkButton();

            hunWord.Text            = hun.getHunWord();
            hunWord.CommandArgument = hun.getHunWord() + ";" + hun.getUser();
            hunWord.CssClass        = "textStyle2";
            hunWord.Command        += new CommandEventHandler(OpenWindowInfo);
            cell3.Controls.Add(hunWord);
            cell3.BorderColor = "#898E01";


            if (!spawn)
            {
                row.Cells.Add(cell1);
            }


            row.Cells.Add(cell3);

            if (hun.getHunID() != -1)//csak akkor -1 ha még nincs arra az angol szóra fordítás
            {
                if (ismultiple)
                {
                    hunWord.ID = "hun_word_label_m" + hun.getHunID();
                }
                else
                {
                    hunWord.ID = "hun_word_label" + hun.getHunID();
                }


                ImageButton reportWordHun = new ImageButton();
                reportWordHun.ImageUrl = "https://i.imgur.com/9Ml0E1o.png";
                reportWordHun.Attributes.Add("class", "reportbutton");
                reportWordHun.CommandArgument = "H," + hun.getHunID();
                reportWordHun.Command        += new CommandEventHandler(this.OpenWindowReport);
                reportWordHun.ID = "rep_h_" + hun.getHunID();
                reportWordHun.Attributes.Add("title", "Jelentés");
                cell3.Controls.Add(reportWordHun);

                like.ID = "Button_like_" + hun.getHunID();

                //like.Click += new ImageClickEventHandler(this.like_button_button_Click);
                like.CommandArgument += hun.getHunID();
                like.Command         += new CommandEventHandler(this.like_button_button_Click);

                like.Attributes.Add("runat", "server");
                if (hun.loggedreact == "L")
                {
                    like.ImageUrl = "https://i.imgur.com/zQYyaiB.png";
                }
                else
                {
                    like.ImageUrl = "https://i.imgur.com/WXVaypj.png";
                }
                like.Attributes.Add("class", "likebutton");

                dislike.ID = "Button_dislike_" + hun.getHunID();

                dummy.ImageUrl = "https://i.imgur.com/Oc1Ynsm.png";
                //dummy.Attributes.Add("class", "likebutton");
                dummy.CssClass = "likebutton";

                //dislike.Click+=new ImageClickEventHandler(this.dislike_button_button_Click);
                dislike.CommandArgument += hun.getHunID();
                dislike.Command         += new CommandEventHandler(this.dislike_button_button_Click);

                dislike.Attributes.Add("runat", "server");
                if (hun.loggedreact == "D")
                {
                    dislike.ImageUrl = "https://i.imgur.com/ypitBGN.png";
                }
                else
                {
                    dislike.ImageUrl = "https://i.imgur.com/aXezCAu.png";
                }
                dislike.Attributes.Add("class", "likebutton");

                cell4.InnerText = "" + hun.getLike();
                cell4.Controls.Add(like);

                cell5.InnerText = "" + hun.getDislike();
                cell5.Controls.Add(dislike);

                row.Cells.Add(cell4);
                row.Cells.Add(cell5);
            }
            else
            {
                dummy.ImageUrl = "https://i.imgur.com/Oc1Ynsm.png";
                dummy.Attributes.Add("class", "likebutton");
                dummy.ID = "dummy_" + eng_world.getEngID();
                cell4.Controls.Add(dummy);
                cell5.Controls.Add(dummy);

                row.Cells.Add(cell4);
                row.Cells.Add(cell5);

                hunWord.ID = "hun_word_label_" + hun.getHunID() + "_" + eng_world.getEngID();
            }

            row.Attributes.Add("class", "rowStyle");
            row.Attributes.Add("max-height", "30%");

            table.Rows.Add(row);
        }
        //-------------------------------------------------------------|

        public void addTranslation(HungarianWord word)
        {
            hun.Add(word);
        }