Пример #1
0
 public void UpdateSiteService(UserSiteServiceInfo info)
 {
     using (var manager = new UserBalanceManager())
     {
         if (info.Id > 0)
         {
             var entity = manager.QueryUserSiteServiceById(info.Id);
             if (entity == null)
             {
                 throw new Exception("您还没有当前服务项");
             }
             entity.IsEnable   = info.IsEnable;
             entity.UpdateTime = DateTime.Now;
             manager.UpdateUserSiteService(entity);
         }
         else
         {
             var entity = new UserSiteService();
             entity.ExtendedOne = info.ExtendedOne;
             entity.ExtendedTwo = info.ExtendedTwo;
             entity.IsEnable    = info.IsEnable;
             entity.Remarks     = entity.Remarks;
             entity.UpdateTime  = DateTime.Now;
             entity.UserId      = info.UserId;
             entity.CreateTime  = DateTime.Now;
             entity.ServiceType = info.ServiceType;
             manager.AddUserSiteService(entity);
         }
     }
 }