示例#1
0
        public static void Delete(QiAttachCategory entry)
        {
            Database db = DatabaseFactory.CreateDatabase();

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

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

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

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch (System.Data.SqlClient.SqlException sex)      // 只捕获SqlException,其余抛出继续传播
            {
                DBHelper.ParseSqlException(sex, false);
            }
        }
示例#3
0
        public static void Insert(RcMailGroup 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.BU, entry.MailList, entry.Sort, entry.Updator,
                                                                       DataDictionaryEntryDa.GetDictionaryTableName(DictionaryName.RcMailGroup)));

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

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

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch (System.Data.SqlClient.SqlException sex)      // 只捕获SqlException,其余抛出继续传播
            {
                DBHelper.ParseSqlException(sex, false);
            }
        }
示例#5
0
        public static List <QiAttachCategory> GetAll()
        {
            Database db = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"SELECT [Code] ,[Title] ,[Purpose] ,[Sort] ,[Optor] ,[OpTime] ,[Deleted] 
FROM {0}", DataDictionaryEntryDa.GetDictionaryTableName(DictionaryName.QiAttachCategory)));

            List <QiAttachCategory> entries = new List <QiAttachCategory>();

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    entries.Add(PopulateEntry(dataReader));
                }
            }

            return(entries);
        }
示例#6
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);
            }
        }