Exemple #1
0
        /// <summary>
        /// 比较当前对象和同一类型的另一对象。用于排序。
        /// </summary>
        /// <param name="other">与此对象进行比较的对象。</param>
        /// <returns>一个 32 位有符号整数,指示要比较的对象的相对顺序。</returns>
        public int CompareTo(SysBu other)
        {
            int s = this.Sort.CompareTo(other.Sort);

            if (s == 0)
            {
                return(this.Code.CompareTo(other.Code));
            }
            else
            {
                return(s);
            }
        }
Exemple #2
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);
            }
        }
Exemple #3
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);
            }
        }
Exemple #4
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);
            }
        }
Exemple #5
0
        /// <summary>
        /// 比较当前对象和同一类型的另一对象。用于排序。
        /// </summary>
        /// <param name="obj">与此对象进行比较的对象。</param>
        /// <returns>一个 32 位有符号整数,指示要比较的对象的相对顺序。</returns>
        /// <remarks>也可以添加一个范型实现。</remarks>
        public override int CompareTo(object obj)
        {
            if (obj is SysBu)
            {
                SysBu temp = (SysBu)obj;

                int s = this.Sort.CompareTo(temp.Sort);

                if (s == 0)
                {
                    return(this.Code.CompareTo(temp.Code));
                }
                else
                {
                    return(s);
                }
            }

            throw new ArgumentException("object is not a SysBu");
        }
Exemple #6
0
        /// <summary>
        /// 比较当前对象和同一类型的另一对象。用于排序。
        /// </summary>
        /// <param name="other">与此对象进行比较的对象。</param>
        /// <returns>一个 32 位有符号整数,指示要比较的对象的相对顺序。</returns>
        public int CompareTo(SysBu other)
        {
            int s = this.Sort.CompareTo(other.Sort);

            if (s == 0) return this.Code.CompareTo(other.Code);
            else return s;
        }
Exemple #7
0
 public void Remove(SysBu entry)
 {
     SysBuDa.Delete(entry);
 }
Exemple #8
0
 public void Edit(SysBu entry)
 {
     SysBuDa.Update(entry);
 }
Exemple #9
0
 public void Add(SysBu entry)
 {
     SysBuDa.Insert(entry);
 }