예제 #1
0
        public static webObject addCell(Cell aCell)
        {
            FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session);

            ServerSession.ClearSessionBusiness(HttpContext.Current.Session);
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                FanServiceConsumer.AddCell(vFanToken, aCell);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "Cell Added";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aCell;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Addition of Cell unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
예제 #2
0
        public static webObject loadFanSessionCollection(FanSessionCollection aFanSessionCollection)
        {
            FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session);
            FanKey   vFanKey   = ServerSession.GetObject <FanKey>(HttpContext.Current.Session);

            aFanSessionCollection.FanSessionFilter.FssFilter.FanKey = vFanKey.FannKey;
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                FanServiceConsumer.GetFanSessionCollection(vFanToken, aFanSessionCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "FanSessionCollection Loaded";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFanSessionCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Load of FanSessionCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
예제 #3
0
        public static webObject editFriendCollection(FriendCollection aFriendCollection)
        {
            FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session);

            ServerSession.ClearSessionBusiness(HttpContext.Current.Session);
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                FanServiceConsumer.SaveFriend(vFanToken, aFriendCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "FriendCollection Edited";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFriendCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Edit of FriendCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
예제 #4
0
        public static webObject loadExercise(Exercise aExercise)
        {
            FanToken  vFanToken  = ServerSession.GetFanToken(HttpContext.Current.Session);
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                FanServiceConsumer.GetExercise(vFanToken, aExercise);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "Exercise Loaded";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aExercise;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Load of Exercise unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
예제 #5
0
        public static webObject loadActivityCollection(Activity aActivity)
        {
            ActivityCollection vActivityCollection = new ActivityCollection();

            vActivityCollection.ActivityFilter.ActFilter.AssignFromSource(aActivity);

            FanToken  vFanToken  = ServerSession.GetFanToken(HttpContext.Current.Session);
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                FanServiceConsumer.GetActivityCollection(vFanToken, vActivityCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "ActivityCollection Loaded";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = vActivityCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Load of ActivityCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
예제 #6
0
        public static webObject deleteActivity(Activity aActivity)
        {
            FanToken  vFanToken  = ServerSession.GetFanToken(HttpContext.Current.Session);
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                FanServiceConsumer.DeleteActivity(vFanToken, aActivity);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "Activity Deleted";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aActivity;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Deletion of Activity unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
예제 #7
0
        public static webObject editWorkout(Workout aWorkout)
        {
            FanToken  vFanToken  = ServerSession.GetFanToken(HttpContext.Current.Session);
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                FanServiceConsumer.EditWorkout(vFanToken, aWorkout);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "Workout Edited";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aWorkout;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Edit of Workout unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
예제 #8
0
        public static webObject editFan(Fan aFan)
        {
            FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session);
            FanKey   vFanKey   = ServerSession.GetObject <FanKey>(HttpContext.Current.Session);

            aFan.FannKey = vFanKey.FannKey;

            ServerSession.ClearSessionBusiness(HttpContext.Current.Session);
            ServerSession.PutObject <FanKey>(HttpContext.Current.Session, vFanKey); // Review this element of pattern
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);
            try
            {
                FanServiceConsumer.EditFan(vFanToken, aFan);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "Fan Edited";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFan;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Edit of Fan unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
예제 #9
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);
        }
예제 #10
0
        public static TransactionStatus fanLogon(Fan aFan)
        {
            ServerSession.ClearSessionBusiness(HttpContext.Current.Session);
            TransactionStatus vTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                ServerSession.Logon(HttpContext.Current.Session, aFan);
                vTransactionStatus.TransactionResult = TransactionResult.OK;
                vTransactionStatus.Message           = "Login succesful";
                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           = "Login Unsuccesful - please check your username and password are correct" + ex.Message;
                vTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vTransactionStatus);
            }

            return(vTransactionStatus);
        }
예제 #11
0
        //#region GetUser
        ///// <summary>
        ///// Gets the user.
        ///// </summary>
        ///// <param name="aState">An HttpSessionState.</param>
        ///// <returns>User</returns>
        //public static User GetUser(HttpSessionState aHttpSessionState)
        //{
        //    return aHttpSessionState[sessionUser] as User;
        //}
        //#endregion

        #region SetTransactionStatusWithCommonException

        public static void SetTransactionStatusWithCommonException(HttpSessionState aSession, Exception ex)
        {
            TransactionStatus vTransactionStatus = ServerSession.GetTransactionStatus(aSession);

            vTransactionStatus.TransactionResult = TransactionResult.GeneralException;
            vTransactionStatus.Message           = ex.Message;
            vTransactionStatus.InnerMessage      = ex.StackTrace;
            ServerSession.SetTransactionStatus(aSession, vTransactionStatus);
        }
예제 #12
0
        public static webObject editFanFedCollection(FanFedCollection aFanFedCollection)
        {
            FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session);

            ServerSession.ClearSessionBusiness(HttpContext.Current.Session);
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            // ********** TEMPORARY REMEDY UNTIL I SORT OUT DATETIME ISSUE
            foreach (FanFed vCF in aFanFedCollection.FanFedList)
            {
                vCF.FanFedDateJoined = DateTime.Now;
            }

            try
            {
                FanServiceConsumer.SaveFanFed(vFanToken, aFanFedCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "FanFedCollection Edited";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFanFedCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Edit of FanFedCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }