Ejemplo n.º 1
0
 public ActivityPrizeConfigInfo GetActivityPrizeConfig(int activityId)
 {
     using (var manage = new UserIntegralManager())
     {
         ActivityPrizeConfig entity = manage.GetActivityPrizeConfig(activityId);
         if (entity != null)
         {
             ActivityPrizeConfigInfo info = new ActivityPrizeConfigInfo();
             ObjectConvert.ConverEntityToInfo(entity, ref info);
             return(info);
         }
         return(null);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 保存礼品配置
 /// </summary>
 public void SaveOrUpdateActivityPrizeConfig(ActivityPrizeConfigInfo info, string opeType)
 {
     using (var manage = new UserIntegralManager())
     {
         ActivityPrizeConfig entity = new ActivityPrizeConfig();
         if (opeType.ToLower() == "add")
         {
             if (info != null)
             {
                 entity.ActivityTitle   = info.ActivityTitle;
                 entity.ActivityContent = info.ActivityContent;
                 entity.IsEnabled       = info.IsEnabled;
                 entity.CreatorId       = info.CreatorId;
                 entity.CreateTime      = DateTime.Now;
                 manage.AddActivityPrizeConfig(entity);
             }
             else
             {
                 throw new Exception("修改数据失败!");
             }
         }
         else if (opeType.ToLower() == "update")
         {
             if (info != null)
             {
                 entity = manage.GetActivityPrizeConfig(info.ActivityId);
                 if (entity != null)
                 {
                     entity.ActivityTitle   = info.ActivityTitle;
                     entity.ActivityContent = info.ActivityContent;
                     entity.IsEnabled       = info.IsEnabled;
                     manage.UpdateActivityPrizeConfig(entity);
                 }
                 else
                 {
                     throw new Exception("未查询到数据!");
                 }
             }
             else
             {
                 throw new Exception("修改数据失败!");
             }
         }
     }
 }