public static void Delete(QiRootCause3 entry) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"DELETE FROM {1} WHERE [Code] = N'{0}'", entry.Code, DataDictionaryEntryDa.GetDictionaryTableName(DictionaryName.QiRootCause3))); try { db.ExecuteNonQuery(dbCommand); } catch (System.Data.SqlClient.SqlException sex) // 只捕获SqlException,其余抛出继续传播 { DBHelper.ParseSqlException(sex, true); } }
public static void Insert(QiRootCause3 entry) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"INSERT INTO {5} VALUES (N'{0}', N'{1}', {2}, '{3}', GETDATE(), 0, '{4}')", entry.Code, entry.Title, entry.Sort, entry.Updator, entry.RootCause2, DataDictionaryEntryDa.GetDictionaryTableName(DictionaryName.QiRootCause3))); try { db.ExecuteNonQuery(dbCommand); } catch (System.Data.SqlClient.SqlException sex) // 只捕获SqlException,其余抛出继续传播 { DBHelper.ParseSqlException(sex, false); } }
public static void Update(QiRootCause3 entry) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"UPDATE {6} SET [Title] = '{1}' ,[Sort] = {2} ,[Optor] = '{3}',[OpTime] = GETDATE(), [Deleted] = {4}, [Cause2] = '{5}' WHERE [Code] = N'{0}'", entry.Code, entry.TitleT, entry.SortT, entry.UpdatorT, entry.VisibleT ? 0 : 1, entry.PCodeT, DataDictionaryEntryDa.GetDictionaryTableName(DictionaryName.QiRootCause3))); try { db.ExecuteNonQuery(dbCommand); } catch (System.Data.SqlClient.SqlException sex) // 只捕获SqlException,其余抛出继续传播 { DBHelper.ParseSqlException(sex, false); } }
public void Remove(QiRootCause3 entry) { QiRootCause3Da.Delete(entry); }
public void Edit(QiRootCause3 entry) { QiRootCause3Da.Update(entry); }
public void Add(QiRootCause3 entry) { QiRootCause3Da.Insert(entry); }