public static webObject loadExerciseCollection(Exercise aExercise) { ExerciseCollection vExerciseCollection = new ExerciseCollection(); vExerciseCollection.ExerciseFilter.ExcFilter.AssignFromSource(aExercise); FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session); webObject vWebObject = new webObject(); vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session); try { FanServiceConsumer.GetExerciseCollection(vFanToken, vExerciseCollection); vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK; vWebObject.aTransactionStatus.Message = "ExerciseCollection Loaded"; ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus); vWebObject.AnObject = vExerciseCollection; } catch (TransactionStatusException tx) { vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus); return(vWebObject); } catch (Exception ex) { vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException; vWebObject.aTransactionStatus.Message = "Load of ExerciseCollection unsuccesful" + ex.Message; vWebObject.aTransactionStatus.InnerMessage = ex.InnerException == null ? String.Empty : ex.InnerException.Message; return(vWebObject); } return(vWebObject); }
/// <summary> /// The overloaded Load method that will fill the <c>ExerciseList</c> property a <see cref="ExerciseCollection"/> object as an /// ordered <c>List</c> of <see cref="Exercise"/>, filtered by the filter properties of the passed <see cref="ExerciseCollection"/>. /// </summary> /// <param name="aExerciseCollection">The <see cref="ExerciseCollection"/> object that must be filled.</param> /// <remarks> /// The filter properties of the <see cref="ExerciseCollection"/> must be correctly completed by the calling application. /// </remarks> /// <exception cref="ArgumentNullException">If <c>aExerciseCollection</c> argument is <c>null</c>.</exception> public static void Load(ExerciseCollection aExerciseCollection) { if (aExerciseCollection == null) { throw new ArgumentNullException("aExerciseCollection"); } using (var vSqlCommand = new SqlCommand() { CommandType = CommandType.Text, Connection = new SqlConnection(Connection.Instance.SqlConnectionString) }) { var vStringBuilder = BuildSQL(); if (aExerciseCollection.IsFiltered) { vStringBuilder.AppendFormat("where t1.EXC_Name is like '%{0}%", aExerciseCollection.ExerciseFilter.ExcFilter.ExcName); } vStringBuilder.AppendLine("order by t1.EXC_Name"); vSqlCommand.CommandText = vStringBuilder.ToString(); vSqlCommand.Connection.Open(); using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader()) { while (vSqlDataReader.Read()) { var vExercise = new Exercise(); DataToObject(vExercise, vSqlDataReader); aExerciseCollection.ExerciseList.Add(vExercise); } vSqlDataReader.Close(); } vSqlCommand.Connection.Close(); } }
/// <summary> /// The overloaded Load method that will return a <see cref="ExerciseCollection"/>. /// </summary> /// <param name="aFanKey">A <see cref="FanKey"/> object.</param> /// <param name="aExerciseCollection">A <see cref="ExerciseCollection"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aExerciseCollection</c> argument is <c>null</c>.</exception> public static void Load(FanKey aFanKey, ExerciseCollection aExerciseCollection) { if (aExerciseCollection == null) { throw new ArgumentNullException("Load Exercise Business"); } //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Exercise", AccessMode.List)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.ExercisenKey), AccessMode.List, "Exercise"); //} ExerciseData.Load(aExerciseCollection); }
public static webObject loadExerciseCollection(Exercise aExercise) { ExerciseCollection vExerciseCollection = new ExerciseCollection(); vExerciseCollection.ExerciseFilter.ExcFilter.AssignFromSource(aExercise); FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session); webObject vWebObject = new webObject(); vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session); try { FanServiceConsumer.GetExerciseCollection(vFanToken, vExerciseCollection); vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK; vWebObject.aTransactionStatus.Message = "ExerciseCollection Loaded"; ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus); vWebObject.AnObject = vExerciseCollection; } catch (TransactionStatusException tx) { vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus); return vWebObject; } catch (Exception ex) { vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException; vWebObject.aTransactionStatus.Message = "Load of ExerciseCollection unsuccesful" + ex.Message; vWebObject.aTransactionStatus.InnerMessage = ex.InnerException == null ? String.Empty : ex.InnerException.Message; return vWebObject; } return vWebObject; }
/// <summary> /// The <c>GetExerciseCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="ExerciseCollection"/> object. /// It invokes the <c>Insert</c> method of <see cref="ExerciseBusiness"/> with the newly deserialized <see cref="ExerciseCollection"/> object. /// Finally, it returns the collection object as a serialized <see cref="string"/> of XML. /// </summary> /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param> /// <returns><see cref="ExerciseCollection"/> as XML <see cref="string"/>.</returns> /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception> public static string GetExerciseCollection(FanKey aFanKey, string aXmlArgument) { if (aXmlArgument == null) { throw new ArgumentNullException("aXmlArgument of GetExerciseCollection"); } ExerciseCollection vExerciseCollection = new ExerciseCollection(); vExerciseCollection = XmlUtils.Deserialize<ExerciseCollection>(aXmlArgument); ExerciseBusiness.Load(aFanKey, vExerciseCollection); return XmlUtils.Serialize<ExerciseCollection>(vExerciseCollection, true); }
/// <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); }
/// <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); }