Beispiel #1
0
        public static void Delete(QiRootCause2 entry)
        {
            Database db = DatabaseFactory.CreateDatabase();

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

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch (System.Data.SqlClient.SqlException sex)      // 只捕获SqlException,其余抛出继续传播
            {
                DBHelper.ParseSqlException(sex, true);
            }
        }
Beispiel #2
0
        public static void Insert(QiRootCause2 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.RootCause1,
                DataDictionaryEntryDa.GetDictionaryTableName(DictionaryName.QiRootCause2)));

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

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

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