/// <summary> /// Gets a specific access for a user. /// </summary> /// <param name="aFanKey">A user key composite.</param> /// <param name="aFunction">A function.</param> /// <returns></returns> public static Access GetAccess(FanKey aFanKey, string aFunction) { FanFunctionAccess vFanFunctionAccess = new FanFunctionAccess() { FannKey = aFanKey.FannKey }; vFanFunctionAccess.FunctionAccess.Function = aFunction; Load(vFanFunctionAccess); return vFanFunctionAccess.FunctionAccess.Access; }
/// <summary> /// The <c>AddFan</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="Fan"/> object. /// It invokes the <c>Insert</c> method of <see cref="FanBusiness"/> with the newly deserialized <see cref="Fan"/> object. /// Finally, it returns the inserted object (now with an assigned Fan Key) as a serialized <see cref="string"/> of XML. /// </summary> /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param> /// <returns><see cref="Fan"/> as XML <see cref="string"/>.</returns> /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception> public static string AddFan(FanKey aFanKey, string aXmlArgument) { if (aXmlArgument == null) { throw new ArgumentNullException("aXmlArgument of AddFan"); } Fan vFan = new Fan(); vFan = XmlUtils.Deserialize<Fan>(aXmlArgument); FanBusiness.Insert(aFanKey, vFan); return XmlUtils.Serialize<Fan>(vFan, true); }
/// <summary> /// The <c>AddExercise</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="Exercise"/> object. /// It invokes the <c>Insert</c> method of <see cref="ExerciseBusiness"/> with the newly deserialized <see cref="Exercise"/> object. /// Finally, it returns the inserted object (now with an assigned Exercise Key) as a serialized <see cref="string"/> of XML. /// </summary> /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param> /// <returns><see cref="Exercise"/> as XML <see cref="string"/>.</returns> /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception> public static string AddExercise(FanKey aFanKey, string aXmlArgument) { if (aXmlArgument == null) { throw new ArgumentNullException("aXmlArgument of AddExercise"); } Exercise vExercise = new Exercise(); vExercise = XmlUtils.Deserialize<Exercise>(aXmlArgument); ExerciseBusiness.Insert(aFanKey, vExercise); return XmlUtils.Serialize<Exercise>(vExercise, true); }
/// <summary> /// The <c>AddRole</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="Role"/> object. /// It invokes the <c>Insert</c> method of <see cref="RoleBusiness"/> with the newly deserialized <see cref="Role"/> object. /// Finally, it returns the inserted object (now with an assigned Role Key) as a serialized <see cref="string"/> of XML. /// </summary> /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param> /// <returns><see cref="Role"/> as XML <see cref="string"/>.</returns> /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception> public static string AddRole(FanKey aFanKey, string aXmlArgument) { if (aXmlArgument == null) { throw new ArgumentNullException("aXmlArgument of AddRole"); } Role vRole = new Role(); vRole = XmlUtils.Deserialize<Role>(aXmlArgument); RoleBusiness.Insert(aFanKey, vRole); return XmlUtils.Serialize<Role>(vRole, true); }
/// <summary> /// The <c>AddCell</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="Cell"/> object. /// It invokes the <c>Insert</c> method of <see cref="CellBusiness"/> with the newly deserialized <see cref="Cell"/> object. /// Finally, it returns the inserted object (now with an assigned Cell Key) as a serialized <see cref="string"/> of XML. /// </summary> /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param> /// <returns><see cref="Cell"/> as XML <see cref="string"/>.</returns> /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception> public static string AddCell(FanKey aFanKey, string aXmlArgument) { if (aXmlArgument == null) { throw new ArgumentNullException("aXmlArgument of AddCell"); } Cell vCell = new Cell(); vCell = XmlUtils.Deserialize<Cell>(aXmlArgument); CellBusiness.Insert(aFanKey, vCell); return XmlUtils.Serialize<Cell>(vCell, true); }
/// <summary> /// The <c>AddActivity</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="Activity"/> object. /// It invokes the <c>Insert</c> method of <see cref="ActivityBusiness"/> with the newly deserialized <see cref="Activity"/> object. /// Finally, it returns the inserted object (now with an assigned Activity Key) as a serialized <see cref="string"/> of XML. /// </summary> /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param> /// <returns><see cref="Activity"/> as XML <see cref="string"/>.</returns> /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception> public static string AddActivity(FanKey aFanKey, string aXmlArgument) { if (aXmlArgument == null) { throw new ArgumentNullException("aXmlArgument of AddActivity"); } Activity vActivity = new Activity(); vActivity = XmlUtils.Deserialize<Activity>(aXmlArgument); ActivityBusiness.Insert(aFanKey, vActivity); return XmlUtils.Serialize<Activity>(vActivity, true); }
/// <summary> /// Delete a <see cref="Fed"/> object passed as an argument. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aFed">A <see cref="Fed"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aFed</c> argument is <c>null</c>.</exception> public static void Delete(FanKey aFanKey, Fed aFed) { if (aFed == null) { throw new ArgumentNullException("Delete Fed Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Fed", AccessMode.Delete)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FednKey), AccessMode.Delete, "Fed"); //} FedData.Delete(aFed); }
/// <summary> /// Insert a <see cref="FanSession"/> object passed as an argument via Stored Procedure that returns the newly inserted <i>FanSession Key</i>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aFanSession">A <see cref="FanSession"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aFanSession</c> argument is <c>null</c>.</exception> public static void Insert(FanKey aFanKey, FanSession aFanSession) { if (aFanSession == null) { throw new ArgumentNullException("Insert FanSession Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "FanSession", AccessMode.Create)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Create, "FanSession"); //} aFanSession.FanSessionDateDone = DateTime.Now.ToLongDateString(); FanSessionData.Insert(aFanSession); }
/// <summary> /// Delete a <see cref="FanSession"/> object passed as an argument. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aFanSession">A <see cref="FanSession"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aFanSession</c> argument is <c>null</c>.</exception> public static void Delete(FanKey aFanKey, FanSession aFanSession) { if (aFanSession == null) { throw new ArgumentNullException("Delete FanSession Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "FanSession", AccessMode.Delete)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FanSessionnKey), AccessMode.Delete, "FanSession"); //} FanSessionData.Delete(aFanSession); }
/// <summary> /// Save a <see cref="FanFed" /> list passed as an argument. /// </summary> /// <param name="aFanKey">A <see cref="FanKey" /> object.</param> /// <param name="aFanFedCollection">A fan fed collection.</param> /// <exception cref="Zephry.ZpAccessException">Access Denied; FanFed</exception> /// <exception cref="ArgumentNullException">If <c>aFanFed</c> argument is <c>null</c>.</exception> public static void Save(FanKey aFanKey, FanFedCollection aFanFedCollection) { if (aFanFedCollection == null) { throw new ArgumentNullException("Update FanFedCollection Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "FanFed", AccessMode.Update)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Update, "FanFed"); //} FanFedData.Save(aFanFedCollection); }
/// <summary> /// Delete a <see cref="FanRole"/> object passed as an argument. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aFanRole">A <see cref="FanRole"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aFanRole</c> argument is <c>null</c>.</exception> public static void Delete(FanKey aFanKey, FanRole aFanRole) { if (aFanRole == null) { throw new ArgumentNullException("Delete FanRole Business"); } if (!FanFunctionAccessData.HasModeAccess(aFanKey, "FanRole", AccessMode.Delete)) { throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Delete, "FanRole"); } FanRoleData.Delete(aFanRole); }
/// <summary> /// The overloaded Load method that will return a specific <see cref="Exercise"/> object, with keys in <c>aExercise</c>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aExercise">A <see cref="Exercise"/>.</param> /// <exception cref="ArgumentNullException">If <c>aExercise</c> is <c>null</c>.</exception> public static void Load(FanKey aFanKey, Exercise aExercise) { if (aExercise == null) { throw new ArgumentNullException("Load Exercise Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Exercise", AccessMode.Read)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.ExercisenKey), AccessMode.Read, "Exercise"); //} ExerciseData.Load(aExercise); }
/// <summary> /// Insert a <see cref="Exercise"/> object passed as an argument via Stored Procedure that returns the newly inserted <i>Exercise Key</i>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aExercise">A <see cref="Exercise"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aExercise</c> argument is <c>null</c>.</exception> public static void Insert(FanKey aFanKey, Exercise aExercise) { if (aExercise == null) { throw new ArgumentNullException("Insert Exercise Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Exercise", AccessMode.Create)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Create, "Exercise"); //} ExerciseData.Insert(aExercise); }
/// <summary> /// The overloaded Load method that will return a specific <see cref="Activity"/> object, with keys in <c>aActivity</c>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aActivity">A <see cref="Activity"/>.</param> /// <exception cref="ArgumentNullException">If <c>aActivity</c> is <c>null</c>.</exception> public static void Load(FanKey aFanKey, Activity aActivity) { if (aActivity == null) { throw new ArgumentNullException("Load Activity Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Activity", AccessMode.Read)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.ActivitynKey), AccessMode.Read, "Activity"); //} ActivityData.Load(aActivity); }
/// <summary> /// Insert a <see cref="Activity"/> object passed as an argument via Stored Procedure that returns the newly inserted <i>Activity Key</i>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aActivity">A <see cref="Activity"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aActivity</c> argument is <c>null</c>.</exception> public static void Insert(FanKey aFanKey, Activity aActivity) { if (aActivity == null) { throw new ArgumentNullException("Insert Activity Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Activity", AccessMode.Create)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Create, "Activity"); //} ActivityData.Insert(aActivity); }
/// <summary> /// The overloaded Load method that will return a specific <see cref="CellFan"/> object, with keys in <c>aCellFan</c>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aCellFan">A <see cref="CellFan"/>.</param> /// <exception cref="ArgumentNullException">If <c>aCellFan</c> is <c>null</c>.</exception> public static void Load(FanKey aFanKey, CellFan aCellFan) { if (aCellFan == null) { throw new ArgumentNullException("Load CellFan Business"); } if (!FanFunctionAccessData.HasModeAccess(aFanKey, "CellFan", AccessMode.Read)) { throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Read, "CellFan"); } CellFanData.Load(aCellFan); }
/// <summary> /// Insert a <see cref="Fan"/> object passed as an argument via Stored Procedure that returns the newly inserted <i>Fan Key</i>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aFan">A <see cref="Fan"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aFan</c> argument is <c>null</c>.</exception> public static void Insert(FanKey aFanKey, Fan aFan) { if (aFan == null) { throw new ArgumentNullException("Insert Fan Business"); } if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Fanatic", AccessMode.Create)) { throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Create, "Fan"); } FanData.Insert(aFan); }
//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; }
/// <summary> /// The overloaded Load method that will return a specific <see cref="FanFed"/> object, with keys in <c>aFanFed</c>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aFanFed">A <see cref="FanFed"/>.</param> /// <exception cref="ArgumentNullException">If <c>aFanFed</c> is <c>null</c>.</exception> public static void Load(FanKey aFanKey, FanFed aFanFed) { if (aFanFed == null) { throw new ArgumentNullException("Load FanFed Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "FanFed", AccessMode.Read)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Read, "FanFed"); //} FanFedData.Load(aFanFed); }
/// <summary> /// The overloaded Load method that will return a specific <see cref="Workout"/> object, with keys in <c>aWorkout</c>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aWorkout">A <see cref="Workout"/>.</param> /// <exception cref="ArgumentNullException">If <c>aWorkout</c> is <c>null</c>.</exception> public static void Load(FanKey aFanKey, Workout aWorkout) { if (aWorkout == null) { throw new ArgumentNullException("Load Workout Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Workout", AccessMode.Read)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.WorkoutnKey), AccessMode.Read, "Workout"); //} WorkoutData.Load(aWorkout); }
/// <summary> /// The overloaded Load method that will return a specific <see cref="FanWorkout"/> object, with keys in <c>aFanWorkout</c>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aFanWorkout">A <see cref="FanWorkout"/>.</param> /// <exception cref="ArgumentNullException">If <c>aFanWorkout</c> is <c>null</c>.</exception> public static void Load(FanKey aFanKey, FanWorkout aFanWorkout) { if (aFanWorkout == null) { throw new ArgumentNullException("Load FanWorkout Business"); } if (!FanFunctionAccessData.HasModeAccess(aFanKey, "FanWorkout", AccessMode.Read)) { throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Read, "FanWorkout"); } FanWorkoutData.Load(aFanWorkout); }
/// <summary> /// The overloaded Load method that will return a <see cref="FanWorkoutCollection"/>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aFanWorkoutCollection">A <see cref="FanWorkoutCollection"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aFanWorkoutCollection</c> argument is <c>null</c>.</exception> public static void Load(FanKey aFanKey, FanWorkoutCollection aFanWorkoutCollection) { if (aFanWorkoutCollection == null) { throw new ArgumentNullException("Load FanWorkout Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "FanWorkout", AccessMode.List)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.List, "FanWorkout"); //} FanWorkoutData.Load(aFanWorkoutCollection); }
/// <summary> /// Delete a <see cref="RoleFunction"/> object passed as an argument. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aRoleFunction">A <see cref="RoleFunction"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception> public static void Delete(FanKey aFanKey, RoleFunction aRoleFunction) { if (aRoleFunction == null) { throw new ArgumentNullException("Delete RoleFunction Business"); } if (!FanFunctionAccessData.HasModeAccess(aFanKey, "RoleFunction", AccessMode.Delete)) { throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Delete, "RoleFunction"); } RoleFunctionData.Delete(aRoleFunction); }
/// <summary> /// Insert a <see cref="Cell"/> object passed as an argument via Stored Procedure that returns the newly inserted <i>Cell Key</i>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aCell">A <see cref="Cell"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aCell</c> argument is <c>null</c>.</exception> public static void Insert(FanKey aFanKey, Cell aCell) { if (aCell == null) { throw new ArgumentNullException("Insert Cell Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Cell", AccessMode.Create)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Create, "Cell"); //} CellData.Insert(aCell); }
/// <summary> /// The overloaded Load method that will return a specific <see cref="Cell"/> object, with keys in <c>aCell</c>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aCell">A <see cref="Cell"/>.</param> /// <exception cref="ArgumentNullException">If <c>aCell</c> is <c>null</c>.</exception> public static void Load(FanKey aFanKey, Cell aCell) { if (aCell == null) { throw new ArgumentNullException("Load Cell Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Cell", AccessMode.Read)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.CellnKey), AccessMode.Read, "Cell"); //} CellData.Load(aCell); }
/// <summary> /// Insert a <see cref="Role"/> object passed as an argument via Stored Procedure that returns the newly inserted <i>Role Key</i>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aRole">A <see cref="Role"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aRole</c> argument is <c>null</c>.</exception> public static void Insert(FanKey aFanKey, Role aRole) { if (aRole == null) { throw new ArgumentNullException("Insert Role Business"); } if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Role", AccessMode.Create)) { throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Create, "Role"); } RoleData.Insert(aRole); }
/// <summary> /// Save a <see cref="Friend" /> list passed as an argument. /// </summary> /// <param name="aFanKey">A <see cref="FanKey" /> object.</param> /// <param name="aFriendCollection">A fan fed collection.</param> /// <exception cref="Zephry.ZpAccessException">Access Denied; Friend</exception> /// <exception cref="ArgumentNullException">If <c>aFriend</c> argument is <c>null</c>.</exception> public static void Save(FanKey aFanKey, FriendCollection aFriendCollection) { if (aFriendCollection == null) { throw new ArgumentNullException("Update FriendCollection Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Friend", AccessMode.Update)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Update, "Friend"); //} FriendCollection vExisting = new FriendCollection(); vExisting.IsFiltered = true; vExisting.FriendFilter.AssignFromSource(aFriendCollection.FriendFilter); FriendData.Load(vExisting); FriendCollection vFresh = new FriendCollection(); vFresh.IsFiltered = true; vFresh.FriendFilter.AssignFromSource(aFriendCollection.FriendFilter); foreach (Friend vFriend in aFriendCollection.FriendList) { bool exists = false; bool bonafide = true; int instancenumber = 0; foreach (Friend oldFriend in vExisting.FriendList) { if (vFriend.Fan1Key == oldFriend.Fan1Key && vFriend.Fan2Key == oldFriend.Fan2Key) { exists = true; bonafide = false; instancenumber++; break; } else if (vFriend.Fan1Key == oldFriend.Fan2Key && vFriend.Fan2Key == oldFriend.Fan1Key) { bonafide = false; break; } } if (bonafide) vFriend.FriendDateEstablished = DateTime.Now.ToLongDateString(); if ((exists || bonafide) && instancenumber < 2) vFresh.FriendList.Add(vFriend); } FriendData.Save(vFresh); }
/// <summary> /// Insert a <see cref="Workout"/> object passed as an argument via Stored Procedure that returns the newly inserted <i>Workout Key</i>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aWorkout">A <see cref="Workout"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aWorkout</c> argument is <c>null</c>.</exception> public static void Insert(FanKey aFanKey, Workout aWorkout) { if (aWorkout == null) { throw new ArgumentNullException("Insert Workout Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Workout", AccessMode.Create)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Create, "Workout"); //} //Set date of creation before insert aWorkout.DateCreated = DateTime.Now.ToLongDateString(); WorkoutData.Insert(aWorkout); }
/// <summary> /// The overloaded Load method that will return a <see cref="FriendCollection"/>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aFriendCollection">A <see cref="FriendCollection"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aFriendCollection</c> argument is <c>null</c>.</exception> public static void Load(FanKey aFanKey, FriendCollection aFriendCollection) { if (aFriendCollection == null) { throw new ArgumentNullException("Load Friend Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Friend", AccessMode.List)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.List, "Friend"); //} FriendData.Load(aFriendCollection); // REMEMBER TO SORT AFRIENDCOLLECTION SUCH THAT THE FILTERING FAN IS ALWAYS THE FIRST FAN KEY }
/// <summary> /// Gets a specific access of a Specific mode for a user. /// </summary> /// <param name="aFanKey">A user key composite.</param> /// <param name="aFunction">A function.</param> /// <param name="aAccessMode">A access mode.</param> /// <returns></returns> public static bool HasModeAccess(FanKey aFanKey, string aFunction, AccessMode aAccessMode) { FanFunctionAccess vFanFunctionAccess = new FanFunctionAccess() { FannKey = aFanKey.FannKey }; vFanFunctionAccess.FunctionAccess.Function = aFunction; Load(vFanFunctionAccess); bool vAccess = false; switch (aAccessMode) { case AccessMode.List: { vAccess = vFanFunctionAccess.FunctionAccess.Access.List; break; } case AccessMode.Read: { vAccess = vFanFunctionAccess.FunctionAccess.Access.Read; break; } case AccessMode.Create: { vAccess = vFanFunctionAccess.FunctionAccess.Access.Create; break; } case AccessMode.Update: { vAccess = vFanFunctionAccess.FunctionAccess.Access.Update; break; } case AccessMode.Delete: { vAccess = vFanFunctionAccess.FunctionAccess.Access.Delete; break; } default: { vAccess = false; break; } } return vAccess; }