/// <summary> /// /// </summary> /// <param name="model"></param> public void Add(BrandCategoryRelationModel model) { DbCommand Command = dbw.GetStoredProcCommand("UP_pdBrandCategoryRelation_Add"); dbw.AddInParameter(Command, "@brandid", DbType.Int32, model.BrandID); dbw.AddInParameter(Command, "@cateid", DbType.Int32, model.CategoryID); dbw.AddInParameter(Command, "@catepath", DbType.String, model.CategoryPath); dbw.ExecuteNonQuery(Command); }
private void AddRelation(int CateID, int BrandID) { CategoryModel cate = cbll.GetModel(CateID); BrandCategoryRelationModel Relation = new BrandCategoryRelationModel() { BrandID = BrandID, CategoryID = CateID, CategoryPath = cate.CatePath }; rbll.Add(Relation); DataTable sonCates=cbll.GetList(" parentid="+CateID).Tables[0]; if(sonCates.Rows.Count>0) { foreach (DataRow row in sonCates.Rows) AddRelation(Convert.ToInt32(row["cateid"]), BrandID); } }
/// <summary> /// /// </summary> /// <param name="model"></param> public void Add(BrandCategoryRelationModel model) { dal.Add(model); }