Ejemplo n.º 1
0
        public static bool IsEmpty(string aModule, string aFilename = "")
        {
            bool e = true;
            List <SqlParameter> paramiters = new List <SqlParameter>();

            if (string.IsNullOrEmpty(aFilename))
            {
                paramiters.Add(new SqlParameter("Module", aModule));

                string query = "SELECT [IDC] FROM [Controls] WHERE [Module] = @Module";

                if (SQLServerManagement.ExecuteReader(query, paramiters) != null)
                {
                    e = !SQLServerManagement.Read();
                }
                SQLServerManagement.ReaderClose();
            }
            else
            {
                paramiters.Add(new SqlParameter("Module", aModule));
                paramiters.Add(new SqlParameter("Filename", aFilename));

                string query = "SELECT [IDC] FROM [Controls] WHERE [Module] = @Module AND [Filename] = @Filename";

                if (SQLServerManagement.ExecuteReader(query, paramiters) != null)
                {
                    e = !SQLServerManagement.Read();
                }
                SQLServerManagement.ReaderClose();
            }
            return(e);
        }
Ejemplo n.º 2
0
        public static int Insert(string IDC)
        {
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("IDC", IDC.Trim()));


            string query = string.Format("INSERT into [Label] ([IDC]) VALUES (@IDC)");

            return(SQLServerManagement.ExecuteNonQuery(query, param));
        }
        public static int Insert(string aParentTable, string aTable)
        {
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("ParentTable", aParentTable.Trim()));
            param.Add(new SqlParameter("Table", aTable.Trim()));

            string query = string.Format("INSERT INTO [Tables] ([ParentTableName], [TableName]) VALUES ( @ParentTable, @Table)");

            return(SQLServerManagement.ExecuteNonQuery(query, param));
        }
Ejemplo n.º 4
0
        public static int Insert(string aControlClass, string aJsonName)
        {
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("ControlClass", aControlClass.Trim()));
            param.Add(new SqlParameter("JsonName", aJsonName.Trim()));

            string query = string.Format("INSERT INTO [ControlsClasses] ([ControlClass], [JsonName]) VALUES ( @ControlClass, @JsonName)");

            return(SQLServerManagement.ExecuteNonQuery(query, param));
        }
        public static int Insert(string aTable, string aField, string aFieldNamespace)
        {
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("Table", aTable.Trim()));
            param.Add(new SqlParameter("Field", aField.Trim()));
            param.Add(new SqlParameter("FieldNamespace", aFieldNamespace.Trim()));

            string query = string.Format("INSERT INTO [Fields] ([TableName], [FieldName], [FieldNamespace]) VALUES ( @Table, @Field, @FieldNamespace)");

            return(SQLServerManagement.ExecuteNonQuery(query, param));
        }
Ejemplo n.º 6
0
        public static List <_CONTROL> GetControls(string aModule = "", string aFilename = "")
        {
            List <_CONTROL>     lc    = new List <_CONTROL>();
            List <SqlParameter> param = new List <SqlParameter>();

            if (string.IsNullOrEmpty(aModule))
            {
                //string query = "SELECT * FROM [Controls] order by [order]";
                string query = "SELECT * FROM [Controls] order by [Filename], [order]";

                if (SQLServerManagement.ExecuteReader(query, null) != null)
                {
                    while (SQLServerManagement.Read())
                    {
                        lc.Add(GetValue());
                    }
                }
                SQLServerManagement.ReaderClose();
            }
            else if (string.IsNullOrEmpty(aFilename))
            {
                param.Add(new SqlParameter("ControlClass", aModule));
                param.Add(new SqlParameter("Filename", aFilename));

                string query = "SELECT * FROM [Controls] WHERE [TableName] = @module";

                if (SQLServerManagement.ExecuteReader(query, param) != null)
                {
                    while (SQLServerManagement.Read())
                    {
                        lc.Add(GetValue());
                    }
                }
                SQLServerManagement.ReaderClose();
            }
            else
            {
                param.Add(new SqlParameter("ControlClass", aModule));
                param.Add(new SqlParameter("Filename", aFilename));

                string query = "SELECT * FROM [Controls] WHERE [TableName] = @ControlClass AND [FieldName] = @Filename";

                if (SQLServerManagement.ExecuteReader(query, param) != null)
                {
                    while (SQLServerManagement.Read())
                    {
                        lc.Add(GetValue());
                    }
                }
                SQLServerManagement.ReaderClose();
            }
            return(lc);
        }
        public static bool IsEmpty()
        {
            bool e = true;

            string query = "SELECT [FieldNamespace] FROM [Fields]";

            if (SQLServerManagement.ExecuteReader(query, null) != null)
            {
                e = !SQLServerManagement.Read();
            }
            SQLServerManagement.ReaderClose();

            return(e);
        }
Ejemplo n.º 8
0
        public static bool IsEmpty()
        {
            bool e = true;

            string query = "SELECT [ControlClass] FROM [ControlsClasses]";

            if (SQLServerManagement.ExecuteReader(query, null) != null)
            {
                e = !SQLServerManagement.Read();
            }
            SQLServerManagement.ReaderClose();

            return(e);
        }
Ejemplo n.º 9
0
        public static int Delete(string aModule, string aFilename = "")
        {
            List <SqlParameter> param = new List <SqlParameter>();

            if (string.IsNullOrEmpty(aFilename))
            {
                param.Add(new SqlParameter("module", aModule.Trim()));
                param.Add(new SqlParameter("filename", aFilename.Trim()));
                string query = "DELETE FROM [Controls] WHERE [Module] = @module";
                return(SQLServerManagement.ExecuteNonQuery(query, param));
            }
            else
            {
                param.Add(new SqlParameter("module", aModule.Trim()));
                param.Add(new SqlParameter("filename", aFilename.Trim()));
                string query = "DELETE FROM [Controls] WHERE [Module] = @module AND [Filename] = @filename";
                return(SQLServerManagement.ExecuteNonQuery(query, param));
            }
        }
Ejemplo n.º 10
0
        public static int Insert(_CONTROL cl)
        {
            List <SqlParameter> param = new List <SqlParameter>();

            #region Assignment
            param.Add(new SqlParameter("module", cl._module.Trim()));
            param.Add(new SqlParameter("idc", cl._idc.Trim()));
            param.Add(new SqlParameter("filename", cl._filename.Trim()));
            param.Add(new SqlParameter("class", cl._class.Trim()));
            param.Add(new SqlParameter("classidd", !string.IsNullOrWhiteSpace(cl._classidd) ? cl._classidd.Trim() : ""));
            param.Add(new SqlParameter("tiletext", !string.IsNullOrWhiteSpace(cl._tiletext) ? cl._tiletext.Trim() : ""));
            param.Add(new SqlParameter("tilesize", !string.IsNullOrWhiteSpace(cl._tilesize) ? cl._tilesize.Trim() : ""));
            param.Add(new SqlParameter("bodyeditidc", !string.IsNullOrWhiteSpace(cl._bodyeditidc) ? cl._bodyeditidc.Trim() : ""));
            param.Add(new SqlParameter("bodyedittext", !string.IsNullOrWhiteSpace(cl._bodyedittext) ? cl._bodyedittext.Trim() : ""));
            param.Add(new SqlParameter("namespace", !string.IsNullOrWhiteSpace(cl._namespace) ? cl._namespace.Trim() : ""));
            param.Add(new SqlParameter("dbtpointer", !string.IsNullOrWhiteSpace(cl._dbtpointer) ? cl._dbtpointer.Trim() : ""));
            param.Add(new SqlParameter("dbtnamespace", !string.IsNullOrWhiteSpace(cl._dbtnamespace) ? cl._dbtnamespace.Trim() : ""));
            param.Add(new SqlParameter("recordpointer", !string.IsNullOrWhiteSpace(cl._recordpointer) ? cl._recordpointer.Trim() : ""));
            param.Add(new SqlParameter("recordclass", !string.IsNullOrWhiteSpace(cl._recordclass) ? cl._recordclass.Trim() : ""));
            param.Add(new SqlParameter("field", !string.IsNullOrWhiteSpace(cl._field) ? cl._field.Trim() : ""));
            param.Add(new SqlParameter("fieldnamespace", !string.IsNullOrWhiteSpace(cl._fieldnamespace) ? cl._fieldnamespace.Trim() : ""));
            param.Add(new SqlParameter("text", !string.IsNullOrWhiteSpace(cl._text) ? cl._text.Trim() : ""));
            param.Add(new SqlParameter("combotype", !string.IsNullOrWhiteSpace(cl._combotype) ? cl._combotype.Trim() : ""));
            param.Add(new SqlParameter("runtimeclass", !string.IsNullOrWhiteSpace(cl._runtimeclass) ? cl._runtimeclass.Trim() : ""));
            param.Add(new SqlParameter("hkl", !string.IsNullOrWhiteSpace(cl._hkl) ? cl._hkl.Trim() : ""));
            param.Add(new SqlParameter("button", !string.IsNullOrWhiteSpace(cl._button) ? cl._button.Trim() : ""));
            param.Add(new SqlParameter("generatejson", cl._generatejson ? 1 : 0));
            param.Add(new SqlParameter("tilestyle", cl._tilestyle));
            param.Add(new SqlParameter("isaddlink", cl._isaddlink ? 1 : 0));
            param.Add(new SqlParameter("order", !string.IsNullOrWhiteSpace(cl._order) ? cl._order.Trim() : ""));
            param.Add(new SqlParameter("hidden", cl._hidden ? 1 : 0));
            param.Add(new SqlParameter("noChange_Grayed", cl._noChange_Grayed ? 1 : 0));
            param.Add(new SqlParameter("grayed", cl._grayed ? 1 : 0));
            param.Add(new SqlParameter("minValue", !string.IsNullOrWhiteSpace(cl._minValue) ? cl._minValue.Trim() : ""));
            param.Add(new SqlParameter("maxValue", !string.IsNullOrWhiteSpace(cl._maxValue) ? cl._maxValue.Trim() : ""));
            param.Add(new SqlParameter("chars", !string.IsNullOrWhiteSpace(cl._chars) ? cl._chars.Trim() : ""));
            param.Add(new SqlParameter("rows", !string.IsNullOrWhiteSpace(cl._rows) ? cl._rows.Trim() : ""));
            #endregion

            System.Diagnostics.Debug.WriteLine("CONTROLS TABLE: " + cl._module + " " + cl._idc + " " + cl._filename + " " + cl._class);
            string query = string.Format(insert);
            return(SQLServerManagement.ExecuteNonQuery(query, param));
        }
Ejemplo n.º 11
0
        public static string GetParentTableName(string aTable)
        {
            string v = string.Empty;
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("@Table", aTable));

            string query = "SELECT [ParentTableName] FROM [Tables] WHERE [TableName] = @Table";

            if (SQLServerManagement.ExecuteReader(query, param) != null)
            {
                while (SQLServerManagement.Read())
                {
                    v = SQLServerManagement.GetValue <string>("ParentTableName");
                }
            }
            SQLServerManagement.ReaderClose();

            return(v);
        }
Ejemplo n.º 12
0
        public static string GetControlJsonName(string aControlClass)
        {
            string v = string.Empty;
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("@ControlClass", aControlClass));

            string query = "SELECT [JsonName] FROM [ControlsClasses] WHERE [ControlClass] = @ControlClass";

            if (SQLServerManagement.ExecuteReader(query, param) != null)
            {
                while (SQLServerManagement.Read())
                {
                    v = SQLServerManagement.GetValue <string>("JsonName");
                }
            }
            SQLServerManagement.ReaderClose();

            return(v);
        }
Ejemplo n.º 13
0
        public static bool exist(string IDC)
        {
            string v = string.Empty;
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("@IDC", IDC));

            string query = "SELECT [IDC] FROM [Label] WHERE [IDC] = @IDC";

            if (SQLServerManagement.ExecuteReader(query, param) != null)
            {
                while (SQLServerManagement.Read())
                {
                    v = SQLServerManagement.GetValue <string>("IDC");
                }
            }
            SQLServerManagement.ReaderClose();

            return(v == IDC);
        }
Ejemplo n.º 14
0
        public static string GetNamespace(string aTable, string aField)
        {
            string v = string.Empty;
            List <SqlParameter> param = new  List <SqlParameter>();

            param.Add(new SqlParameter("Table", aTable));
            param.Add(new SqlParameter("Field", aField));
            string        query = "SELECT [FieldNamespace] FROM [Fields] WHERE [TableName] = @Table AND [FieldName] = @Field";
            SqlDataReader r     = SQLServerManagement.ExecuteReader(query, param);

            if (r != null)
            {
                while (r.Read())
                {
                    v = (string)r["FieldNamespace"];
                }
            }
            SQLServerManagement.ReaderClose();

            return(v);
        }
Ejemplo n.º 15
0
        public static _CONTROL GetValue()
        {
            _CONTROL cl = new _CONTROL();

            cl._module          = SQLServerManagement.GetValue <string>("Module");
            cl._filename        = SQLServerManagement.GetValue <string>("Filename");
            cl._class           = SQLServerManagement.GetValue <string>("Class");
            cl._idc             = SQLServerManagement.GetValue <string>("IDC");
            cl._generatejson    = SQLServerManagement.GetValue <bool>("GenerateJson");
            cl._classidd        = SQLServerManagement.GetValue <string>("ClassIDD");
            cl._tiletext        = SQLServerManagement.GetValue <string>("TileText");
            cl._tilesize        = SQLServerManagement.GetValue <string>("TileSize");
            cl._tilestyle       = SQLServerManagement.GetValue <int>("TileStyle");
            cl._bodyeditidc     = SQLServerManagement.GetValue <string>("BodyEditIDC");
            cl._bodyedittext    = SQLServerManagement.GetValue <string>("BodyEditText");
            cl._namespace       = SQLServerManagement.GetValue <string>("Namespace");
            cl._dbtpointer      = SQLServerManagement.GetValue <string>("DBTPointer");
            cl._dbtnamespace    = SQLServerManagement.GetValue <string>("DBTNamespace");
            cl._recordpointer   = SQLServerManagement.GetValue <string>("RecordPointer");
            cl._recordclass     = SQLServerManagement.GetValue <string>("RecordClass");
            cl._field           = SQLServerManagement.GetValue <string>("Field");
            cl._fieldnamespace  = SQLServerManagement.GetValue <string>("FieldNamespace");
            cl._text            = SQLServerManagement.GetValue <string>("Text");
            cl._combotype       = SQLServerManagement.GetValue <string>("ComboType");
            cl._runtimeclass    = SQLServerManagement.GetValue <string>("RuntimeClass");
            cl._hkl             = SQLServerManagement.GetValue <string>("HotKeyLink");
            cl._button          = SQLServerManagement.GetValue <string>("Button");
            cl._isaddlink       = SQLServerManagement.GetValue <bool>("IsAddLink");
            cl._order           = SQLServerManagement.GetValue <string>("Order");
            cl._hidden          = SQLServerManagement.GetValue <bool>("Hidden");
            cl._noChange_Grayed = SQLServerManagement.GetValue <bool>("NoChange_Grayed");
            cl._grayed          = SQLServerManagement.GetValue <bool>("Grayed");
            cl._minValue        = SQLServerManagement.GetValue <string> ("MinValue");
            cl._maxValue        = SQLServerManagement.GetValue <string> ("MaxValue");
            cl._chars           = SQLServerManagement.GetValue <string>    ("Chars");
            cl._rows            = SQLServerManagement.GetValue <string>     ("Rows");

            return(cl);
        }
Ejemplo n.º 16
0
        public static int Delete()
        {
            string query = "DELETE FROM [ControlsClasses]";

            return(SQLServerManagement.ExecuteNonQuery(query));
        }
Ejemplo n.º 17
0
        public static int Delete()
        {
            string query = "DELETE FROM [Label]";

            return(SQLServerManagement.ExecuteNonQuery(query));
        }
Ejemplo n.º 18
0
 public bool ExistDB()
 {
     return(SQLServerManagement.ExistDB());
 }
Ejemplo n.º 19
0
 public static bool Create()
 {
     return(SQLServerManagement.ExecuteNonQuery(create) >= 0);
 }
Ejemplo n.º 20
0
 public bool Open()
 {
     return(string.IsNullOrEmpty(mDBName) ? false : SQLServerManagement.OpenDB(mDBName));
 }
Ejemplo n.º 21
0
 public bool Delete(bool deleteFild)
 {
     return(SQLServerManagement.ClearDB(deleteFild));
 }
Ejemplo n.º 22
0
 public bool Create()
 {
     return(string.IsNullOrEmpty(mDBName) ? false : SQLServerManagement.CreateDB(mDBName));
 }