public static int EditTag(StoreTagInfo info) { if (string.IsNullOrEmpty(info.TagName) || string.IsNullOrEmpty(info.TagImgSrc)) { return(0); } StoreTagDao storeTagDao = new StoreTagDao(); if (!storeTagDao.NameValidate(info.TagName, info.TagId)) { return(-1); } return(new StoreTagDao().Update(info, null) ? 1 : 2); }
private static void ProcessTags(List <StoreForPromotion> storeList) { if (storeList.Count != 0) { string storeId = (from t in storeList select t.StoreId.ToString()).Aggregate((string t, string n) => t + "," + n); StoreTagDao storeTagDao = new StoreTagDao(); Dictionary <int, List <StoreTagInfo> > dicTag = storeTagDao.GetMyTags(storeId); storeList.ForEach(delegate(StoreForPromotion r) { if (dicTag.ContainsKey(r.StoreId)) { r.Tags = (from t in dicTag[r.StoreId] select t.TagName).Aggregate((string m, string n) => m + " " + n); } }); } }
public static int AddTag(StoreTagInfo info) { if (string.IsNullOrEmpty(info.TagName) || string.IsNullOrEmpty(info.TagImgSrc)) { return(0); } StoreTagDao storeTagDao = new StoreTagDao(); if (!storeTagDao.NameValidate(info.TagName, info.TagId)) { return(-1); } if (storeTagDao.CountTags() >= 8) { return(-2); } info.DisplaySequence = storeTagDao.GetMaxDisplaySequence <StoreTagInfo>(); return((new StoreTagDao().Add(info, null) > 0) ? 1 : 2); }