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

            if (s == 0)
            {
                return(this.Code.CompareTo(other.Code));
            }
            else
            {
                return(s);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 比较当前对象和同一类型的另一对象。用于排序。
        /// </summary>
        /// <param name="obj">与此对象进行比较的对象。</param>
        /// <returns>一个 32 位有符号整数,指示要比较的对象的相对顺序。</returns>
        /// <remarks>也可以添加一个范型实现。</remarks>
        public override int CompareTo(object obj)
        {
            if (obj is QiAttachCategory)
            {
                QiAttachCategory temp = (QiAttachCategory)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 WarranyEntry");
        }
Exemplo n.º 6
0
 public void Remove(QiAttachCategory entry)
 {
     QiAttachCategoryDa.Delete(entry);
 }
Exemplo n.º 7
0
 public void Edit(QiAttachCategory entry)
 {
     QiAttachCategoryDa.Update(entry);
 }
Exemplo n.º 8
0
 public void Add(QiAttachCategory entry)
 {
     QiAttachCategoryDa.Insert(entry);
 }
Exemplo n.º 9
0
        /// <summary>
        /// 比较当前对象和同一类型的另一对象。用于排序。
        /// </summary>
        /// <param name="other">与此对象进行比较的对象。</param>
        /// <returns>一个 32 位有符号整数,指示要比较的对象的相对顺序。</returns>
        public int CompareTo(QiAttachCategory other)
        {
            int s = this.Sort.CompareTo(other.Sort);

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