/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2015/10/19 10:49:54</remarks> public bool Update(DicEquipmentEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_DicEquipment_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name); database.AddInParameter(commandWrapper, "@SuitType", DbType.Int32, entity.SuitType); database.AddInParameter(commandWrapper, "@SuitId", DbType.Int32, entity.SuitId); database.AddInParameter(commandWrapper, "@Quality", DbType.Int32, entity.Quality); database.AddInParameter(commandWrapper, "@PropertyType1", DbType.Int32, entity.PropertyType1); database.AddInParameter(commandWrapper, "@PropertyType2", DbType.Int32, entity.PropertyType2); 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)); }
/// <summary> /// 将IDataReader的当前记录读取到DicEquipmentEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public DicEquipmentEntity LoadSingleRow(IDataReader reader) { var obj = new DicEquipmentEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.Name = (System.String)reader["Name"]; obj.SuitType = (System.Int32)reader["SuitType"]; obj.SuitId = (System.Int32)reader["SuitId"]; obj.Quality = (System.Int32)reader["Quality"]; obj.PropertyType1 = (System.Int32)reader["PropertyType1"]; obj.PropertyType2 = (System.Int32)reader["PropertyType2"]; obj.Description = (System.String)reader["Description"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>DicEquipmentEntity</returns> /// <remarks>2015/10/19 10:49:54</remarks> public DicEquipmentEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_DicEquipment_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); DicEquipmentEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
/// <summary> /// Update /// </summary> /// <param name="entity"></param> /// <returns></returns> /// <remarks>2015/10/19 10:49:54</remarks> public bool Update(DicEquipmentEntity entity) { return(Update(entity, null)); }
/// <summary> /// Insert /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2015/10/19 10:49:54</remarks> public bool Insert(DicEquipmentEntity entity) { return(Insert(entity, null)); }
public static bool Update(DicEquipmentEntity dicEquipmentEntity, DbTransaction trans = null, string zoneId = "") { var provider = new DicEquipmentProvider(zoneId); return(provider.Update(dicEquipmentEntity, trans)); }
static EquipmentDescriptionEntity BuildEquipmentDescription(DicItemEntity itemEntity, DicEquipmentEntity equipmentEntity) { var entity = new EquipmentDescriptionEntity(); entity.ItemCode = itemEntity.ItemCode; entity.ItemType = itemEntity.ItemType; entity.Name = itemEntity.ItemName; entity.ImageId = itemEntity.ImageId; entity.Quality = equipmentEntity.Quality; entity.SuitId = equipmentEntity.SuitId; entity.SuitType = equipmentEntity.SuitType; entity.Idx = equipmentEntity.Idx; entity.Property1 = equipmentEntity.PropertyType1; entity.Property2 = equipmentEntity.PropertyType2; if (equipmentEntity.SuitType == 4) { #region 处理散装前缀 string s = equipmentEntity.Name.Substring(0, 2); switch (s) { case "迅捷": entity.Prefix = 1; break; case "灵感": entity.Prefix = 2; break; case "精准": entity.Prefix = 3; break; case "专制": entity.Prefix = 4; break; case "活力": entity.Prefix = 5; break; case "旋风": entity.Prefix = 6; break; case "狂热": entity.Prefix = 7; break; case "尘暴": entity.Prefix = 8; break; case "犀利": entity.Prefix = 9; break; case "驭风": entity.Prefix = 10; break; case "弧光": entity.Prefix = 11; break; case "灵动": entity.Prefix = 12; break; case "反射": entity.Prefix = 13; break; case "空间": entity.Prefix = 14; break; case "触感": entity.Prefix = 15; break; } #endregion #region 处理散装后缀 var ss = equipmentEntity.Name.Substring(2); switch (ss) { case "战靴": entity.ImageId = 1; break; case "护目镜": entity.ImageId = 2; break; case "护踝": entity.ImageId = 3; break; case "护臂": entity.ImageId = 4; break; case "护腿板": entity.ImageId = 5; break; case "耳环": entity.ImageId = 6; break; case "头带": entity.ImageId = 7; break; case "护腕": entity.ImageId = 8; break; case "护膝": entity.ImageId = 9; break; case "护袜": entity.ImageId = 10; break; case "手镯": entity.ImageId = 11; break; case "戒指": entity.ImageId = 12; break; case "指贴": entity.ImageId = 13; break; case "球帽": entity.ImageId = 14; break; case "手套": entity.ImageId = 15; break; } #endregion } return(entity); }