Beispiel #1
0
        /// <summary>
        /// Запрашивает статью из DB и возвращает <see cref="Statiya"/>
        /// </summary>
        /// <param name="ArticleName">Точное название статьи</param>
        /// <returns><see cref="Statiya"/> полученная из DB</returns>
        public static Statiya GetStatiyaFromArticleName(string ArticleName)
        {
            MySqlCommand    cmd = new MySqlCommand("SELECT Header, Author, Category, Text, Picture FROM " + Tables.ARTICLES + " WHERE `Header` = '" + ArticleName + "'", SQLClass.CONN);
            MySqlDataReader rdr = cmd.ExecuteReader();

            rdr.Read();
            Statiya Stat = new Statiya
            {
                ArticleName = rdr[0].ToString(),
                AuthorName  = rdr[1].ToString(),
                Category    = rdr[2].ToString(),
                Text        = rdr[3].ToString()
            };

            if (rdr[4].ToString() != "")
            {
                Stat.PictureURL = rdr[4].ToString();
            }
            else
            {
                Stat.PictureURL = null;
            }
            rdr.Close();

            return(Stat);
        }
        public static void Label3_Click(object sender, EventArgs e)
        {
            Statiya     stat = Statiya.GetStatiyaFromArticleName(((Label)sender).Text);
            StatiyaForm form = new StatiyaForm(stat);

            form.ShowDialog();
        }
Beispiel #3
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();
                    }
                }
            }
        }
        private void label1_MouseEnter(object sender, EventArgs e)
        {
            Statiya stat = Statiya.GetStatiyaFromArticleName(((Label)sender).Text);

            pictureBox1.Visible = true;
            pictureBox1.Load(stat.PictureURL);
            pictureBox1.Size = new Size(100, 100);
        }
        public VipStatiy(Statiya stat)
        {
            InitializeComponent();

            name.Text      = stat.ArticleName;
            kategoriy.Text = stat.Category;
            s           = stat.Text;
            label2.Text = stat.AuthorName;
        }
Beispiel #6
0
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         new StatiyaForm(Statiya.GetStatiyaFromArticleName(Article)).ShowDialog();
     }
     catch
     {
         MessageBox.Show("Такой статьи нет!");
     }
 }
        void Label_Click(object sender, EventArgs e)
        {
            /* foreach (newPage Label_ in ListOfPages)
             * {*/

            Statiya     stat = Statiya.GetStatiyaFromArticleName(((Label)sender).Text);
            StatiyaForm form = new StatiyaForm(stat);

            form.ShowDialog();

            // }
        }
Beispiel #8
0
        private static void label1_MouseEnter(object sender, EventArgs e)
        {
            pictureBox1.Location = new Point(((Label)sender).Location.X + 120, ((Label)sender).Location.Y);
            Statiya stat = Statiya.GetStatiyaFromArticleName(((Label)sender).Text);

            if (!String.IsNullOrEmpty(stat.PictureURL) && stat.PictureURL != null)
            {
                pictureBox1.Visible       = true;
                pictureBox1.ImageLocation = stat.PictureURL;
                pictureBox1.Load();
                pictureBox1.Size = new Size(90, 70);
            }
        }
Beispiel #9
0
        public StatiyaForm(Statiya stat, bool YaAvtor = false)
        {
            InitializeComponent();
            mainTableLayoutPanel.Controls.RemoveByKey("UCref");
            UCFunctions.AddUC(this);

            avtor = YaAvtor;

            Kategoriatext.Enabled = avtor;
            Stattext.Enabled      = avtor;
            redact.Visible        = avtor;

            Head               = stat.ArticleName;
            Maintext.Text      = stat.ArticleName;
            Kategoriatext.Text = stat.Category;
            Stattext.Text      = stat.Text;

            Kategoriatext.Font = Configs.ZAGOLOVOK_FONT;

            Authortext.Font = Configs.ZAGOLOVOK_FONT;

            /*List<String> ids = SQLClass.Select("SELECT MAX(Artic_ID + 1) FROM  " + Tables.ARTICLES);
             * id = ids[0];
             *
             * SQLClass.Insert("INSERT INTO " + Tables.ARTICLES +
             *  "(Header, Category, Author, Text)" +
             *  " VALUES ('" + Maintext.Text + "'," +
             *  "'" + Kategoriatext.Text + "'," +
             *  "'" + Stattext.Text + "',"  +
             *  " 1)");
             * SQLClass.Update("UPDATE " + Tables.AUTHORS + "'");*/



            GetStata(labelLike, labeldis, Maintext.Text);

            try
            {
                pictureBox1.LoadAsync(stat.PictureURL);
            }
            catch (Exception)
            {
                pictureBox1.Image = new Bitmap("defolt_statiy.jpg");
            }
            Authortext.Text = stat.AuthorName;

            pictureBoxLike.Image    = Properties.Resources.like;
            pictureBoxDislike.Image = Properties.Resources.Dislike;
        }
Beispiel #10
0
 private void ArticleClick(object sender, EventArgs e)
 {
     foreach (LinkLabel lab in arts)
     {
         if (sender.Equals(lab))
         {
             Statiya     stat        = Statiya.GetStatiyaFromArticleName(((Label)sender).Text);
             StatiyaForm OknoStatiya = new StatiyaForm(stat);
             OknoStatiya.ShowDialog();
             LAST_SEARCH = textBox_search.Text;
             formloader(sender, e);
             break;
         }
     }
 }
Beispiel #11
0
 private void clik_na_pic(object sender, EventArgs e)
 {
     GC.Collect();
     GC.WaitForPendingFinalizers();
     foreach (PictureBox lab in piccc)
     {
         if (sender.Equals(lab))
         {
             Statiya stat = Statiya.GetStatiyaFromArticleName(lab.Tag.ToString());
             //StatiyaForm OknoStatiya = new StatiyaForm(stat);
             VipStatiy OknoStatiya = new VipStatiy(stat);
             OknoStatiya.ShowDialog();
             formloader(sender, e);
             break;
         }
     }
 }