Beispiel #1
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2015/10/23 14:51:37</remarks>
        public bool Update(DicGrowEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_DicGrow_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name);
            database.AddInParameter(commandWrapper, "@Stage", DbType.Int32, entity.Stage);
            database.AddInParameter(commandWrapper, "@Reiki", DbType.Int32, entity.Reiki);
            database.AddInParameter(commandWrapper, "@FastReiki", DbType.Int32, entity.FastReiki);
            database.AddInParameter(commandWrapper, "@GrowNum", DbType.Int32, entity.GrowNum);
            database.AddInParameter(commandWrapper, "@BreakRate", DbType.Int32, entity.BreakRate);
            database.AddInParameter(commandWrapper, "@PlusPercent", DbType.Int32, entity.PlusPercent);
            database.AddInParameter(commandWrapper, "@PropertyMax", DbType.Int32, entity.PropertyMax);
            database.AddInParameter(commandWrapper, "@GrowTip", DbType.String, entity.GrowTip);


            int results = 0;

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


            return(Convert.ToBoolean(results));
        }
Beispiel #2
0
        void CalTeammemberGrowData(TeammemberGrowEntity entity)
        {
            if (entity.RecordDate != DateTime.Now.Date)
            {
                entity.RecordDate           = DateTime.Now.Date;
                entity.DayFastGrowCount     = 0;
                entity.DayFreeFastGrowCount = 0;
                entity.DayGrowCount         = 0;
            }
            else
            {
                CalFreeFastGrowData(entity);
            }
            //根据等级获取成长配置数据
            DicGrowEntity dicGrow = CacheFactory.TeammemberCache.GetGrow(entity.GrowLevel);

            if (dicGrow != null)
            {
                entity.BreakGrowNum  = dicGrow.GrowNum;
                entity.BreakRate     = dicGrow.BreakRate;
                entity.GrowCostReiki = dicGrow.Reiki;
                if (entity.FreeFastGrowCount < 1)
                {
                    entity.FastGrowCostReiki = dicGrow.FastReiki;
                }
                else
                {
                    entity.FastGrowCostReiki = 0;
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 将IDataReader的当前记录读取到DicGrowEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public DicGrowEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new DicGrowEntity();

            obj.Idx         = (System.Int32)reader["Idx"];
            obj.Name        = (System.String)reader["Name"];
            obj.Stage       = (System.Int32)reader["Stage"];
            obj.Reiki       = (System.Int32)reader["Reiki"];
            obj.FastReiki   = (System.Int32)reader["FastReiki"];
            obj.GrowNum     = (System.Int32)reader["GrowNum"];
            obj.BreakRate   = (System.Int32)reader["BreakRate"];
            obj.PlusPercent = (System.Int32)reader["PlusPercent"];
            obj.PropertyMax = (System.Int32)reader["PropertyMax"];
            obj.GrowTip     = (System.String)reader["GrowTip"];

            return(obj);
        }
Beispiel #4
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>DicGrowEntity</returns>
        /// <remarks>2015/10/23 14:51:37</remarks>
        public DicGrowEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            DicGrowEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Beispiel #5
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2015/10/23 14:51:37</remarks>
 public bool Update(DicGrowEntity entity)
 {
     return(Update(entity, null));
 }
Beispiel #6
0
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2015/10/23 14:51:37</remarks>
 public bool Insert(DicGrowEntity entity)
 {
     return(Insert(entity, null));
 }
Beispiel #7
0
        public static bool Update(DicGrowEntity dicGrowEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new DicGrowProvider(zoneId);

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