예제 #1
0
        //public IList<EntryObjectDTO> GetMyTrainingEntries(Token token, MyTrainingDTO myTraining)
        //{
        //    var securityinfo=SecurityManager.EnsureAuthentication(token);
        //    var session = Session;
        //    using (var tx = session.BeginTransaction())
        //    {
        //        MyTraining myTrainingDb = session.Get<MyTraining>(myTraining.GlobalId);
        //        Profile profileDb = session.Load<Profile>(securityinfo.SessionData.Profile.Id);
        //        if (myTrainingDb.Customer!=null && myTrainingDb.Customer.Profile != profileDb)
        //        {
        //            throw new CrossProfileOperationException("This customer doesn't belong to your profile");
        //        }
        //        if (myTrainingDb == null || (myTrainingDb.Profile != profileDb && (myTrainingDb.Profile.Privacy.CalendarView == Privacy.Private || myTrainingDb.Profile.Privacy.CalendarView == Privacy.FriendsOnly && !myTrainingDb.Profile.Friends.Contains(profileDb))))
        //        {
        //            tx.Commit();
        //            return new List<EntryObjectDTO>();
        //        }

        //        return Mapper.Map<ICollection<EntryObject>, EntryObjectDTO[]>(myTrainingDb.EntryObjects);
        //    }
        //}



        //public MapperResult MapExercises(Token token, MapperData data)
        //{
        //    var securityInfo = SecurityManager.EnsureAuthentication(token);
        //    Log.WriteWarning("MapExercises:Username={0}", securityInfo.SessionData.Profile.UserName);
        //    var session = Session;

        //    ExercisesMapper mapper = new ExercisesMapper(session,Configuration.TimerService);
        //    return mapper.Run(securityInfo.SessionData.Profile.Id, data);
        //}


        public void AccountOperation(string userNameOrEmail, AccountOperationType operationType)
        {
            ProfileService profileService = new ProfileService(Session, null, Configuration, SecurityManager, PushNotificationService, EMailService);

            profileService.AccountOperation(userNameOrEmail, operationType);
        }