public static void Delete(DataDictionaryEntry entry, DictionaryName dicName)
        {
            Database db = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"DELETE FROM {1} WHERE [Code] = N'{0}'",
                entry.Code, GetDictionaryTableName(dicName)));

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch (System.Data.SqlClient.SqlException sex)      // 只捕获SqlException,其余抛出继续传播
            {
                DBHelper.ParseSqlException(sex, true);
            }
        }
        public static void Update(DataDictionaryEntry entry, DictionaryName dicName)
        {
            Database db = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"UPDATE {5}
            SET [Title] = '{1}' ,[Sort] = {2} ,[Optor] = '{3}',[OpTime] = GETDATE(), [Deleted] = {4}
            WHERE [Code] = N'{0}'", entry.Code, entry.TitleT, entry.SortT, entry.UpdatorT, entry.VisibleT ? 0 : 1,
                GetDictionaryTableName(dicName)));

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch (System.Data.SqlClient.SqlException sex)      // 只捕获SqlException,其余抛出继续传播
            {
                DBHelper.ParseSqlException(sex, false);
            }
        }
        public static void Insert(DataDictionaryEntry entry, DictionaryName dicName)
        {
            Database db = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"INSERT INTO {4} VALUES (N'{0}', N'{1}', {2}, '{3}', GETDATE(), 0)",
                entry.Code, entry.Title, entry.Sort, entry.Updator,
                GetDictionaryTableName(dicName)));

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch (System.Data.SqlClient.SqlException sex)      // 只捕获SqlException,其余抛出继续传播
            {
                DBHelper.ParseSqlException(sex, false);
            }
        }
Beispiel #4
0
 public void Remove(DataDictionaryEntry entry)
 {
     DataDictionaryEntryDa.Delete(entry, this.dicName);
 }
Beispiel #5
0
 public void Edit(DataDictionaryEntry entry)
 {
     DataDictionaryEntryDa.Update(entry, this.dicName);
 }
Beispiel #6
0
 public void Add(DataDictionaryEntry entry)
 {
     DataDictionaryEntryDa.Insert(entry, this.dicName);
 }