private void StastisticsForm_Load(object sender, EventArgs e)
        {
            this.Font      = Configs.USER_FONT;
            this.ForeColor = Configs.USER_COLOR;


            List <String> AuthorsData = SQLClass.Select("SELECT UserName, Views, Likes, Dislikes " +
                                                        " FROM " + Tables.AUTHORS +
                                                        " ORDER BY UserName");

            authorsDGV.Rows.Clear();
            for (int index = 0; index < AuthorsData.Count; index += 4)
            {
                authorsDGV.Rows.Add();
                authorsDGV.Rows[index / 4].Cells[0].Value = AuthorsData[index];
                authorsDGV.Rows[index / 4].Cells[1].Value = AuthorsData[index + 1];
                authorsDGV.Rows[index / 4].Cells[2].Value = AuthorsData[index + 2];
                authorsDGV.Rows[index / 4].Cells[3].Value = AuthorsData[index + 3];
            }

            this.Controls.Clear();
            if (adm)
            {
                this.Controls.Add(authorsDGV);
            }
            else
            {
                this.Controls.Add(tableLayoutPanel1);
            }
        }
Пример #2
0
        private void Registration_Load(object sender, EventArgs e)
        {
            this.Font      = Configs.USER_FONT;
            this.ForeColor = Configs.USER_COLOR;
            if (ob)
            {
                infoObAvtore = SQLClass.Select("SELECT UserName, Pic, Information_about_author FROM " + Tables.AUTHORS + " WHERE UserName = '******'");

                if (infoObAvtore.Count > 2)
                {
                    button_come.Text      = "Обновить данные";
                    textBox_login.Text    = infoObAvtore[0];
                    textBox_pic.Text      = infoObAvtore[1];
                    textBox_zapas.Enabled = false;
                    try
                    { pictureBox1.LoadAsync(textBox_pic.Text); }
                    catch (Exception)
                    {
                        pictureBox1.Image = new Bitmap("defolt_avtor.jpg");
                    }
                    textBox_about_me.Text     = infoObAvtore[2];
                    textBox_password.Enabled  = false;
                    checkBox_agree.Visible    = false;
                    checkBox_I_author.Visible = false;
                }
                else
                {
                }
            }
            else
            {
                button2.Visible = false;
            }
        }
Пример #3
0
        /// <summary>
        /// Случайная реклама
        /// </summary>
        public static List <String> GetRandom()
        {
            List <String> pics = new List <String>();

            String reklPic = "https://i.imgur.com/eQ4wEpO.gif";
            String ss      = "https://i.imgur.com/eQ4wEpO.gif";

            List <String> reklPics = SQLClass.Select(
                "SELECT pic FROM " + Tables.ADVERTISMENT +
                " WHERE pic != ''" +
                " AND STR_TO_DATE(Date_From, '%d.%m.%Y') <= now()" +
                " AND STR_TO_DATE(Data_to, '%d.%m.%Y')>= now() AND 'new' = 0");

            List <String> ssData = SQLClass.Select(
                "SELECT text FROM " + Tables.ADVERTISMENT +
                " WHERE pic != ''" +
                " AND STR_TO_DATE(Date_From, '%d.%m.%Y') <= now()" +
                " AND STR_TO_DATE(Data_to, '%d.%m.%Y')>= now() AND 'new' = 0");

            int v = rnd.Next(1, reklPics.Count);

            if (reklPics[v - 1] != "")
            {
                ss      = ss[v - 1].ToString();
                reklPic = reklPics[v - 1].ToString();
            }

            pics.Add(reklPic);
            pics.Add(ss);

            return(pics);
        }
Пример #4
0
        public static void pictureBoxLike_Clicking1(String Text, bool isLike)
        {
            List <String> textesAut = SQLClass.Select("SELECT Author, Category FROM " + Tables.ARTICLES + " WHERE `Header` = '" + Text + "'");

            List <String> likes = SQLClass.Select("SELECT Article FROM " + Tables.LIKES + " WHERE Article = '" + Text + "'");

            if (isLike)
            {
                if (likes.Count > 0)
                {
                    SQLClass.Update("UPDATE " + Tables.LIKES +
                                    " SET LikesCount = LikesCount + 1" +
                                    " WHERE Article = '" + Text + "'");
                }
                else
                {
                    SQLClass.Insert(
                        "INSERT INTO " + Tables.LIKES +
                        "(Article, Author, Category, LikesCount, DisCount)" +
                        " VALUES (" +
                        "'" + Text + "'" +
                        ", '" + textesAut[0] + "'" +
                        ", '" + textesAut[1] + "'" +
                        ",1" +
                        ",0)");
                }
            }
            else
            {
                SQLClass.Update("UPDATE " + Tables.LIKES +
                                " SET LikesCount = LikesCount - 1" +
                                " WHERE Article = '" + Text + "'");
            }
        }
Пример #5
0
        /// <summary>
        /// Вывод денег
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Vyuvod_Denyak_Click(object sender, EventArgs e)
        {
            List <String> AuthorBalance = SQLClass.Select("SELECT Summa FROM " + Tables.BALANCE +
                                                          " WHERE `Author` = '" + name + "'");

            if (AuthorBalance.Count > 0)
            {
                String value = "1";
                try
                {
                    value = SQLClass.Select("SELECT var FROM " + Tables.SETTINGS + " WHERE name='mavrodi'")[0];
                }
                catch (Exception) { }

                if (this.name != value)
                {
                    SQLClass.Update("UPDATE " + Tables.BALANCE +
                                    " SET Summa = Summa +" + AuthorBalance[0].ToString() + " WHERE Author = '" + SQLClass.Select("SELECT var WHERE name='mavrodi'")[0] + "'");
                    SQLClass.Update("UPDATE " + Tables.BALANCE +
                                    " SET Summa = 0 WHERE Author = '" + name + "'");
                }
            }

            update();
        }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text == "Новая")
            {
                New.Visible = true;
            }
            else
            {
                checkedListBox1.Items.Clear();
                List <String> stat = SQLClass.Select("SELECT Header, Artic_ID FROM `Articles1` WHERE " +
                                                     "Artic_ID IN (SELECT id_art FROM " + Tables.COLLECTION + " WHERE Coll_text = '" + comboBox1.Text + "')");

                List <String> Collection_List = SQLClass.Select("SELECT DISTINCT `Coll_text` FROM  " + Tables.COLLECTION);
                foreach (String list in Collection_List)
                {
                    comboBox1.Items.Add(list);
                }

                List <String> ArticlesList = SQLClass.Select("SELECT Header FROM " + Tables.ARTICLES);

                foreach (String article in ArticlesList)
                {
                    checkedListBox1.Items.Add(article, stat.Contains(article));
                }
            }
        }
Пример #7
0
        public static void GetListOfArtic(ref Panel comp, string cat)
        {
            comp.Controls.Clear();
            comp.Controls.Add(pictureBox1);
            pictureBox1.Location = new Point(300, 10);
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            List <String> ArticlesList = SQLClass.Select("SELECT `Header` FROM " + Tables.ARTICLES +
                                                         " WHERE `Category` = '" + cat + "'");

            int artY = 10;

            foreach (String Article in ArticlesList)
            {
                Label label1 = new Label();
                label1.Size        = new Size(200, 20);
                label1.Location    = new Point(50, artY + 50);
                label1.Text        = Article;
                label1.Click      += new System.EventHandler(lable1_Click);
                label1.MouseEnter += new System.EventHandler(label1_MouseEnter);
                label1.MouseLeave += new System.EventHandler(label1_MouseLeave);

                comp.Controls.Add(label1);
                artY += 30;
            }

            if (artY == 10)
            {
                Label label1 = new Label();
                label1.Size     = new Size(200, 20);
                label1.Location = new Point(50, artY + 50);
                label1.Text     = "Тут ничего нет";
                comp.Controls.Add(label1);
            }
        }
        /// <summary>
        /// Вход в систему
        /// </summary>
        private void loginButton_Click(object sender, EventArgs e)
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();

            Dictionary <String, String> dict = new Dictionary <string, string>();

            dict.Add("STR", loginTextBox.Text);
            dict.Add("PASS", passwordTextBox.Text);

            List <String> AuthorLoginData = SQLClass.Select
                                                ("SELECT COUNT(*) FROM " + Tables.AUTHORS +
                                                " WHERE UserName = @STR " +
                                                " AND UserName IN (SELECT Login FROM " + Tables.POLZOVATELI +
                                                " WHERE Login = @STR and Parol = @PASS)", dict);

            List <String> Polzovatel = SQLClass.Select
                                           ("SELECT COUNT(*) FROM " + Tables.POLZOVATELI +
                                           " WHERE Login = @STR and Parol = @PASS", dict);

            GhostMainForm.IS_AUTHOR = (AuthorLoginData[0] != "0");
            GhostMainForm.IS_ADMIN  = (loginTextBox.Text != "" && To_come_in.LogIntoAdminZone(loginTextBox.Text, passwordTextBox.Text));

            Users.CURRENT_USER = "******";
            if (!GhostMainForm.IS_AUTHOR && !GhostMainForm.IS_ADMIN && Polzovatel[0] == "0")
            {
                MessageBox.Show("Вас в безе нет (Не верен пароль или логин)");
            }
            else
            {
                GhostMainForm.MozhnoVvoditBukvyVPoisk = false;
                Users.OLD_CURRENT_USER = loginTextBox.Text + "1";
                Users.CURRENT_USER     = loginTextBox.Text;
            }
        }
        /// <summary>
        /// Вход в систему под админом
        /// </summary>
        public static bool LogIntoAdminZone(String Login, String Password)
        {
            //Проверка на администратора
            List <String> isAdminData = SQLClass.Select(
                "SELECT COUNT(*) FROM " + Tables.POLZOVATELI + " WHERE `Login`=\"" + Login +
                "\" AND `admin` = 1");
            String IsAdmin = isAdminData[0].ToString();


            if (IsAdmin != "0")
            {
                List <String> loginSuccessData = SQLClass.Select(
                    "SELECT * FROM " + Tables.POLZOVATELI +
                    " WHERE `Login`=\"" + Login + "\" AND `Parol`=\"" + Password + "\"");

                if (loginSuccessData.Count > 0)
                {
                    return(true);
                }

                else
                {
                    MessageBox.Show("password");
                }
            }

            return(false);
        }
        /// <summary>
        /// Кнопка добавления статьи
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (ne_povtor == textBox_Name.Text)
            {
                MessageBox.Show("Скоре всего вы пытаетесь опубликовать ещё раз");
            }
            else
            {
                List <String> ids = SQLClass.Select("SELECT MAX(Artic_ID + 1) FROM  " + Tables.ARTICLES);
                id = ids[0];

                SQLClass.Insert("INSERT INTO " + Tables.ARTICLES +
                                "(Header, Text, Author, Picture, Artic_ID, Category, new)" +
                                " VALUES ('" + textBox_Name.Text + "'," +
                                "'" + textBox_txtStat.Text + "'," +
                                "'" + avtor1 + "'," +
                                "'" + textBox_ssulka.Text + "'," +
                                "" + id + "," +
                                "'" + comboBox_kategorii.Text + "'," +
                                " 1)");
                SQLClass.Update("UPDATE " + Tables.AUTHORS +
                                " SET Articles = Articles + 1 WHERE UserName = '******'");

                ne_povtor = textBox_Name.Text;
            }
        }
Пример #11
0
        private void ArticleClick(object sender, EventArgs e)
        {
            foreach (LinkLabel lab in arts)
            {
                if (sender.Equals(lab))
                {
                    List <String> ArticleInfo = SQLClass.Select(
                        "SELECT Header, Author, Category, Text, Picture FROM " + Tables.ARTICLES +
                        " WHERE header = '" + lab.Text + "'");

                    for (int artIndex = 0; artIndex < ArticleInfo.Count; artIndex += 5)
                    {
                        Statiya stat = new Statiya();
                        stat.ArticleName = ArticleInfo[artIndex].ToString();
                        stat.AuthorName  = ArticleInfo[artIndex + 1].ToString();
                        stat.Category    = ArticleInfo[artIndex + 2].ToString();
                        stat.Text        = ArticleInfo[artIndex + 3].ToString();

                        //FIXME!!! Show ternarny operator
                        stat.PictureURL = (ArticleInfo[artIndex + 4].ToString() != "") ?
                                          ArticleInfo[artIndex + 4].ToString() :
                                          null;

                        StatiyaForm OknoStatiya = new StatiyaForm(stat, true);
                        OknoStatiya.ShowDialog();
                    }
                }
            }
        }
Пример #12
0
        private void StatiyaForm1_Load(object sender, EventArgs e)
        {
            this.Font      = Configs.USER_FONT;
            this.ForeColor = Configs.USER_COLOR;

            /*
             * List<string> s = Advertising.GetRandom();
             * pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;
             * pictureBox2.LoadAsync(s[0]);
             * pictureBox2.Tag = s[1];
             *
             * s = Advertising.GetRandom();
             * pictureBox3.SizeMode = PictureBoxSizeMode.StretchImage;
             * pictureBox3.LoadAsync(s[0]);
             * pictureBox3.Tag = s[1];
             */

            List <String> countRecords = SQLClass.Select(
                "SELECT COUNT(*) FROM " + Tables.READ_OF_ARTICLES +
                " WHERE `name_of_article` = '" + Maintext.Text + "'");

            label1.Text = "Просмотров: " + countRecords[0];


            SQLClass.Insert(
                "INSERT INTO " + Tables.READ_OF_ARTICLES +
                "(name_of_article, reader, dt)" +
                "VALUES (" +
                "'" + Maintext.Text + "'" +
                ", '" + Users.CURRENT_USER + "'" +
                ", DATE_FORMAT(NOW(), '%Y-%m-%d'))");

            #region Деньги за показанную рекламу
            int money = 2;

            List <String> AuthorExist = SQLClass.Select("SELECT COUNT(*) FROM " + Tables.BALANCE +
                                                        " WHERE AUTHOR = '" + Authortext.Text + "'");

            if (AuthorExist[0] != "0")
            {
                SQLClass.Update(" UPDATE " + Tables.BALANCE +
                                " SET Summa = Summa + " + money.ToString() +
                                " WHERE Author = '" + Authortext.Text + "'");
            }
            else
            {
                SQLClass.Insert(
                    "INSERT INTO " + Tables.BALANCE +
                    " (Summa, Author)" +
                    " VALUES (" +
                    money.ToString() + ", " +
                    "'" + Authortext.Text + "')");
            }
            #endregion
        }
Пример #13
0
        private void dalee_Click(object sender, EventArgs e)
        {
            piccc = new List <PictureBox>();
            pb    = new List <PictureBox>();
            string[] dhfg  = textBox_search.Text.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string   nahod = "";

            /*Dictionary<String, String> dict = new Dictionary<string, string>();
             * for (int i = 0; i < dhfg.Length; i++)
             * {
             *  dict.Add("STR" + i.ToString(), "%" + dhfg[i] + "%");
             *  if (i > 0)
             *  {
             *      nahod += " OR ";
             *  }
             *  nahod += "header like @STR" + i.ToString() +
             *      " OR category like @STR" + i.ToString() +
             *      " OR author like @STR" + i.ToString() +
             *      " OR artic_id IN (SELECT id_art FROM " + Tables.COLLECTION + " WHERE Coll_text like @STR" + i.ToString() + " )";
             *
             * }
             *
             * if (nahod!= "")
             * {
             *  nahod = " AND (" + nahod + ")";
             * }*/

            Dictionary <String, String> dict = new Dictionary <string, string>();

            dict.Add("STR", "%" + textBox_search.Text + "%");

            List <String> PopularArticles = SQLClass.Select
                                                ("SELECT Header, " +
                                                "(SELECT COUNT(*) FROM read_of_articles WHERE Articles1.Header = read_of_articles.name_of_article ) A" +
                                                " FROM " + Tables.ARTICLES + ", " + Tables.LIKES +
                                                " WHERE new = 0 AND  " + Tables.ARTICLES + ".Header = " + Tables.LIKES + ".Article  AND  (header like @STR" +
                                                " OR " + Tables.ARTICLES + ".category like @STR" +
                                                " OR " + Tables.ARTICLES + ".author like @STR)" + GetAuthorSortOrder() + " LIMIT 0, 3", dict);

            int ii = 0;

            foreach (string ArticleName in PopularArticles)
            {
                Centr_panel.Controls.Add(new ArticlePreviewUserControl(new List <string>()
                {
                    ArticleName
                })
                {
                    Location = new Point(0, ii)
                });
                ii += 180;
            }

            kolvo_nazatiy++;
        }
Пример #14
0
        public void update()
        {
            List <String> AuthorBalance = SQLClass.Select("SELECT Summa FROM " + Tables.BALANCE +
                                                          " WHERE `Author` = '" + name + "'");

            if (AuthorBalance.Count > 0)
            {
                label4.Text = AuthorBalance[0].ToString();
            }

            Balance_Author_Load(null, null);
        }
        private void list_of_author_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <String> AuthorData = SQLClass.Select("SELECT * FROM " + Tables.AUTHORS +
                                                       " WHERE UserName = '******'");

            if (AuthorData.Count > 3)
            {
                ViewsCount.Text    = AuthorData[1].ToString();
                LikesCount.Text    = AuthorData[2].ToString();
                DisLikesCount.Text = AuthorData[3].ToString();
                name_stiatii.Text  = list_of_author.Text;
            }
        }
        public void statia()
        {
            List <string> stat = SQLClass.Select("SELECT Header FROM Articles1 WHERE Author = '" + label1.Text + "' LIMIT 5");

            for (int i = 0; i < stat.Count; i++)
            {
                Label labelstat = new Label();
                labelstat.Location = new Point(172, 110 + i * 20);
                labelstat.Size     = new Size(150, 20);
                labelstat.Text     = stat[i].ToString();
                this.Controls.Add(labelstat);
            }
        }
Пример #17
0
        /// <summary>
        /// Добавление информации о блоке в БД
        /// </summary>
        public static void InsertBlockToDB(object sender, UserControl a1, string par)
        {
            Control c = ((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl;

            c.Controls.Add(a1);
            //Program.CONTROLY.Add(a1);
            SQLClass.Insert("INSERT INTO block(form,Parent,x,y,name,Params, Dock) VALUES ('" +
                            c.FindForm().Name + "', '" + c.Name + "', '" + a1.Location.X + "','" + a1.Location.Y + "','" + a1.Name + "','" + par + "', '" + c.Dock + "')");

            List <String> str = SQLClass.Select("SELECT MAX(id) FROM block");

            a1.Tag = str[0];
        }
        private void Add_Statia_Load(object sender, EventArgs e)
        {
            this.Font      = Configs.USER_FONT;
            this.ForeColor = Configs.USER_COLOR;

            comboBox_kategorii.Items.Clear();
            List <String> Categories = SQLClass.Select("SELECT name FROM " + Tables.CATEGORIES);

            foreach (String cat in Categories)
            {
                comboBox_kategorii.Items.Add(cat);
            }
        }
        void LoadPages()
        {
            this.Font      = Configs.USER_FONT;
            this.ForeColor = Configs.USER_COLOR;
            this.Controls.Clear();
            this.Controls.Add(new Label()
            {
                Text     = "Новый",
                Location = new Point(0, 0),
                Size     = new Size(50, 20)
            });
            this.Controls.Add(new Label()
            {
                Text     = "Название",
                Location = new Point(100, 0)
            });

            List <String> articlesList = SQLClass.Select("SELECT header, new FROM " + Tables.ARTICLES);

            int PosY = 20;

            for (int artIndex = 0; artIndex < articlesList.Count; artIndex += 2)
            {
                newPage Page = new newPage();
                Page.Header = articlesList[artIndex];

                Page.CheckBox_          = new CheckBox();
                Page.CheckBox_.Location = new Point(10, PosY);
                Page.CheckBox_.Size     = new Size(50, 30);
                Page.CheckBox_.Click   += new System.EventHandler(cbnewpage);
                Page.CheckBox_.Checked  = (articlesList[artIndex + 1] == "1");


                Page.Label_          = new Label();
                Page.Label_.Location = new Point(100, PosY);
                Page.Label_.Size     = new Size(250, 30);
                Page.Label_.Text     = articlesList[artIndex];

                Page.Label_.Click += new System.EventHandler(Label_Click);
                if (articlesList[artIndex + 1] == "0")
                {
                    Page.Label_.ForeColor = Color.Gray;
                }

                ListOfPages.Add(Page);
                this.Controls.Add(Page.CheckBox_);
                this.Controls.Add(Page.Label_);
                PosY += 30;
            }
        }
        private void Designer_Load(object sender, EventArgs e)
        {
            authorsTextBox.Text  = Configs.KOL_VO_ELEMENTOV_Author.ToString();
            categoryTextBox.Text = Configs.KOL_VO_ELEMENTOV_Categoriya.ToString();
            PodborkatextBox.Text = Configs.KOL_VO_ELEMENTOV_Podborka.ToString();
            reklamatextBox.Text  = Configs.ChR.ToString();


            textBox5.Text = "1";
            try
            {
                textBox5.Text = SQLClass.Select("SELECT var FROM " + Tables.SETTINGS + " WHERE name='mavrodi'")[0];
            }
            catch (Exception) { }
        }
Пример #21
0
        private void dethauthor_Click_1(object sender, EventArgs e)
        {
            List <String> autPics = SQLClass.Select("SELECT UserName FROM " + Tables.AUTHORS + " WHERE Pic != ''");

            Random rnd         = new Random();
            int    v           = rnd.Next(1, autPics.Count);
            String authorLogin = autPics[v - 1];

            if (MessageBox.Show("Ограбить пользователя " + authorLogin + "",
                                "Вопрос",
                                MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                SQLClass.Update("UPDATE " + Tables.BALANCE +
                                " SET Summa = 0 WHERE Author = '" + authorLogin + "'");
            }
        }
Пример #22
0
        private void Hohlov_is_dead_Click(object sender, EventArgs e)
        {
            List <String> autPics = SQLClass.Select("SELECT UserName FROM " + Tables.AUTHORS + " WHERE UserName IN ('Хохлов', 'УКРАIНЕЦ', 'Данил') ");

            Random rnd         = new Random();
            int    v           = rnd.Next(1, autPics.Count);
            String authorLogin = autPics[v - 1];

            if (MessageBox.Show("УБЕЙ САЛОПОТРЕБИТЕЛЯ " + authorLogin + "",
                                "Вопрос",
                                MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                SQLClass.Update("UPDATE " + Tables.BALANCE +
                                " SET Summa = 0 WHERE Author = '" + authorLogin + "'");
            }
        }
Пример #23
0
        public static void GetStata(Label lblLike, Label lblDisLike, String text)
        {
            List <String> likes = SQLClass.Select("SELECT LikesCount, DisCount FROM " + Tables.LIKES +
                                                  " WHERE Article = '" + text + "'");

            if (likes.Count > 1)
            {
                lblLike.Text    = likes[0];
                lblDisLike.Text = likes[1];
            }
            else
            {
                lblLike.Text    = "0";
                lblDisLike.Text = "0";
            }
        }
Пример #24
0
        private void dethArticle_Click(object sender, EventArgs e)
        {
            List <String> stat = SQLClass.Select("SELECT Header FROM " + Tables.ARTICLES);


            Random rnd        = new Random();
            int    v          = rnd.Next(1, stat.Count);
            String authorstat = stat[v - 1];

            if (MessageBox.Show("Уничтожить статью  " + authorstat + "",
                                "Вопрос",
                                MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                SQLClass.Delete("DELETE FROM " + Tables.READ_OF_ARTICLES + " WHERE name_of_article = '" + authorstat + "'");
                //SQLClass.Delete("DELETE FROM " + Tables.ARTICLES + " WHERE Header = '" + authorstat + "'");
            }
        }
Пример #25
0
        /// <summary>
        /// Добавляет лейблы из базы
        /// </summary>
        /// <param name="ctr">Списпок контролов куда все вставлять</param>
        /// <param name="limit">Количество категорий</param>
        public static void InitCategoriesLabels(ControlCollection ctr, int limit)
        {
            List <string> Categories = SQLClass.Select("SELECT Name FROM Categories ORDER BY Name LIMIT 0," + limit);

            for (int i = 0; i < Categories.Count; i++)
            {
                Label label = new Label
                {
                    Size     = new Size(100, 30),
                    Location = new Point(0, i * 30 + 30),
                    Text     = Categories[i].ToString()
                };
                label.Click += new EventHandler(lable_cat_Click);

                ctr.Add(label);
            }
        }
        public UserControlAutorsList(List <string> par)
        {
            InitializeComponent();
            asd = par;
            if (asd.Count >= 1)
            {
                authorsList = SQLClass.Select("SELECT `UserName` FROM `Authors` LIMIT 0," + asd[0]);
            }
            //if(asd.Count >= 2)
            if (asd.Count >= 3)
            {
                prog = Convert.ToInt32(asd[2]);
            }

            Menus.AddDeleteMenu(this);
            Drag.AddDNDFunctions(this);
        }
        private void AdvertisingForm_Load(object sender, EventArgs e)
        {
            this.Font      = Configs.USER_FONT;
            this.ForeColor = Configs.USER_COLOR;

            List <String> catsList = SQLClass.Select("SELECT Name FROM " + Tables.CATEGORIES + " LIMIT 0, 7");

            for (int artIndex = 0; artIndex < catsList.Count; artIndex++)
            {
                checkedListBox1.Items.Add(catsList[artIndex].ToString());
            }
            List <String> s = Advertising.GetRandom();

            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox1.LoadAsync(s[0]);
            pictureBox1.Tag = s[1];
        }
        public void Init(List <string> param)
        {
            Drag.AddDNDFunctions(this);
            Menus.AddDeleteMenu(this);

            par = param;
            if (param.Count == 0)
            {
                throw new Exception("Нету параметров");
            }


            List <string> author = SQLClass.Select("SELECT UserName, `Likes`, `Dislikes`, " +
                                                   "`Information_about_author`, `Pic` FROM `Authors` WHERE UserName = '******'");

            if (author.Count == 0)
            {
                author = SQLClass.Select("SELECT UserName, `Likes`, `Dislikes`, " +
                                         "`Information_about_author`, `Pic` FROM `Authors` WHERE UserName = '******'");
            }

            if (author.Count > 3)
            {
                label1.Text = author[0];
                label3.Text = author[1];
                label5.Text = author[2];
                label6.Text = author[3];
            }


            PictureBox b = new PictureBox();

            try
            {
                b.Load(author[4]);
            }
            catch
            {
                b.Image = null;
            }

            pictureBox1.Image    = b.Image;
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            statia();
        }
Пример #29
0
        private void PodborkiUserControl_Load(object sender, EventArgs e)
        {
            Drag.AddDNDFunctions(this);
            List <String> collList = SQLClass.Select("SELECT DISTINCT Coll_text FROM " + Tables.COLLECTION +
                                                     " LIMIT 0, " + Configs.KOL_VO_ELEMENTOV_Podborka);
            int collY = 25;

            for (int colIndex = 0; colIndex < collList.Count; colIndex++)
            {
                Label collLabel = new Label();
                collLabel.Location = new Point(0, collY);
                collLabel.Size     = new Size(100, 20);
                collLabel.Text     = collList[colIndex].ToString();
                collLabel.Click   += new EventHandler(podClick);
                this.Controls.Add(collLabel);
                collY += 28;
            }
        }
        public StastisticsForm(String login, bool admin)
        {
            InitializeComponent();
            adm = admin;
            List <String> AuthorsList = SQLClass.Select("SELECT UserName FROM " + Tables.AUTHORS);

            foreach (String Author in AuthorsList)
            {
                list_of_author.Items.Add(Author);
            }

            list_of_author.Text = login;

            /* if (!adm)
             * {
             *   tabControl1.Visible = true;
             * }*/
        }