Example #1
0
        /// <summary>
        /// 更新床位状态
        /// </summary>
        /// <param name="intID"></param>
        /// <param name="tran"></param>
        /// <param name="db"></param>
        /// <param name="bedStatus"></param>
        /// <returns></returns>
        public int Update(int intID, DbTransaction tran, Database db, TypeManager.BedStatus bedStatus)
        {
            DbCommand dbCommandWrapper = null;
            string    strUpdateSql     = @"update [TB_Bed] set [Status]=@Status WHERE ID=@ID";

            try
            {
                dbCommandWrapper = db.GetSqlStringCommand(strUpdateSql);
                db.AddInParameter(dbCommandWrapper, "@Status", DbType.Int32, (int)bedStatus);
                db.AddInParameter(dbCommandWrapper, "@ID", DbType.Int32, intID);
                if (tran == null)
                {
                    return(db.ExecuteNonQuery(dbCommandWrapper));
                }
                else
                {
                    return(db.ExecuteNonQuery(dbCommandWrapper, tran));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
Example #2
0
        /// <summary>
        /// 批量更新床位状态
        /// </summary>
        /// <param name="idStr">包含多个床位ID,用逗号分隔</param>
        /// <param name="bedStatus"></param>
        /// <returns></returns>
        public int Update(string idStr, TypeManager.BedStatus bedStatus)
        {
            DbCommand dbCommandWrapper = null;
            string    strUpdateSql     = @"update [TB_Bed] set [Status]=@Status WHERE ID in (" + idStr + ")";

            try
            {
                Database db = DBO.GetInstance();
                dbCommandWrapper = db.GetSqlStringCommand(strUpdateSql);
                db.AddInParameter(dbCommandWrapper, "@Status", DbType.Int32, (int)bedStatus);
                return(db.ExecuteNonQuery(dbCommandWrapper));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }