Example #1
0
        public string GetFieldNamespace(string aTable, string aField)
        {
            if (string.IsNullOrEmpty(mDBName) || string.IsNullOrEmpty(aTable) || string.IsNullOrEmpty(aField))
            {
                return(string.Empty);
            }

            string n = TableM4Fields.GetNamespace(aTable, aField);

            if (!string.IsNullOrEmpty(n))
            {
                return(n);
            }

            string t = string.Empty;
            int    i = 0;

            while (string.IsNullOrEmpty(n) & i < 10)
            {
                t = GetParentTableName(aTable);
                if (string.IsNullOrEmpty(t))
                {
                    return(string.Empty);
                }
                n = TableM4Fields.GetNamespace(t, aField);
                i++;
            }
            return(n);
        }
Example #2
0
 public bool FieldsInsert(string aTable, string aField, string aFieldNamespace)
 {
     return(string.IsNullOrEmpty(mDBName) || string.IsNullOrEmpty(aTable) || string.IsNullOrEmpty(aField) || string.IsNullOrEmpty(aFieldNamespace) ? false : TableM4Fields.Insert(aTable, aField, aFieldNamespace) >= 0);
 }
Example #3
0
        // FIELDS

        public bool IsFieldsEmpty()
        {
            return(string.IsNullOrEmpty(mDBName) ? true : TableM4Fields.IsEmpty());
        }
Example #4
0
 public bool FieldsDelete()
 {
     return(string.IsNullOrEmpty(mDBName) ? false : TableM4Fields.Delete() >= 0);
 }
Example #5
0
        public static bool CreateDB(string dbName)
        {
            bool          result = true;
            SqlCommand    myCommand;
            SqlConnection myConn = new SqlConnection(string.Format("Server={0};Integrated security=True;database=master", System.Environment.MachineName));

            if (!ExistDB())
            {
                string str;

                str = string.Format("CREATE DATABASE {0}", dbName);

                myCommand = new SqlCommand(str, myConn);
                try
                {
                    myConn.Open();
                    myCommand.ExecuteNonQuery();
                }
                catch (SqlException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message, "CREATE DATABASE");
                }
                finally
                {
                    if (myConn.State == ConnectionState.Open)
                    {
                        myConn.Close();
                    }
                }
            }
            conn = new SqlConnection(Connection);
            conn.Open();
            if (!ExistDBTable("Fields"))
            {
                if (TableM4Fields.Create())
                {
                    result = false;
                }
            }
            if (!ExistDBTable("Tables"))
            {
                if (TableM4Tables.Create())
                {
                    result = false;
                }
            }
            if (!ExistDBTable("ControlsClasses"))
            {
                if (TableM4ControlsClasses.Create())
                {
                    result = false;
                }
            }
            if (!ExistDBTable("Controls"))
            {
                if (TableM4Controls.Create())
                {
                    result = false;
                }
            }
            if (!ExistDBTable("Label"))
            {
                if (TableM4Label.Create())
                {
                    result = false;
                }
            }
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
            return(result);
        }