示例#1
0
 /// <summary>
 ///   Delegates the method.
 /// </summary>
 /// <param name="aXmlCredentials">The XMLCredentials <see cref="string"/>.</param>
 /// <param name="aXmlArgument">The XMLArgument <see cref="string"/>.</param>
 /// <returns>
 ///   Concatenated XML <see cref="string"/>.
 /// </returns>
 public static string Invoke(string aXmlCredentials, string aXmlArgument)
 {
     try
     {
         FanToken vFanToken = new FanToken();
         // Deserialize the 1st argument (aXmlCredentials) from an XML string into a UserToken
         vFanToken = XmlUtils.Deserialize<FanToken>(aXmlCredentials);
         // Deserialize the data access file into a Session
         Connection.Instance = FileUtils.Deserialize<Connection>(HttpContext.Current.Server.MapPath("~/bin/zfit.connection.dat"));
         // Invoke the method named in UserToken.Instance.Method, passing a UserKey as the 1st argument and the 2nd argument (aXmlArgument) unchanged
         object[] vArgArray = new object[] { InitializeSession(vFanToken), aXmlArgument };
         var vMethodInfo = typeof(FanImplementation).GetMethod(vFanToken.Method);
         if (vMethodInfo == null)
         {
             throw new Exception(string.Format("Webservice Method not found: \"{0}\".", vFanToken.Method));
         }
         //
         // This is where the method passed in FanToken is actually invoked
         //
         string vXml = (string)vMethodInfo.Invoke(null, vArgArray);
         //
         //
         //
         return XmlUtils.Concatenate(TransactionSuccess(), vXml, "xml");
     }
     catch (ZpAccessException ax)
     {
         return XmlUtils.Concatenate(TransactionAccessException(ax), null, "xml");
     }
     catch (Exception ex)
     {
         return XmlUtils.Concatenate(TransactionException(ex), null, "xml");
     }
 }
示例#2
0
        public static TransactionStatus fanRegister(Fan aFan)
        {
            ServerSession.ClearSessionBusiness(HttpContext.Current.Session);
            TransactionStatus vTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);
            try
            {
                FanToken aFanToken = new FanToken();
                aFanToken.FanID = "Register";
                aFanToken.Password = "******";
                aFanToken.Url = "http://localhost/zfitsoap/zfitService.asmx";
                aFan.FanName = "new";
                aFan.FanSurname = "fanatic";
                FanServiceConsumer.AddFan(aFanToken, aFan);
                vTransactionStatus.TransactionResult = TransactionResult.OK;
                vTransactionStatus.Message = "You have been succesfully registered!";
                vTransactionStatus.TargetUrl = "/fandashboard.aspx";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vTransactionStatus);
            }
            catch (TransactionStatusException tx)
            {
                vTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return vTransactionStatus;
            }
            catch (Exception ex)
            {
                vTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vTransactionStatus.Message = ex.Message;
                vTransactionStatus.InnerMessage = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return vTransactionStatus;
            }

            return vTransactionStatus;
        }
示例#3
0
        //The following body of code is commented out as this is a public system. Once Admin interface is built
        //we will return to a regular broadcast.
        /// <summary>
        /// Initializes the session with the Session token file located 
        /// </summary>
        /// <returns></returns>
        //private static UserKey InitializeSession(UserToken aUserToken)
        //{
        //    var vUserKey = new UserKey();
        //    //The following body of code is commented out as this is a public system. Once PublicInterface is built
        //    //we will return to a regular broadcast.
        //    var vUser = new User() { UsrID = aUserToken.UserID };
        //    UserBusiness.LoadByID(vUserKey, vUser);
        //    if (String.Compare(vUser.UsrPassword, aUserToken.Password, false) != 0)
        //    {
        //        throw new Exception("User Authentication Exception");
        //    }
        //    vUserKey.UsrKey = vUser.UsrKey;
        //    return vUserKey;
        //}
        // ***********************
        // Overload for InitializeSession to accommodate FanKey as opposed to UserKey...
        /// <summary>
        /// Initializes the session with the Session token file located 
        /// </summary>
        /// <returns></returns>
        private static FanKey InitializeSession(FanToken aFanToken)
        {
            var vFanKey = new FanKey();

            var vFan = new Fan() { FanID = aFanToken.FanID };
            FanBusiness.LoadByID(vFanKey, vFan);
            if (String.Compare(vFan.FanPassword, aFanToken.Password, false) != 0)
            {
                throw new Exception("User Authentication Exception");
            }
            vFanKey.FannKey = vFan.FannKey;

            return vFanKey;
        }
示例#4
0
 /// <summary>
 ///   Gets a specified <see cref="FriendCollection"/>.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aFriendCollection"><see cref="Friend"/>Collection object.</param>
 public static void GetFriendCollection(FanToken aFanToken, FriendCollection aFriendCollection)
 {
     FanCallHandler.ServiceCall<FriendCollection>(aFanToken, "GetFriendCollection", aFriendCollection);
 }
示例#5
0
 /// <summary>
 ///   Gets a specified <see cref="RoleCollection"/>.
 /// </summary>
 /// <param name="aRoleCollection"><see cref="Role"/>Collection object.</param>
 /// <param name="aFanToken">A fantoken.</param>
 public static void GetRoleCollection(FanToken aFanToken, RoleCollection aRoleCollection)
 {
     FanCallHandler.ServiceCall<RoleCollection>(aFanToken, "GetRoleCollection", aRoleCollection);
 }
示例#6
0
 /// <summary>
 /// Call the WebService with a request to Add a Workout
 /// </summary>
 /// <param name="aWorkout">The Workout object to Add</param>
 /// <param name="aFantoken">A fantoken.</param>
 public static void AddWorkout(FanToken aFantoken, Workout aWorkout)
 {
     FanCallHandler.ServiceCall<Workout>(aFantoken, "AddWorkout", aWorkout);
 }
示例#7
0
 /// <summary>
 ///   Gets a specified <see cref="CellFed"/> by key.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aCellFed"><see cref="CellFed"/> object.</param>
 public static void GetCellFed(FanToken aFanToken, CellFed aCellFed)
 {
     FanCallHandler.ServiceCall<CellFed>(aFanToken, "GetCellFed", aCellFed);
 }
示例#8
0
 /// <summary>
 /// Add a <see cref="FanWorkout" />.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken" /> object used for Access Control.</param>
 /// <param name="aFanWorkoutCollection">A provider suburb collection.</param>
 public static void SaveFanWorkout(FanToken aFanToken, FanWorkoutCollection aFanWorkoutCollection)
 {
     FanCallHandler.ServiceCall<FanWorkoutCollection>(aFanToken, "SaveFanWorkout", aFanWorkoutCollection);
 }
示例#9
0
 /// <summary>
 /// Call the WebService with a request to Add a Fed
 /// </summary>
 /// <param name="aFed">The Fed object to Add</param>
 /// <param name="aFantoken">A fantoken.</param>
 public static void AddFed(FanToken aFantoken, Fed aFed)
 {
     FanCallHandler.ServiceCall<Fed>(aFantoken, "AddFed", aFed);
 }
示例#10
0
 /// <summary>
 /// Call the WebService with a request to Add a Exercise
 /// </summary>
 /// <param name="aExercise">The Exercise object to Add</param>
 /// <param name="aFantoken">A fantoken.</param>
 public static void AddExercise(FanToken aFantoken, Exercise aExercise)
 {
     FanCallHandler.ServiceCall<Exercise>(aFantoken, "AddExercise", aExercise);
 }
示例#11
0
 /// <summary>
 /// Add a <see cref="FanSessionActivity" />.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken" /> object used for Access Control.</param>
 /// <param name="aFanSessionActivityCollection">A provider suburb collection.</param>
 public static void SaveFanSessionActivity(FanToken aFanToken, FanSessionActivityCollection aFanSessionActivityCollection)
 {
     FanCallHandler.ServiceCall<FanSessionActivityCollection>(aFanToken, "SaveFanSessionActivity", aFanSessionActivityCollection);
 }
示例#12
0
 /// <summary>
 ///   Gets a specified <see cref="FanFed"/> by key.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aFanFed"><see cref="FanFed"/> object.</param>
 public static void GetFanFed(FanToken aFanToken, FanFed aFanFed)
 {
     FanCallHandler.ServiceCall<FanFed>(aFanToken, "GetFanFed", aFanFed);
 }
示例#13
0
 /// <summary>
 /// Get a specific <see cref="FanFunctionAccess"/>.
 /// </summary>
 /// <param name="aFanToken">A fantoken.</param>
 /// <param name="aFanFunctionAccess">The FanFunctionAccess to return</param>
 public static void GetFanFunctionAccessCollection(FanToken aFanToken, FanFunctionAccess aFanFunctionAccess)
 {
     FanCallHandler.ServiceCall<FanFunctionAccess>(aFanToken, "GetFanFunctionAccess", aFanFunctionAccess);
 }
示例#14
0
 /// <summary>
 /// Call the WebService with a request to return a Fan with a specified FanID
 /// </summary>
 /// <param name="aFan">The Fan object to return</param>
 /// <param name="aFanToken">A fantoken.</param>
 public static void GetFanByID(FanToken aFanToken, Fan aFan)
 {
     FanCallHandler.ServiceCall<Fan>(aFanToken, "GetFanByID", aFan);
 }
示例#15
0
 /// <summary>
 /// Gets a FanCollection
 /// </summary>
 /// <param name="aFantoken">A fantoken.</param>
 /// <param name="aExerciseCollection">A user collection.</param>
 public static void GetExerciseCollection(FanToken aFantoken, ExerciseCollection aExerciseCollection)
 {
     FanCallHandler.ServiceCall<ExerciseCollection>(aFantoken, "GetExerciseCollection", aExerciseCollection);
 }
示例#16
0
 /// <summary>
 ///   Gets a specified <see cref="CellFedCollection"/>.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aCellFedCollection"><see cref="CellFed"/>Collection object.</param>
 public static void GetCellFedCollection(FanToken aFanToken, CellFedCollection aCellFedCollection)
 {
     FanCallHandler.ServiceCall<CellFedCollection>(aFanToken, "GetCellFedCollection", aCellFedCollection);
 }
示例#17
0
 /// <summary>
 /// Gets a FanCollection
 /// </summary>
 /// <param name="aFantoken">A fantoken.</param>
 /// <param name="aWorkoutCollection">A user collection.</param>
 public static void GetWorkoutCollection(FanToken aFantoken, WorkoutCollection aWorkoutCollection)
 {
     FanCallHandler.ServiceCall<WorkoutCollection>(aFantoken, "GetWorkoutCollection", aWorkoutCollection);
 }
示例#18
0
 /// <summary>
 ///   Gets a specified <see cref="FanSessionActivity"/> by key.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aFanSessionActivity"><see cref="FanSessionActivity"/> object.</param>
 public static void GetFanSessionActivity(FanToken aFanToken, FanSessionActivity aFanSessionActivity)
 {
     FanCallHandler.ServiceCall<FanSessionActivity>(aFanToken, "GetFanSessionActivity", aFanSessionActivity);
 }
示例#19
0
 /// <summary>
 /// Add a <see cref="CellFed" />.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken" /> object used for Access Control.</param>
 /// <param name="aCellFedCollection">A provider suburb collection.</param>
 public static void SaveCellFed(FanToken aFanToken, CellFedCollection aCellFedCollection)
 {
     FanCallHandler.ServiceCall<CellFedCollection>(aFanToken, "SaveCellFed", aCellFedCollection);
 }
示例#20
0
 /// <summary>
 ///   Gets a specified <see cref="FanSessionCollection"/>.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aFanSessionCollection"><see cref="FanSession"/>Collection object.</param>
 public static void GetFanSessionCollection(FanToken aFanToken, FanSessionCollection aFanSessionCollection)
 {
     FanCallHandler.ServiceCall<FanSessionCollection>(aFanToken, "GetFanSessionCollection", aFanSessionCollection);
 }
示例#21
0
 /// <summary>
 /// Call the WebService with a request to Add a FanSession
 /// </summary>
 /// <param name="aFanSession">The FanSession object to Add</param>
 /// <param name="aFantoken">A fantoken.</param>
 public static void AddFanSession(FanToken aFantoken, FanSession aFanSession)
 {
     FanCallHandler.ServiceCall<FanSession>(aFantoken, "AddFanSession", aFanSession);
 }
示例#22
0
 /// <summary>
 ///   Gets a specified <see cref="FanWorkout"/> by key.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aFanWorkout"><see cref="FanWorkout"/> object.</param>
 public static void GetFanWorkout(FanToken aFanToken, FanWorkout aFanWorkout)
 {
     FanCallHandler.ServiceCall<FanWorkout>(aFanToken, "GetFanWorkout", aFanWorkout);
 }
示例#23
0
 /// <summary>
 /// Add a <see cref="Friend" />.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken" /> object used for Access Control.</param>
 /// <param name="aFriendCollection">A provider suburb collection.</param>
 public static void SaveFriend(FanToken aFanToken, FriendCollection aFriendCollection)
 {
     FanCallHandler.ServiceCall<FriendCollection>(aFanToken, "SaveFriend", aFriendCollection);
 }
示例#24
0
 /// <summary>
 ///   Gets a specified <see cref="CellFan"/> by key.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aCellFan"><see cref="CellFan"/> object.</param>
 public static void GetCellFan(FanToken aFanToken, CellFan aCellFan)
 {
     FanCallHandler.ServiceCall<CellFan>(aFanToken, "GetCellFan", aCellFan);
 }
示例#25
0
 /// <summary>
 ///   Add a <see cref="Role"/>.
 /// </summary>
 /// <param name="aRole"><see cref="Role"/> object.</param>
 /// <param name="aFanToken">A fantoken.</param>
 public static void AddRole(FanToken aFanToken, Role aRole)
 {
     FanCallHandler.ServiceCall<Role>(aFanToken, "AddRole", aRole);
 }
示例#26
0
 /// <summary>
 /// Gets a FanCollection
 /// </summary>
 /// <param name="aFantoken">A fantoken.</param>
 /// <param name="aActivityCollection">A user collection.</param>
 public static void GetActivityCollection(FanToken aFantoken, ActivityCollection aActivityCollection)
 {
     FanCallHandler.ServiceCall<ActivityCollection>(aFantoken, "GetActivityCollection", aActivityCollection);
 }
示例#27
0
 /// <summary>
 ///   Gets a specified <see cref="Friend"/> by key.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aFriend"><see cref="Friend"/> object.</param>
 public static void GetFriend(FanToken aFanToken, Friend aFriend)
 {
     FanCallHandler.ServiceCall<Friend>(aFanToken, "GetFriend", aFriend);
 }
示例#28
0
 /// <summary>
 /// Call the WebService with a request to Add a Fan
 /// </summary>
 /// <param name="aCell">The Cell object to Add</param>
 /// <param name="aFanToken">A Fan token.</param>
 public static void AddCell(FanToken aFanToken, Cell aCell)
 {
     FanCallHandler.ServiceCall<Cell>(aFanToken, "AddCell", aCell);
 }
示例#29
0
 /// <summary>
 /// Call the WebService with a request to Add a Fan
 /// </summary>
 /// <param name="aFan">The Fan object to Add</param>
 /// <param name="aFanToken">A fantoken.</param>
 public static void AddFan(FanToken aFanToken, Fan aFan)
 {
     FanCallHandler.ServiceCall<Fan>(aFanToken, "AddFan", aFan);
 }
示例#30
0
 /// <summary>
 /// Call the WebService with a request to return a Activity with a specified ActivityKey
 /// </summary>
 /// <param name="aActivity">The Activity object to return</param>
 /// <param name="aFantoken">A Fan token.</param>
 public static void GetActivity(FanToken aFantoken, Activity aActivity)
 {
     FanCallHandler.ServiceCall<Activity>(aFantoken, "GetActivity", aActivity);
 }