public SKUEncodeModel(SKUEncode skuEncode) { this.ID = skuEncode.ID; this.Code = skuEncode.Code; this.Name = skuEncode.Name; this.Att3ID = skuEncode.Att3ID; this.Att4ID = skuEncode.Att4ID; this.Att5ID = skuEncode.Att5ID; this.Att6ID = skuEncode.Att6ID; this.Att7ID = skuEncode.Att7ID; }
public bool AddSKUEncode(SKUEncode encode) { bool result = false; try { int count = _dal.AddSKUEncode(encode); if (count > 0) { result = true; } } catch (Exception e) { string excepMsg = string.Format(@"{0},{1}", DateTime.Now.ToString(), e.Message); Trace.TraceError(excepMsg); throw new Exception("添加SKU编码出错:BLLSKUEncodeManagement.AddSKUEncode(SKUEncode encode)", e); } return result; }
/// <summary> /// 添加属性 /// </summary> /// <param name="cgy"></param> /// <returns></returns> public int AddSKUEncode(SKUEncode encode) { int result = -1; string sql = @"INSERT INTO SKUENCODE (ID, CODE, NAME, ATT3ID, ATT4ID, ATT5ID, ATT6ID, ATT7ID) VALUES(@ID, @CODE, @NAME, @ATT3ID, @ATT4ID, @ATT5ID, @ATT6ID, @ATT7ID)"; using (DbCommand cmd = _database.GetSqlStringCommand(sql)) { _database.AddInParameter(cmd, "@ID", DbType.Guid, encode.ID); _database.AddInParameter(cmd, "@CODE", DbType.String, encode.Code); _database.AddInParameter(cmd, "@NAME", DbType.String, encode.Name); _database.AddInParameter(cmd, "@ATT3ID", DbType.Guid, encode.Att3ID); _database.AddInParameter(cmd, "@ATT4ID", DbType.Guid, encode.Att4ID); _database.AddInParameter(cmd, "@ATT5ID", DbType.Guid, encode.Att5ID); _database.AddInParameter(cmd, "@ATT6ID", DbType.Guid, encode.Att6ID); _database.AddInParameter(cmd, "@ATT7ID", DbType.Guid, encode.Att7ID); result = _database.ExecuteNonQuery(cmd); } return result; }
/// <summary> /// 更新属性名称 /// </summary> /// <param name="att"></param> /// <returns></returns> public int UpdateSKUEncode(SKUEncode encode) { int result = -1; string sql = @"UPDATE SKUENCODE SET NAME = @NAME WHERE ID = @ID"; using (DbCommand cmd = _database.GetSqlStringCommand(sql)) { _database.AddInParameter(cmd, "@NAME", DbType.String, encode.Name); _database.AddInParameter(cmd, "@ID", DbType.Guid, encode.ID); result = _database.ExecuteNonQuery(cmd); } return result; }
public List<SKUEncode> GetSKUEncodeByCondition(SKUSearchParams param) { List<SKUEncode> result = null; try { DataTable dt = _dal.GetSKUEncodeByCondition(param); if (dt != null && dt.Rows.Count > 0) { result = new List<SKUEncode>(); SKUEncode encode; foreach (DataRow dr in dt.Rows) { Guid ID = dr.GetFieldValue<Guid>("ID"); string code = dr.GetFieldValue<string>("CODE"); string name = dr.GetFieldValue<string>("NAME"); Guid ATT3ID = dr.GetFieldValue<Guid>("ATT3ID"); Guid ATT4ID = dr.GetFieldValue<Guid>("ATT4ID"); Guid ATT5ID = dr.GetFieldValue<Guid>("ATT5ID"); Guid ATT6ID = dr.GetFieldValue<Guid>("ATT6ID"); Guid ATT7ID = dr.GetFieldValue<Guid>("ATT7ID"); encode = new SKUEncode(ID) { Code = code, Name = name, Att3ID = ATT3ID, Att4ID = ATT4ID, Att5ID = ATT5ID, Att6ID = ATT6ID, Att7ID = ATT7ID, }; result.Add(encode); } } } catch (Exception e) { string excepMsg = string.Format(@"{0},{1}", DateTime.Now.ToString(), e.Message); Trace.TraceError(excepMsg); throw new Exception("获取SKU编码列表出错:BLLSKUEncodeManagement.GetSKUEncodeByCondition(SKUSearchParams param)", e); } return result; }