private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e) { SQLClass.Delete("DELETE FROM " + Tables.COLLECTION + " WHERE Coll_Text = '" + comboBox1.Text + "'"); for (int index = 0; index < checkedListBox1.CheckedItems.Count; index++) { String str = checkedListBox1.CheckedItems[index].ToString(); SQLClass.Insert("INSERT INTO " + Tables.COLLECTION + "(Coll_Text, id_art) VALUES ('" + comboBox1.Text + "'," + "(SELECT artic_id FROM " + Tables.ARTICLES + " WHERE `Header` = '" + str + "'))"); } }
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); }
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); } }
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; } }
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); } }
/// <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 button_delete_Click(object sender, EventArgs e) { foreach (categories cat in CategoriesList) { if (sender.Equals(cat.del)) { SQLClass.Delete("DELETE FROM " + Tables.CATEGORIES + " WHERE `Name`= '" + cat.name + "'"); } } update(); }
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; } }
public void proshiy(object sender, EventArgs e) { foreach (Reklama rekl in mn_reklamy) { if (sender.Equals(rekl.proshiyButton)) { SQLClass.Delete("DELETE FROM " + Tables.ADVERTISMENT + " WHERE id = " + rekl.id); Spisok_reklamy_Load(sender, e); break; } } }
public static void UpdateLabelDesignInDb(Control pb) { SQLClass.Delete("DELETE FROM " + Tables.UNIQUE + " WHERE type = 'Label'" + " AND name = '" + pb.Name + "' AND FormFrom = '" + pb.FindForm().Name + "'"); SQLClass.Insert("INSERT INTO " + Tables.UNIQUE + " (type, design, author, name, FormFrom) VALUES " + "('Label', " + "'ForeColor = " + ButtonUniqueForm.ColorToJSON(pb.ForeColor) + ", FontName = " + pb.Font.Name + ", FontSize = " + pb.Font.Size + ", Text = " + pb.Text + "', 'admin', '" + pb.Name + "', '" + pb.FindForm().Name + "')"); }
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; } } }
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) { } }
/// <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); }
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 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"; } }
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 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]; }
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 + "'"); } }
/// <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); } }
/// <summary> /// Обновление дизайна конкретной кнопки в БД /// </summary> public static void UpdateButtonDesignInDb(Button pb) { SQLClass.Delete("DELETE FROM " + Tables.UNIQUE + " WHERE type = 'Button'" + " AND name = '" + pb.Name + "' AND FormFrom = '" + pb.FindForm().Name + "'"); SQLClass.Insert("INSERT INTO " + Tables.UNIQUE + " (type, design, author, name, FormFrom) VALUES " + "('Button', " + "'Color = " + ColorToJSON(pb.BackColor) + ", Visible = " + pb.Visible + ", BackgroundImage = " + pb.BackgroundImage + ", Text = " + pb.Text + ", Dock = " + pb.Dock.ToString() + ", FlatStyle = " + pb.FlatStyle + "', 'admin', '" + pb.Name + "', '" + pb.FindForm().Name + "')"); }
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); }
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(); }
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; * }*/ }
/*public ArticlePreviewUserControl(List <string> paramet) * { * InitializeComponent(); * like = Convert.ToInt32(paramet[2]); * dislike = Convert.ToInt32(paramet[3]); * URL_ = paramet[0]; * * pictureBox1.LoadAsync(URL_); * linkLabel1.Text = paramet[1]; * LikeCount.Text = like.ToString(); * DisLikeCount.Text = dislike.ToString(); * DisLikePB.Image = Properties.Resources.dislike; * LikePB.Image = Properties.Resources.like; * * * }*/ public ArticlePreviewUserControl(List <string> Articles) { InitializeComponent(); Drag.AddDNDFunctions(this); Menus.AddDeleteMenu(this); GC.Collect(2); if (Articles.Count == 0) { return; } Article = Articles[0]; asd = Articles; List <String> url_pic = SQLClass.Select(string.Format("SELECT `Picture` FROM `Articles1` WHERE `Header`='{0}'", Article)); if (url_pic.Count == 1) { try { pictureBox1.Load(url_pic[0]); } catch { pictureBox1.Image = null; } } List <string> likes_dislikes = SQLClass.Select(string.Format("SELECT `LikesCount`, `DisCount` FROM `Likes` WHERE `Article`='{0}'", Article)); if (likes_dislikes.Count == 2) { like = Int32.Parse(likes_dislikes[0]); dislike = Int32.Parse(likes_dislikes[1]); } linkLabel1.Text = Article; LikeCount.Text = like.ToString(); DisLikeCount.Text = dislike.ToString(); }
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(); }
public ArticleDetailsUserControl(List <string> Articles) { InitializeComponent(); Menus.AddDeleteMenu(this); Drag.AddDNDFunctions(this); ListOfArticles = Articles; int x = 356; int y = 376; try { x = Convert.ToInt32(Articles[1]); y = Convert.ToInt32(Articles[2]); } catch (ArgumentOutOfRangeException) { // Используем тандартный размер } this.Size = new Size(x, y); List <string> result = SQLClass.Select("SELECT Author, Category, Text, Picture FROM " + "Articles1" + " WHERE `Header` = '" + Articles[0] + "'"); if (result.Count > 3) { AuthorsNameLabel.Text = result[0]; ArticleLabel.Text = Articles[0]; ArticleTextLabel.Text = result[2]; } try { ArticlePicture.Load(result[3]); } catch { ArticlePicture.Image = null; } }
public static Dictionary <string, JObject> typeSerialize() { Dictionary <string, JObject> AllTypesData = new Dictionary <string, JObject>(); #region Button Dictionary <string, string> ButtonData = new Dictionary <string, string>(); if (DesignClass.BUTTON_BACKGROUND_IMG_ADRESS != null) { ButtonData.Add("BackgroundImage", DesignClass.BUTTON_BACKGROUND_IMG_ADRESS.ToString()); } //ButtonData.Add("BackgroundImageLayout", button1.BackgroundImageLayout.ToString()); if (DesignClass.BUTTON_TEXT_COLOR != null) { ButtonData.Add("ForeColor", ButtonUniqueForm.ColorToJSON(DesignClass.BUTTON_TEXT_COLOR));//DesignClass.BUTTON_TEXT_COLOR.ToString()); } if (DesignClass.BUTTON_FONT != null) { ButtonData.Add("Font", DesignClass.BUTTON_FONT.ToString()); } if (DesignClass.BUTTON_COLOR != null) { ButtonData.Add("Color", ButtonUniqueForm.ColorToJSON(DesignClass.BUTTON_COLOR));//.ToString()); } ButtonData.Add("ImageAlign", DesignClass.BUTTONIMAGE_ALLINE.ToString()); //.ToString()); ButtonData.Add("FlatStyle", Convert.ToString(DesignClass.FLAT_OF_BUTTON)); //.ToString()); #endregion AllTypesData.Add("button", JObject.FromObject(ButtonData)); foreach (string type in AllTypesData.Keys) { SQLClass.Delete("DELETE FROM " + Tables.DEFAULT + " WHERE type = '" + type + "'"); SQLClass.Insert(String.Format("INSERT INTO " + Tables.DEFAULT + "(type, design, author) VALUES ('{0}','{1}','{2}')", type, AllTypesData[type].ToString(), "test")); } return(AllTypesData); }