コード例 #1
0
        public TrialStatusInfo WP7TrialStatus(string deviceId)
        {
            WP7Service service = new WP7Service(Session, null, Configuration, PushNotificationService);

            return(service.WP7TrialStatus(deviceId));
        }
コード例 #2
0
        public void WP7ClearCounter(Profile profile)
        {
            WP7Service service = new WP7Service(Session, null, Configuration, PushNotificationService);

            service.WP7ClearCounter(profile);
        }
コード例 #3
0
        public void WP7ClearCounter(string deviceid)
        {
            WP7Service service = new WP7Service(Session, null, Configuration, PushNotificationService);

            service.WP7ClearCounter(deviceid);
        }
コード例 #4
0
        //public ExerciseDTO PublishExercise(Token token, ExerciseDTO exerciseDto)
        //{
        //    var securityInfo = SecurityManager.EnsureAuthentication(token);
        //    Log.WriteWarning("PublishExercise: Username={0},userDto.GlobalId={1}", securityInfo.SessionData.Profile.UserName, exerciseDto.GlobalId);

        //    var session = Session;
        //    using (var tx = session.BeginTransaction())
        //    {
        //        var dbOriginalExercise = session.Get<Exercise>(exerciseDto.GlobalId);
        //        if (dbOriginalExercise.Profile.Id != securityInfo.SessionData.Profile.Id || dbOriginalExercise.Profile.Id != exerciseDto.Profile.Id)
        //        {
        //            throw new CrossProfileOperationException("Cannot  change an exercise for another profile");
        //        }


        //        //we cannot modify published exercise
        //        if (dbOriginalExercise.Status != PublishStatus.Private)
        //        {
        //            throw new PublishedObjectOperationException("Cannot change published or pending exercise");
        //        }
        //        if (!isValidUrl(dbOriginalExercise.Url))
        //        {
        //            throw new ArgumentException("Published exercise must have Url describing this exercise");
        //        }
        //        if (dbOriginalExercise.ExerciseType == ExerciseType.NotSet)
        //        {
        //            throw new ArgumentException("Published exercise must have exercise type set");
        //        }
        //        dbOriginalExercise.PublishDate = Configuration.TimerService.UtcNow;
        //        dbOriginalExercise.Status = PublishStatus.PendingPublish;

        //        session.Update(dbOriginalExercise);
        //        tx.Commit();
        //        return Mapper.Map<Exercise, ExerciseDTO>(dbOriginalExercise);
        //    }

        //}

        //public void ImportData(ImportDataStream data)
        //{
        //    Log.WriteInfo("ImportData");
        //    MemoryStream stream = new MemoryStream();
        //    data.ImageStream.CopyTo(stream);
        //    stream.Seek(0, SeekOrigin.Begin);
        //    Log.WriteVerbose("Preparing deserializing process");
        //    var ttt = new XmlDictionaryReaderQuotas();
        //    ttt.MaxStringContentLength = 10000000;
        //    XmlDictionaryReader reader =
        //        XmlDictionaryReader.CreateTextReader(stream, ttt);

        //    DataContractSerializer ser = new DataContractSerializer(typeof(ImportDataHolder));

        //    // Deserialize the data and read it from the instance.
        //    ImportDataHolder deserializedPerson =
        //        (ImportDataHolder)ser.ReadObject(reader, false);
        //    stream.Dispose();
        //    Log.WriteVerbose("Data has been deserialized");
        //    DataSet ds = null;
        //    if(deserializedPerson.Schema!=null || deserializedPerson.XmlData!=null)
        //    {
        //        Log.WriteVerbose("Creating dataset");
        //        ds = new DataSet();
        //        ds.ReadXmlSchema(new MemoryStream(System.Text.Encoding.Unicode.GetBytes(deserializedPerson.Schema)));
        //        ds.ReadXml(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(deserializedPerson.XmlData)));
        //        Log.WriteVerbose("Dataset has been created");
        //    }
        //    Log.WriteVerbose("Validating profile");
        //    var validator = new ObjectValidator(typeof(ProfileDTO));
        //    var result = validator.Validate(deserializedPerson.Profile);
        //    if (!result.IsValid)
        //    {
        //        throw new ValidationException(result);
        //    }

        //    var session = Session;
        //    using (var transactionScope = new TransactionManager(true))
        //    {
        //        SessionData sessionData = CreateProfile(deserializedPerson.ClientInformation, deserializedPerson.Profile);
        //        if (sessionData == null)
        //        {
        //            throw new InvalidOperationException("Cannot create a profile");
        //        }
        //        if (ds != null)
        //        {//user wants to import the data
        //            Log.WriteVerbose("Retrieving exercises...");
        //            ExerciseSearchCriteria criteria = ExerciseSearchCriteria.CreatePersonalCriteria();
        //            PartialRetrievingInfo info = new PartialRetrievingInfo();
        //            info.PageSize = PartialRetrievingInfo.AllElementsPageSize;
        //            var exercises = GetExercises(sessionData.Token, criteria, info);
        //            Log.WriteVerbose("Start importing the data");
        //            DataImporter importer = new DataImporter(session, sessionData.Profile, exercises.Items);
        //            importer.Import(ds, deserializedPerson.WymiaryId);
        //        }
        //        transactionScope.CommitTransaction();
        //    }

        //}



        #region WP7

        public string WP7Register(string deviceid, string uri, Guid profileId)
        {
            WP7Service service = new WP7Service(Session, null, Configuration, PushNotificationService);

            return(service.WP7Register(deviceid, uri, profileId));
        }