Ejemplo n.º 1
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2017/1/10 17:36:20</remarks>
        public bool Update(RevelationMyhistoryEntity entity, DbTransaction trans = null)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_RevelationMyhistory_Update");

            database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId);
            database.AddInParameter(commandWrapper, "@GoalsString", DbType.Binary, entity.GoalsString);
            database.AddInParameter(commandWrapper, "@UpdateTime", DbType.DateTime, entity.UpdateTime);
            database.AddInParameter(commandWrapper, "@RowTime", DbType.DateTime, entity.RowTime);


            int results = 0;

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

            entity.ManagerId = (System.Guid)database.GetParameterValue(commandWrapper, "@ManagerId");

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

            obj.ManagerId   = (System.Guid)reader["ManagerId"];
            obj.GoalsString = (System.Byte[])reader["GoalsString"];
            obj.UpdateTime  = (System.DateTime)reader["UpdateTime"];
            obj.RowTime     = (System.DateTime)reader["RowTime"];

            return(obj);
        }
Ejemplo n.º 3
0
        public RevelationHistoryFrame(Guid managerId)
        {
            var history = RevelationMyhistoryMgr.GetById(managerId);

            if (history == null)
            {
                history = new RevelationMyhistoryEntity(managerId, new byte[0], DateTime.Now, DateTime.Now);
                RevelationMyhistoryMgr.Insert(history);
            }
            _historyEntity = history;
            AnalyseFightMap();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="managerId">managerId</param>
        /// <returns>RevelationMyhistoryEntity</returns>
        /// <remarks>2017/1/10 17:36:20</remarks>
        public RevelationMyhistoryEntity GetById(System.Guid managerId)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

            database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, managerId);


            RevelationMyhistoryEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Ejemplo n.º 5
0
        public static bool Update(RevelationMyhistoryEntity revelationMyhistoryEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new RevelationMyhistoryProvider(zoneId);

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