예제 #1
0
        /// <summary>
        /// Сохранение дизайна формы в БД
        /// </summary>
        public static void UpdateFormDesignInDb(Form f, String fName)
        {
            String icon = "Masons";

            if (f.Icon == Properties.Resources.Face)
            {
                icon = "Face";
            }
            else if (f.Icon == Properties.Resources.Atom)
            {
                icon = "Atom";
            }

            SQLClass.Delete("DELETE FROM " + Tables.Unique +
                            " WHERE FormFrom = '" + fName + "' and type = 'Form'");
            SQLClass.Insert("INSERT INTO " + Tables.Unique +
                            " (type, design, FormFrom, Author, Name)" +
                            " VALUES ('Form', " +
                            "'Color: " + Convert.ToString(f.BackColor) + "," +
                            "MaxWidth: " + f.MaximumSize.Width.ToString() + "," +
                            "MaxHeight: " + f.MaximumSize.Height.ToString() + "," +
                            "Icon: " + icon + "," +
                            "MinimizeBox: " + Convert.ToBoolean(f.MinimizeBox) + "'," +
                            "'" + fName + "', '', '')");
        }
예제 #2
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 + "')");
 }
예제 #3
0
        /// <summary>
        /// Обновление дизайна конкретной панели в БД
        /// </summary>
        public static void UpdatePanelDesignInDb(Panel p)
        {
            SQLClass.Delete("DELETE FROM " + Tables.Unique +
                            " WHERE type = 'Panel'" +
                            " AND name = '" + p.Name +
                            "' AND FormFrom = '" + p.FindForm().Name + "'");

            SQLClass.Insert("INSERT INTO " + Tables.Unique +
                            " (type, design, author, name, FormFrom) VALUES " +
                            "('Panel', " +
                            "'Color = " + p.BackColor +
                            ", Visible = " + p.Visible +
                            ", BackgroundImage = " + p.BackgroundImage + "', " +
                            "'admin', '" +
                            p.Name + "', '" +
                            p.FindForm().Name + "')");
        }
예제 #4
0
 /// <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 + "')");
 }
예제 #5
0
        /// <summary>
        /// Сохранение дефолтного дизайна в базу
        /// </summary>
        /// <returns></returns>
        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

            #region Panel
            Dictionary <string, string> PanelData = new Dictionary <string, string>();
            if (DesignClass.PANEL_COLOR != null)
            {
                PanelData.Add("BackColor", ButtonUniqueForm.ColorToJSON(DesignClass.PANEL_COLOR));// DesignClass.PANEL_COLOR.ToString());
            }
            if (DesignClass.PANEL_BACKGROUND_ADDRESS != null)
            {
                PanelData.Add("BackGroundImageAddress", DesignClass.PANEL_BACKGROUND_ADDRESS);
            }
            if (DesignClass.PANEL_TRANSPARENCY != false)
            {
                PanelData.Add("Transparency", "true");
            }
            #endregion

            #region Label
            Dictionary <string, string> labelData = new Dictionary <string, string>();
            if (DesignClass.LABEL_COLOR != null)
            {
                labelData.Add("BackColor", ButtonUniqueForm.ColorToJSON(DesignClass.LABEL_COLOR));//DesignClass.LABEL_COLOR.ToString());
            }
            if (DesignClass.LABEL_TEXT_COLOR != null)
            {
                labelData.Add("ForeColor", ButtonUniqueForm.ColorToJSON(DesignClass.LABEL_TEXT_COLOR));//DesignClass.LABEL_TEXT_COLOR.ToString());
            }
            if (DesignClass.FONT_OF_LABEL != null)
            {
                labelData.Add("FontSize", DesignClass.FONT_OF_LABEL.Size.ToString());
                labelData.Add("FontName", DesignClass.FONT_OF_LABEL.Name);
            }

            if (!DesignClass.LABEL_AUTO_SIZE)
            {
                labelData.Add("TextAlign", DesignClass.LABEL_TEXT_ALIGN.ToString());
            }
            else
            {
                labelData.Add("TextAlign", "null");
            }
            #endregion

            AllTypesData.Add("button", JObject.FromObject(ButtonData));
            AllTypesData.Add("label", JObject.FromObject(labelData));
            AllTypesData.Add("panel", JObject.FromObject(PanelData));

            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);
        }