public DataTable GetAllName(AIOSubInfoType subInfoType)
        {
            string table  = AIOConstant.GetTableName(subInfoType);
            string column = AIOConstant.GetColumnName(subInfoType);

            string sql = "SELECT * FROM " + table + " ORDER BY " + column + " ASC";

            return(ExecuteSelect(sql));
        }
        public void UpdateName(string ID, string name, AIOSubInfoType subInfoType)
        {
            string table  = AIOConstant.GetTableName(subInfoType);
            string column = AIOConstant.GetColumnName(subInfoType);

            string       sql = "UPDATE " + table + " SET " + column + " = ? WHERE ID = ?";
            OleDbCommand cmd = CreateSqlWithParam(sql, new string[] { name, ID });

            ExecuteCommand(cmd);
        }
        public void InsertName(string name, AIOSubInfoType subInfoType)
        {
            string table = AIOConstant.GetTableName(subInfoType);

            string       id  = GenerateSubInfoID(subInfoType);
            string       sql = "INSERT INTO " + table + " VALUES(?, ?)";
            OleDbCommand cmd = CreateSqlWithParam(sql, new string[] { id, name });

            ExecuteCommand(cmd);
        }
        public frmSubInfo(AIOSubInfoType type, AIODatabase db)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.subInfoType = type;
            this.aioDb = db;
        }
        public frmSubInfo(AIOSubInfoType type, AIODatabase db)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.subInfoType = type;
            this.aioDb       = db;
        }
        public void DeleteName(string ID, AIOSubInfoType subInfoType)
        {
            string table = AIOConstant.GetTableName(subInfoType);

            string sql = "DELETE FROM " + table + " WHERE ID = '" + ID + "'";

            try
            {
                ExecuteDelete(sql);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
        public string GenerateSubInfoID(AIOSubInfoType subInfoType)
        {
            string table = AIOConstant.GetTableName(subInfoType);

            string       sql = "SELECT MAX(ID) FROM " + table;
            OleDbCommand cmd = new OleDbCommand(sql, cn);
            object       res = cmd.ExecuteScalar();
            int          id;

            if (Convert.IsDBNull(res) == false)
            {
                id = Convert.ToInt32(res);
            }
            else
            {
                id = 0;
            }
            id++;
            return(id.ToString("000000"));
        }
        //SubInfo------------------------------------------------------
        public bool IsDuplicateName(string name, AIOSubInfoType subInfoType)
        {
            string table  = AIOConstant.GetTableName(subInfoType);
            string column = AIOConstant.GetColumnName(subInfoType);

            string sql = "SELECT COUNT(*) FROM " + table + " WHERE " + column + " = ?";

            OleDbCommand cmd = CreateSqlWithParam(sql, new string[] { name });

            cmd.Connection = cn;

            int num = (int)cmd.ExecuteScalar();

            if (num > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#9
0
 public static string GetColumnName(AIOSubInfoType subInfoType)
 {
     return(AIOConstant.ColumnName[(int)subInfoType]);
 }
        public void DeleteName(string ID, AIOSubInfoType subInfoType)
        {
            string table = AIOConstant.GetTableName(subInfoType);

            string sql = "DELETE FROM " + table + " WHERE ID = '" + ID + "'";

            try
            {
                ExecuteDelete(sql);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
示例#11
0
 public static string GetTableName(AIOSubInfoType subInfoType)
 {
     return(AIOConstant.TableName[(int)subInfoType]);
 }
        //SubInfo------------------------------------------------------
        public bool IsDuplicateName(string name, AIOSubInfoType subInfoType)
        {
            string table = AIOConstant.GetTableName(subInfoType);
            string column = AIOConstant.GetColumnName(subInfoType);

            string sql = "SELECT COUNT(*) FROM " + table + " WHERE " + column + " = ?";

            OleDbCommand cmd = CreateSqlWithParam(sql, new string[] {name});
            cmd.Connection = cn;

            int num = (int)cmd.ExecuteScalar();
            if (num > 0) return true;
            else return false;
        }
        public void UpdateName(string ID, string name, AIOSubInfoType subInfoType)
        {
            string table = AIOConstant.GetTableName(subInfoType);
            string column = AIOConstant.GetColumnName(subInfoType);

            string sql = "UPDATE " + table + " SET " + column + " = ? WHERE ID = ?";
            OleDbCommand cmd = CreateSqlWithParam(sql, new string[] {name, ID});

            ExecuteCommand(cmd);
        }
        public void InsertName(string name, AIOSubInfoType subInfoType)
        {
            string table = AIOConstant.GetTableName(subInfoType);

            string id = GenerateSubInfoID(subInfoType);
            string sql = "INSERT INTO " + table + " VALUES(?, ?)";
            OleDbCommand cmd = CreateSqlWithParam(sql, new string[] {id, name});

            ExecuteCommand(cmd);
        }
        public DataTable GetAllName(AIOSubInfoType subInfoType)
        {
            string table = AIOConstant.GetTableName(subInfoType);
            string column = AIOConstant.GetColumnName(subInfoType);

            string sql = "SELECT * FROM " + table + " ORDER BY " + column + " ASC";

            return ExecuteSelect(sql);
        }
        public string GenerateSubInfoID(AIOSubInfoType subInfoType)
        {
            string table = AIOConstant.GetTableName(subInfoType);

            string sql = "SELECT MAX(ID) FROM " + table;
            OleDbCommand cmd = new OleDbCommand(sql, cn);
            object res = cmd.ExecuteScalar();
            int id;
            if (Convert.IsDBNull(res) == false)
                id = Convert.ToInt32(res);
            else id = 0;
            id++;
            return id.ToString("000000");
        }
 public static string GetColumnName(AIOSubInfoType subInfoType)
 {
     return AIOConstant.ColumnName[(int)subInfoType];
 }
 public static string GetTableName(AIOSubInfoType subInfoType)
 {
     return AIOConstant.TableName[(int)subInfoType];
 }