/// <summary> /// 查询该商品的参数信息 /// </summary> /// <param name="commID"></param> /// <returns></returns> public IEnumerable<dynamic> QueryCommodityParameter(string commID) { //DAL WX_CommodityParameterDAL parDal = new WX_CommodityParameterDAL(); IEnumerable<dynamic> list = parDal.Query("CommodityID = @CommodityID Order By iOrder", new { CommodityID = commID }); return list; }
public Tuple<bool, string> CommodityParameterOpe(string commodityID, Dictionary<string, string> dic) { //Init List<string> listSql = new List<string>(); List<object> listPar = new List<object>(); commodityID = string.IsNullOrEmpty(commodityID) ? Guid.NewGuid().ToString("N") : commodityID; List<WX_CommodityParameterInfo> list = new List<WX_CommodityParameterInfo>(); int iIndex = 0; foreach (var item in dic.AsEnumerable()) { iIndex++; list.Add(new WX_CommodityParameterInfo() { CommodityID = commodityID, iOrder = iIndex, Text = item.Key, Value = item.Value }); } //DAL WX_CommodityParameterDAL parDal = new WX_CommodityParameterDAL(); //1.先删除 if (list.Count() > 0) { listSql.Add(parDal.DeleteSQL("CommodityID = @CommodityID")); listPar.Add(new { CommodityID = commodityID }); } //2.再添加 foreach (var item in list) { listSql.Add(parDal.AddSQL()); listPar.Add(item); } bool result = parDal.ExecuteTran(listSql, listPar); string strMsg = result ? commodityID : "操作失败!"; return new Tuple<bool, string>(result, strMsg); }