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 + "'"); } }
/// <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(); }
/// <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; } }
public void dockClick(object sender, EventArgs e) { String srt = ((ToolStripMenuItem)sender).Text.Replace("Dock.", ""); UserControl uc = (UserControl)((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl; SQLClass.Update("UPDATE block SET" + " Dock = '" + srt + "' WHERE id = '" + uc.Tag + "'"); switch (srt) { case "Top": uc.Dock = DockStyle.Top; break; case "Right": uc.Dock = DockStyle.Right; break; case "Left": uc.Dock = DockStyle.Left; break; case "Fill": uc.Dock = DockStyle.Fill; break; case "Bottom": uc.Dock = DockStyle.Bottom; break; case "None": uc.Dock = DockStyle.None; break; } }
private void button1_Click(object sender, EventArgs e) { if (categoryTextBox.Text == null && reklamatextBox.Text == null && PodborkatextBox.Text == null && authorsTextBox.Text == null && textBox5.Text == null) { this.Close(); } else { try { SQLClass.Update("UPDATE " + Tables.SETTINGS + " SET var = '" + textBox5.Text + "' WHERE name='mavrodi'"); Configs.KOL_VO_ELEMENTOV_Author = Convert.ToInt32(authorsTextBox.Text); Configs.KOL_VO_ELEMENTOV_Categoriya = Convert.ToInt32(categoryTextBox.Text); Configs.KOL_VO_ELEMENTOV_Podborka = Convert.ToInt32(PodborkatextBox.Text); Configs.ChR = Convert.ToInt32(reklamatextBox.Text); } catch { MessageBox.Show("Вводи число!"); } } File.WriteAllText("Temp.txt", "AUTHOR = " + Configs.KOL_VO_ELEMENTOV_Author + Environment.NewLine + "CATEGORIES = " + Configs.KOL_VO_ELEMENTOV_Categoriya + Environment.NewLine + "COLLECTIONS = " + Configs.KOL_VO_ELEMENTOV_Podborka + Environment.NewLine + "CHR = " + Configs.ChR + Environment.NewLine); }
private void redact_Click(object sender, EventArgs e) { SQLClass.Update("UPDATE " + Tables.ARTICLES + " SET Header = '" + Maintext.Text + "'," + " Category = '" + Kategoriatext.Text + "'," + " Text = '" + Stattext.Text + "'" + " WHERE Header = '" + Head + "'"); }
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 }
/// <summary> /// Разблокировка пользователя /// </summary> private void ras_Click(object sender, EventArgs e) { foreach (users i in list_of_users) { if (sender.Equals(i.ras)) { SQLClass.Update("UPDATE " + Tables.POLZOVATELI + " SET ban = 0 WHERE login = '******'"); SQLClass.Update("UPDATE " + Tables.AUTHORS + " SET ban = 0 WHERE UserName = '******'"); } } Users_Load(null, null); }
public void AddOneDay_Click(object sender, EventArgs e) { foreach (Reklama rekl in mn_reklamy) { if (sender.Equals(rekl.AddOneDayButton)) { SQLClass.Update( "UPDATE " + Tables.ADVERTISMENT + " SET Data_to = '" + rekl.date_to.AddDays(1).ToString("dd.MM.yyyy") + "'" + " WHERE id = " + rekl.id); Spisok_reklamy_Load(sender, e); break; } } }
public void prinit(object sender, EventArgs e) { foreach (Reklama rekl in mn_reklamy) { if (sender.Equals(rekl.prinitButton)) { SQLClass.Update( "UPDATE " + Tables.ADVERTISMENT + " SET New = '" + "0" + "'" + " WHERE id = " + rekl.id); Spisok_reklamy_Load(sender, e); break; } } }
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 + "'"); } }
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 + "'"); } }
public void pictureBoxLike_Clicking(object sender, EventArgs e) { if (isDisLike) { pictureBoxDislike_Click(sender, e); } isLike = !isLike; pictureBoxLike.Image = (isLike) ? Properties.Resources.Like2 : Properties.Resources.like; List <String> likes = SQLClass.Select("SELECT Article FROM " + Tables.LIKES + " WHERE Article = '" + Maintext.Text + "'"); if (isLike) { if (likes.Count > 0) { SQLClass.Update("UPDATE " + Tables.LIKES + " SET LikesCount = LikesCount + 1" + " WHERE Article = '" + Maintext.Text + "'"); } else { SQLClass.Insert( "INSERT INTO " + Tables.LIKES + "(Article, Author, Category, LikesCount, DisCount)" + " VALUES (" + "'" + Maintext.Text + "'" + ", '" + Authortext.Text + "'" + ", '" + Kategoriatext.Text + "'" + ",1" + ",0)"); } } else { SQLClass.Update("UPDATE " + Tables.LIKES + " SET LikesCount = LikesCount - 1" + " WHERE Article = '" + Maintext.Text + "'"); } GetStata(labelLike, labeldis, Maintext.Text); }
void cbnewpage(object sender, EventArgs e) { foreach (newPage a in ListOfPages) { if (sender.Equals(a.CheckBox_)) { if (a.Label_.ForeColor == Color.Gray) { SQLClass.Update("UPDATE " + Tables.ARTICLES + " SET `new`= 1 WHERE header = '" + a.Header + "'"); } else { SQLClass.Update("UPDATE " + Tables.ARTICLES + " SET `new`= 0 WHERE header = '" + a.Header + "'"); } } } LoadPages(); }
private void pictureBox1_Click(object sender, EventArgs e) { isLike = !isLike; pictureBox1.Image = (isLike) ? Properties.Resources.Like2 : Properties.Resources.like; List <String> likes = SQLClass.Select("SELECT Article FROM " + Tables.LIKES + " WHERE Article = '" + name.Text + "'"); if (isLike) { if (likes.Count > 0) { SQLClass.Update("UPDATE " + Tables.LIKES + " SET LikesCount = LikesCount + 1" + " WHERE Article = '" + name.Text + "'"); } else { SQLClass.Insert( "INSERT INTO " + Tables.LIKES + "(Article, Author, Category, LikesCount, DisCount)" + " VALUES (" + "'" + name.Text + "'" + ", '" + label2.Text + "'" + ", '" + kategoriy.Text + "'" + ",1" + ",0)"); } } else { SQLClass.Update("UPDATE " + Tables.LIKES + " SET LikesCount = LikesCount - 1" + " WHERE Article = '" + name.Text + "'"); } GetStata(label3, label4, name.Text); }
/// <summary> /// Когда отпускаем мышку, сохраняем координаты ЮзерКонтрола в БД /// </summary> public void FormTest_MouseUp(object sender, MouseEventArgs e) { IsDragging = false; UserControl ActualUC = (UserControl)sender; //if (sender.Equals(ActualUC)) //{ string paramsAsString = ""; switch (ActualUC.GetType().Name) { case "AdsUserControl": AdsUserControl NewPreview = (AdsUserControl)sender; foreach (string pr in NewPreview.ParamsAds) { paramsAsString += pr + ","; } break; case "ArticleDetailsUserControl": ArticleDetailsUserControl NewPreview2 = (ArticleDetailsUserControl)sender; foreach (string pr in NewPreview2.ListOfArticles) { paramsAsString += pr + ","; } break; case "ArticlePreviewUserControl": ArticlePreviewUserControl NewPreview3 = (ArticlePreviewUserControl)sender; foreach (string pr in NewPreview3.asd) { paramsAsString += pr + ","; } break; case "CategoriesUserControl": CategoriesUserControl NewPreview4 = (CategoriesUserControl)sender; foreach (string pr in NewPreview4.asd) { paramsAsString += pr + ","; } break; case "UserControlAutorsList": UserControlAutorsList NewPreview5 = (UserControlAutorsList)sender; foreach (string pr in NewPreview5.asd) { paramsAsString += pr + ","; } break; case "UserControlMainAuthor": UserControlMainAuthor NewPreview6 = (UserControlMainAuthor)sender; foreach (string pr in NewPreview6.par) { paramsAsString += pr + ","; } break; case "UserControlSearch": UserControlSearch NewPreview7 = (UserControlSearch)sender; /*foreach (string pr in NewPreview7.as) * { * param7 += pr + ","; * }*/ break; } SQLClass.Update("UPDATE block SET" + " x = " + ((UserControl)sender).Location.X.ToString() + "," + " y = " + ((UserControl)sender).Location.Y.ToString() + " WHERE id = '" + ActualUC.Tag + "'"); if (paramsAsString.Length > 0) { SQLClass.Update("UPDATE block SET" + " Params = '" + paramsAsString + "' WHERE id = '" + ActualUC.Tag + "'"); } //} }
private void button1_Click(object sender, EventArgs e) { if (!ob) { #region Добавляем пользователя List <String> byl = SQLClass.Select( "SELECT COUNT(*) FROM " + Tables.POLZOVATELI + " WHERE Login='******'"); bool userBylUzhe = (byl[0].ToString() != "0"); if (userBylUzhe) { MessageBox.Show("Ты был уже. Регистрируйся заново"); return; } SQLClass.Insert("INSERT INTO " + Tables.POLZOVATELI + "(`Login`, `Parol`, `ban`, `aboutme`, admin)" + " VALUES ('" + textBox_login.Text + "'," + "'" + textBox_password.Text + "'," + "0" + ",'" + textBox_about_me.Text + "', 0)"); #endregion if (checkBox_I_author.Checked == true) { #region Добавляем автора List <String> isAdminData = SQLClass.Select( "SELECT COUNT(*) FROM " + Tables.AUTHORS + " WHERE `UserName`=\"" + textBox_login.Text + "\""); bool BylUzhe = (isAdminData[0].ToString() != "0"); if (BylUzhe) { MessageBox.Show("Ты был уже. Регистрируйся заново"); return; } SQLClass.Insert("INSERT INTO " + Tables.AUTHORS + "(UserName, Information_about_author, Pic) " + "VALUES ('" + textBox_login.Text + "','" + textBox_about_me.Text + "', '" + textBox_pic + "')"); #endregion } } else { if (infoObAvtore[0] != textBox_login.Text) { List <String> isAdminData = SQLClass.Select( "SELECT COUNT(*) FROM " + Tables.AUTHORS + " WHERE `UserName`=\"" + textBox_login.Text + "\""); bool BylUzhe = (isAdminData[0].ToString() != "0"); if (BylUzhe) { MessageBox.Show("Ты вообще не оригинальный"); return; } isAdminData = SQLClass.Select( "SELECT COUNT(*) FROM " + Tables.AUTHORS + " WHERE `UserName`=\"" + textBox_login.Text + "\""); BylUzhe = (isAdminData[0].ToString() != "0"); if (BylUzhe) { MessageBox.Show("Такой пользователь уже есть"); return; } SQLClass.Update("UPDATE " + Tables.ARTICLES + " SET Author = '" + textBox_login.Text + "' WHERE Author = '" + login + "'"); SQLClass.Update("UPDATE " + Tables.POLZOVATELI + " SET Login = '******' WHERE Login = '******'"); SQLClass.Update("UPDATE " + Tables.BALANCE + " SET Author = '" + textBox_login.Text + "' WHERE Author = '" + login + "'"); SQLClass.Update("UPDATE " + Tables.LIKES + " SET Author = '" + textBox_login.Text + "' WHERE Author = '" + login + "'"); } SQLClass.Update("UPDATE " + Tables.AUTHORS + " SET UserName = '******', Pic = '" + textBox_pic.Text + "', Information_about_author = '" + textBox_about_me.Text + "' WHERE UserName = '******'"); } Close(); }
/// <summary> /// Функция указания текущих параметров перед показом формы UCParameters. /// </summary> public static void SetUCParametersToCurrent(object sender, EventArgs e) { UserControl pb = (UserControl)((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl; List <string> dnonil = new List <string>(); switch (pb.GetType().ToString().Replace("OnlineMag.", "")) { case "AdsUserControl": AdsUserControl pb1 = (AdsUserControl)pb; dnonil.Add(pb1.amount.ToString()); dnonil.Add(pb1.progal.ToString()); break; case "ArticleDetailsUserControl": ArticleDetailsUserControl pb2 = (ArticleDetailsUserControl)pb; dnonil.Add(pb2.ListOfArticles[0]); break; case "ArticlePreviewUserControl": ArticlePreviewUserControl pb3 = (ArticlePreviewUserControl)pb; dnonil.Add(pb3.Article); dnonil.Add("5"); break; case "CategoriesUserControl": CategoriesUserControl pb4 = (CategoriesUserControl)pb; if (pb4.asd.Count >= 2) { dnonil.Add(pb4.asd[0]); dnonil.Add(pb4.asd[1]); } break; case "UserControlAutorsList": UserControlAutorsList pb5 = (UserControlAutorsList)pb; if (pb5.asd.Count >= 3) { dnonil.Add(pb5.asd[0]); dnonil.Add(pb5.asd[1]); dnonil.Add(pb5.asd[2]); } break; case "UserControlMainAuthor": UserControlMainAuthor pb6 = (UserControlMainAuthor)pb; dnonil.AddRange(pb6.par); break; case "UserControlSearch": UserControlSearch pb7 = (UserControlSearch)pb; dnonil.Add(" "); break; case "AuthenticationUserControl": AuthenticationUserControl pb8 = (AuthenticationUserControl)pb; dnonil.Add(""); break; } UCParameters p = new UCParameters(pb.GetType().ToString().Replace("OnlineMag.", ""), dnonil); p.UCSize = pb.Size; p.UCLocation = pb.Location; p.ShowDialog(); pb.Size = p.UCSize; pb.Location = p.UCLocation; if (pb.GetType().ToString().Replace("OnlineMag.", "") == "UserControlMainAuthor") { UserControlMainAuthor pb33 = (UserControlMainAuthor)pb; pb33.par = new List <string>() { p.UserName }; dnonil = pb33.par; pb33.Init(pb33.par); } else if (pb.GetType().ToString().Replace("OnlineMag.", "") == "CategoriesUserControl") { CategoriesUserControl pb2 = (CategoriesUserControl)pb; pb2.asd = p.ParamsList; dnonil = p.ParamsList; CategoriesUserControl.RefreshUC(pb2, Convert.ToInt32(pb2.asd[0])); } else if (pb.GetType().ToString().Replace("OnlineMag.", "") == "UserControlAutorsList") { UserControlAutorsList pb2 = (UserControlAutorsList)pb; pb2.asd.Clear(); pb2.asd = p.ParamsList; pb2.authorsList = SQLClass.Select("SELECT `UserName` FROM `Authors` LIMIT 0," + p.Amount); pb2.UserControlAutorsList_Load(null, null); if (pb2.asd[2] == "") { pb2.asd[2] = "0"; } dnonil = pb2.asd; } else if (pb.GetType().ToString().Replace("OnlineMag.", "") == "ArticlePreviewUserControl") { ArticlePreviewUserControl pb2 = (ArticlePreviewUserControl)pb; pb2.Article = p.ParamsList[0]; pb2.linkLabel1.Text = pb2.Article; pb2.asd = p.ParamsList; dnonil = pb2.asd; try { List <string> kart = SQLClass.Select("SELECT `Picture` FROM `Articles1` WHERE `Header` = '" + pb2.Article + "'"); pb2.pictureBox1.Load(kart[0]); List <string> likes = SQLClass.Select("SELECT `LikesCount`, `DisCount` FROM `Likes` WHERE `Article` = '" + pb2.Article + "'"); pb2.LikeCount.Text = likes[0]; pb2.DisLikeCount.Text = likes[1]; pb2.like = Convert.ToInt32(likes[0]); pb2.dislike = Convert.ToInt32(likes[1]); } catch { pb2.pictureBox1.Image = null; } } else if (pb.GetType().ToString().Replace("OnlineMag.", "") == "ArticleDetailsUserControl") { ArticleDetailsUserControl pb2 = (ArticleDetailsUserControl)pb; pb2.ListOfArticles.Clear(); pb2.ListOfArticles = p.ParamsList; pb2.ArticleLabel.Text = p.ParamsList[0]; List <string> kart = SQLClass.Select("SELECT Picture, IFNULL(Text,'Ничего'), IFNULL(Author,'Никто') FROM Articles1 WHERE Header = '" + pb2.ArticleLabel.Text + "'"); if (kart.Count > 2) { try { pb2.ArticlePicture.Load(kart[0]); } catch { pb2.ArticlePicture.Image = null; } pb2.ArticleTextLabel.Text = kart[1]; pb2.AuthorsNameLabel.Text = kart[2]; } dnonil = pb2.ListOfArticles; } else if (pb.GetType().ToString().Replace("OnlineMag.", "") == "AdsUserControl") { AdsUserControl pb2 = (AdsUserControl)pb; pb2.ParamsAds = p.ParamsList; pb2.amount = p.Amount; pb2.progal = p.DistanceBetween; pb2.refreshADS(); dnonil = pb2.ParamsAds; } else if (pb.GetType().ToString().Replace("OnlineMag.", "") == "UserControlAutorsList") { UserControlAutorsList pb2 = (UserControlAutorsList)pb; pb2.asd = p.ParamsList; dnonil = p.ParamsList; } #region Сохранение в БД string param3 = ""; foreach (string pr in dnonil) { param3 += pr + ","; } SQLClass.Update("UPDATE block SET" + " Params = '" + param3 + "' WHERE id = '" + pb.Tag + "'"); SQLClass.Update("UPDATE block SET" + " x = " + pb.Location.X.ToString() + "," + " y = " + pb.Location.Y.ToString() + " WHERE id = '" + pb.Tag + "'"); #endregion }