private void addNewWord()
        {
            if (Request.Cookies["User"] != null)
            {
                if (Request.Cookies["User"]["Logged"] != null)
                {
                    this.validate(eng_word_textbox.Text);
                    if (word != "" && valid)
                    {
                        string new_word = this.word;
                        string new_desc = this.description;
                        db.addEndlishWord(new_word, new_desc, Request.Cookies["User"]["Logged"]);

                        EnglishWord e     = db.getEnglishWord(word);
                        int         engid = e.getEngID();

                        if (ht.Text != "")
                        {
                            hunword = ht.Text;
                            bool state = !db.addHunWord(hunword, Convert.ToInt32(Request.Cookies["User"]["Logged"]), engid);

                            if (state)
                            {
                                error_hun.Text   = "Volt már ilyen magyar szó.";
                                added_label.Text = "Hozzáadás sikertelen.";
                            }
                            else
                            {
                                error_hun.Text   = "";
                                added_label.Text = "Sikeresen hozzáadva.";
                            }
                        }
                    }
                    else if (!valid)
                    {
                        error_label.Text = "Ez a szó már létezik a szótárban!";
                        added_label.Text = "Hozzáadás sikertelen.";
                    }
                    else
                    {
                        error_label.Text = "Nem megfelelő szó!";
                        added_label.Text = "Hozzáadás sikertelen.";
                    }
                }
            }
        }
Exemple #2
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);
        }
Exemple #3
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);
                    }
                }
            }
        }