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

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@Formation", DbType.AnsiString, entity.Formation);
            database.AddInParameter(commandWrapper, "@Name", DbType.AnsiString, entity.Name);
            database.AddInParameter(commandWrapper, "@BuffPerLevel", DbType.Decimal, entity.BuffPerLevel);
            database.AddInParameter(commandWrapper, "@Description", DbType.String, entity.Description);


            int results = 0;

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


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

            obj.Idx          = (System.Int32)reader["Idx"];
            obj.Formation    = (System.String)reader["Formation"];
            obj.Name         = (System.String)reader["Name"];
            obj.BuffPerLevel = (System.Decimal)reader["BuffPerLevel"];
            obj.Description  = (System.String)reader["Description"];

            return(obj);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>DicFormationEntity</returns>
        /// <remarks>2015/10/19 10:50:36</remarks>
        public DicFormationEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            DicFormationEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2015/10/19 10:50:36</remarks>
 public bool Update(DicFormationEntity entity)
 {
     return(Update(entity, null));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2015/10/19 10:50:36</remarks>
 public bool Insert(DicFormationEntity entity)
 {
     return(Insert(entity, null));
 }
Ejemplo n.º 6
0
        public static bool Update(DicFormationEntity dicFormationEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new DicFormationProvider(zoneId);

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