Exemplo n.º 1
0
        public static void Delete(SysBu entry)
        {
            Database db = DatabaseFactory.CreateDatabase();

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

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch (System.Data.SqlClient.SqlException sex)      // 只捕获SqlException,其余抛出继续传播
            {
                DBHelper.ParseSqlException(sex, true);
            }
        }
Exemplo n.º 2
0
        public static void Insert(SysBu entry)
        {
            Database db = DatabaseFactory.CreateDatabase();

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

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch (System.Data.SqlClient.SqlException sex)      // 只捕获SqlException,其余抛出继续传播
            {
                DBHelper.ParseSqlException(sex, false);
            }
        }
Exemplo n.º 3
0
        public static void Update(SysBu entry)
        {
            Database db = DatabaseFactory.CreateDatabase();

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

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