예제 #1
0
        // CONTROLS

        public bool  UpdateControl(_CONTROL control)
        {
            if (string.IsNullOrEmpty(mDBName))
            {
                return(false);
            }
            TableM4Controls.Update(control);
            return(true);
        }
예제 #2
0
 public List <_CONTROL> GetControls(string aModule = "", string aFilename = "")
 {
     return(string.IsNullOrEmpty(mDBName) ? null : TableM4Controls.GetControls(aModule, aFilename));
 }
예제 #3
0
 public bool ControlsInsert(_CONTROL aControl)
 {
     return(string.IsNullOrEmpty(mDBName) ? false : TableM4Controls.Insert(aControl) >= 0);
 }
예제 #4
0
 public bool ControlsDelete(string aModule, string aFilename = "")
 {
     TableM4Label.Delete();
     return(string.IsNullOrEmpty(mDBName) || string.IsNullOrEmpty(aModule) ? false : TableM4Controls.Delete(aModule, aFilename) >= 0);
 }
예제 #5
0
 public bool IsControlsEmpty(string aModule, string aFilename = "")
 {
     return(string.IsNullOrEmpty(mDBName) || string.IsNullOrEmpty(aModule) ? true : TableM4Controls.IsEmpty(aModule, aFilename));
 }
예제 #6
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);
        }