/// <summary>
 /// Удаление дизайна конкретной кнопки из БД (возврат в дефолтное состояние)
 /// </summary>
 public static void DeleteUniqueButton(Control pb, String formName, String buttonName)
 {
     SQLClass.Delete("DELETE FROM " + Tables.UNIQUE +
                     " WHERE type = 'Button'" +
                     " AND name = '" + buttonName +
                     "' AND FormFrom = '" + formName + "'");
 }
        /// <summary>
        /// Функция удаления юзерконтрола из формы и базы.
        /// </summary>
        public static void DeleteUserControl(object sender, EventArgs e)
        {
            UserControl pb = (UserControl)((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl;

            pb.Visible = false;
            SQLClass.Delete("DELETE FROM `block` WHERE id = " + pb.Tag);
        }
        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 + "'))");
            }
        }
        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();
        }
        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;
                }
            }
        }
示例#6
0
 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 + "')");
 }
示例#7
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 + "'");
            }
        }
 /// <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 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);
        }
 private void button2_Click(object sender, EventArgs e)
 {
     SQLClass.Delete("DELETE FROM " + Tables.COLLECTION + " WHERE Coll_Text = '" + comboBox1.Text + "'");
 }