Beispiel #1
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/3/11 14:31:44</remarks>
        public bool Update(ActivityexHistoryEntity entity, DbTransaction trans = null)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ActivityexHistory_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId);
            database.AddInParameter(commandWrapper, "@ZoneActivityId", DbType.Int32, entity.ZoneActivityId);
            database.AddInParameter(commandWrapper, "@ExcitingId", DbType.Int32, entity.ExcitingId);
            database.AddInParameter(commandWrapper, "@GroupId", DbType.Int32, entity.GroupId);
            database.AddInParameter(commandWrapper, "@ExData", DbType.Int32, entity.ExData);
            database.AddInParameter(commandWrapper, "@ExStep", DbType.Int32, entity.ExStep);
            database.AddInParameter(commandWrapper, "@ReceiveTimes", DbType.Int32, entity.ReceiveTimes);
            database.AddInParameter(commandWrapper, "@RecordDate", DbType.DateTime, entity.RecordDate);
            database.AddInParameter(commandWrapper, "@Status", DbType.Int32, entity.Status);
            database.AddInParameter(commandWrapper, "@RowTime", DbType.DateTime, entity.RowTime);
            database.AddInParameter(commandWrapper, "@UpdateTime", DbType.DateTime, entity.UpdateTime);


            int results = 0;

            if (trans != null)
            {
                results = database.ExecuteNonQuery(commandWrapper, trans);
            }
            else
            {
                results = database.ExecuteNonQuery(commandWrapper);
            }

            entity.Idx = (System.Int32)database.GetParameterValue(commandWrapper, "@Idx");

            return(Convert.ToBoolean(results));
        }
Beispiel #2
0
        /// <summary>
        /// 将IDataReader的当前记录读取到ActivityexHistoryEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public ActivityexHistoryEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new ActivityexHistoryEntity();

            obj.Idx            = (System.Int32)reader["Idx"];
            obj.ManagerId      = (System.Guid)reader["ManagerId"];
            obj.ZoneActivityId = (System.Int32)reader["ZoneActivityId"];
            obj.ExcitingId     = (System.Int32)reader["ExcitingId"];
            obj.GroupId        = (System.Int32)reader["GroupId"];
            obj.ExData         = (System.Int32)reader["ExData"];
            obj.ExStep         = (System.Int32)reader["ExStep"];
            obj.ReceiveTimes   = (System.Int32)reader["ReceiveTimes"];
            obj.RecordDate     = (System.DateTime)reader["RecordDate"];
            obj.Status         = (System.Int32)reader["Status"];
            obj.RowTime        = (System.DateTime)reader["RowTime"];
            obj.UpdateTime     = (System.DateTime)reader["UpdateTime"];

            return(obj);
        }
Beispiel #3
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ActivityexHistoryEntity</returns>
        /// <remarks>2016/3/11 14:31:44</remarks>
        public ActivityexHistoryEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

            DbCommand commandWrapper = database.GetStoredProcCommand("P_ActivityexHistory_GetById");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx);


            ActivityexHistoryEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
        public static bool Update(ActivityexHistoryEntity activityexHistoryEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ActivityexHistoryProvider(zoneId);

            return(provider.Update(activityexHistoryEntity, trans));
        }