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); } } }
public UserSiteServiceInfo QueryUserSiteServiceById(int Id) { using (var manager = new UserBalanceManager()) { UserSiteServiceInfo info = new UserSiteServiceInfo(); var entity = manager.QueryUserSiteServiceById(Id); if (entity == null) { return(new UserSiteServiceInfo()); } ObjectConvert.ConverEntityToInfo(entity, ref info); return(info); } }