public static StoreActivityEntityList GetStoreActivityEntity(int storeId, int productid = 0) { int gradeId = 0; MemberInfo memberInfo = null; if (HiContext.Current != null && HiContext.Current.UserId > 0) { memberInfo = HiContext.Current.User; } if (memberInfo != null) { gradeId = memberInfo.GradeId; } Dictionary <int, List <StoreActivityEntity> > storeActivityEntity = PromoteHelper.GetStoreActivityEntity(storeId.ToString(), gradeId); StoreActivityEntity storeActivityEntity2 = new StoreActivityEntity(); if (storeId == 0) { List <StoreActivityEntity> platformActivityEntity = PromoteHelper.GetPlatformActivityEntity(productid, gradeId); if (platformActivityEntity != null && platformActivityEntity.Count > 0) { if (storeActivityEntity.ContainsKey(0)) { storeActivityEntity[0].AddRange(platformActivityEntity); } else { storeActivityEntity[0] = platformActivityEntity; } } } return(PromoteHelper.ProcessActivity(storeActivityEntity, storeId)); }
public static void EditCountDown(CountDownInfo countDownInfo, IEnumerable <CountDownSkuInfo> countDownSkus) { if (PromoteHelper.ProcessStoreType(countDownInfo)) { StoreActivityHelper.SaveStoreActivity(countDownInfo.StoreIds, countDownInfo.CountDownId, 2); } new CountDownDao().EditCountDown(countDownInfo, countDownSkus); }
public static PromotionInfo GetPromotionByProduct(int productId) { PromotionInfo result = null; int? activeIdByProduct = new PromotionDao().GetActiveIdByProduct(productId); if (activeIdByProduct.HasValue) { result = PromoteHelper.GetPromotion(activeIdByProduct.Value); } return(result); }
public static void AddCountDown(CountDownInfo countDownInfo, IEnumerable <CountDownSkuInfo> countDownSkus) { bool flag = PromoteHelper.ProcessStoreType(countDownInfo); CountDownDao countDownDao = new CountDownDao(); countDownInfo.DisplaySequence = countDownDao.GetMaxDisplaySequence <CountDownInfo>(); int num = new CountDownDao().AddCountDown(countDownInfo, countDownSkus); if (num > 0 & flag) { StoreActivityHelper.SaveStoreActivity(countDownInfo.StoreIds, num, 2); } }
public static CountDownInfo GetCountDownInfo(int countDownId, int storeId = 0) { CountDownInfo countDownInfo = new CountDownDao().Get <CountDownInfo>(countDownId); if (countDownInfo != null) { if (SettingsManager.GetMasterSettings().OpenMultStore) { countDownInfo.IsJoin = StoreActivityHelper.JoinActivity(countDownInfo.CountDownId, 2, storeId, countDownInfo.StoreType); } else { countDownInfo.IsJoin = true; } countDownInfo.CountDownSkuInfo = PromoteHelper.GetCountDownSkus(countDownId, countDownInfo.ProductId, storeId, SettingsManager.GetMasterSettings().OpenMultStore); } return(countDownInfo); }
public static int AddPromotion(PromotionInfo promotion, bool IsMobileExclusive = false) { bool flag = PromoteHelper.ProcessStoreType4PromotionInfo(promotion); Database database = DatabaseFactory.CreateDatabase(); using (DbConnection dbConnection = database.CreateConnection()) { dbConnection.Open(); DbTransaction dbTransaction = dbConnection.BeginTransaction(); try { PromotionDao promotionDao = new PromotionDao(); int num = (int)promotionDao.Add(promotion, null); if (num <= 0) { dbTransaction.Rollback(); return(-1); } if (flag) { StoreActivityHelper.SaveStoreActivity(promotion.StoreIds, num, 1); } if (!IsMobileExclusive && !promotionDao.AddPromotionMemberGrades(num, promotion.MemberGradeIds, dbTransaction)) { dbTransaction.Rollback(); return(-2); } dbTransaction.Commit(); return(num); } catch (Exception) { dbTransaction.Rollback(); return(0); } finally { dbConnection.Close(); } } }