Example #1
0
 /// <summary>
 ///   Insert a <see cref="FanSessionActivity"/> passed as an argument via Stored Procedure that returns the newly inserted FanSessionActivity Key
 /// </summary>
 /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFanSessionActivity</c> argument is <c>null</c>.</exception>
 public static void Insert(FanSessionActivity aFanSessionActivity)
 {
     if (aFanSessionActivity == null)
     {
         throw new ArgumentNullException("aFanSessionActivity");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into FSA_FanSessionActivity");
         vStringBuilder.AppendLine("       (FAN_Key,");
         vStringBuilder.AppendLine("        WRT_Key,");
         vStringBuilder.AppendLine("        EXC_Key,");
         vStringBuilder.AppendLine("        ACT_Key,");
         vStringBuilder.AppendLine("        FSA_Result)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@FANKey,");
         vStringBuilder.AppendLine("        @WRTKey,");
         vStringBuilder.AppendLine("        @EXCKey,");
         vStringBuilder.AppendLine("        @ACTKey,");
         vStringBuilder.AppendLine("        @FSAResult)");
         vStringBuilder.AppendLine(";");
         vStringBuilder.AppendLine("select SCOPE_IDENTITY()");
         ObjectToData(vSqlCommand, aFanSessionActivity);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         aFanSessionActivity.FssKey = Convert.ToInt32(vSqlCommand.ExecuteScalar());
         vSqlCommand.Connection.Close();
     }
 }
 /// <summary>
 ///   Insert a <see cref="FanSessionActivity"/> passed as an argument via Stored Procedure that returns the newly inserted FanSessionActivity Key 
 /// </summary>
 /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFanSessionActivity</c> argument is <c>null</c>.</exception>
 public static void Insert(FanSessionActivity aFanSessionActivity)
 {
     if (aFanSessionActivity == null)
     {
         throw new ArgumentNullException("aFanSessionActivity");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into FSA_FanSessionActivity");
         vStringBuilder.AppendLine("       (FAN_Key,");
         vStringBuilder.AppendLine("        WRT_Key,");
         vStringBuilder.AppendLine("        EXC_Key,");
         vStringBuilder.AppendLine("        ACT_Key,");
         vStringBuilder.AppendLine("        FSA_Result)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@FANKey,");
         vStringBuilder.AppendLine("        @WRTKey,");
         vStringBuilder.AppendLine("        @EXCKey,");
         vStringBuilder.AppendLine("        @ACTKey,");
         vStringBuilder.AppendLine("        @FSAResult)");
         vStringBuilder.AppendLine(";");
         vStringBuilder.AppendLine("select SCOPE_IDENTITY()");
         ObjectToData(vSqlCommand, aFanSessionActivity);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         aFanSessionActivity.FssKey = Convert.ToInt32(vSqlCommand.ExecuteScalar());
         vSqlCommand.Connection.Close();
     }
 }
Example #3
0
 /// <summary>
 ///   Update a <see cref="FanSessionActivity"/> passed as an argument .
 /// </summary>
 /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/>.</param>
 public static void Update(FanSessionActivity aFanSessionActivity)
 {
     if (aFanSessionActivity == null)
     {
         throw new ArgumentNullException("aFanSessionActivity");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("update FSS_FanSession");
         vStringBuilder.AppendLine("set    FSA_Result = @FSAResult");
         vStringBuilder.AppendLine("where  WRT_Key = @WRTKey");
         vStringBuilder.AppendLine("and    FAN_Key = @FANKey");
         vStringBuilder.AppendLine("and    FSS_Key = @FSSKey");
         vStringBuilder.AppendLine("and    EXC_Key = @EXCKey");
         vStringBuilder.AppendLine("and    ACT_Key = @ACTKey");
         ObjectToData(vSqlCommand, aFanSessionActivity);
         vSqlCommand.Parameters.AddWithValue("@FSSKey", aFanSessionActivity.FssKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         vSqlCommand.ExecuteNonQuery();
         vSqlCommand.Connection.Close();
     }
 }
 /// <summary>
 ///   Load a <see cref="SqlDataReader"/> into a <see cref="FanSessionActivity"/> object.
 /// </summary>
 /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/> argument.</param>
 /// <param name="aSqlDataReader">A <see cref="SqlDataReader"/> argument.</param>
 public static void DataToObject(FanSessionActivity aFanSessionActivity, SqlDataReader aSqlDataReader, bool aIncludeAvatar)
 {
     aFanSessionActivity.WrtKey = Convert.ToInt32(aSqlDataReader["WRT_Key"]);
     aFanSessionActivity.FanKey = Convert.ToInt32(aSqlDataReader["FAN_Key"]);
     aFanSessionActivity.FssKey = Convert.ToInt32(aSqlDataReader["FSS_Key"]);
     aFanSessionActivity.ExcKey = Convert.ToInt32(aSqlDataReader["EXC_Key"]);
     aFanSessionActivity.ActKey = Convert.ToInt32(aSqlDataReader["ACT_Key"]);
     aFanSessionActivity.FsaResult = Convert.ToString(aSqlDataReader["FSA_Result"]);
 }
Example #5
0
 /// <summary>
 ///   Load a <see cref="SqlDataReader"/> into a <see cref="FanSessionActivity"/> object.
 /// </summary>
 /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/> argument.</param>
 /// <param name="aSqlDataReader">A <see cref="SqlDataReader"/> argument.</param>
 public static void DataToObject(FanSessionActivity aFanSessionActivity, SqlDataReader aSqlDataReader, bool aIncludeAvatar)
 {
     aFanSessionActivity.WrtKey    = Convert.ToInt32(aSqlDataReader["WRT_Key"]);
     aFanSessionActivity.FanKey    = Convert.ToInt32(aSqlDataReader["FAN_Key"]);
     aFanSessionActivity.FssKey    = Convert.ToInt32(aSqlDataReader["FSS_Key"]);
     aFanSessionActivity.ExcKey    = Convert.ToInt32(aSqlDataReader["EXC_Key"]);
     aFanSessionActivity.ActKey    = Convert.ToInt32(aSqlDataReader["ACT_Key"]);
     aFanSessionActivity.FsaResult = Convert.ToString(aSqlDataReader["FSA_Result"]);
 }
Example #6
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FanSessionActivityList</c> property a <see cref="FanSessionActivityCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="FanSessionActivity"/>, filtered by the filter properties of the passed <see cref="FanSessionActivityCollection"/>.
 /// </summary>
 /// <param name="aFanSessionActivityCollection">The <see cref="FanSessionActivityCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FanSessionActivityCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFanSessionActivityCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FanSessionActivityCollection aFanSessionActivityCollection)
 {
     if (aFanSessionActivityCollection == null)
     {
         throw new ArgumentNullException("aFanSessionActivityCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aFanSessionActivityCollection.IsFiltered)
         {
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.WrtKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.WRT_Key = @WRTKey");
                 vSqlCommand.Parameters.AddWithValue("@WRTKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.WrtKey);
             }
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.FanKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.FAN_Key = @FANKey");
                 vSqlCommand.Parameters.AddWithValue("@FANKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.FanKey);
             }
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.FssKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.FSS_Key = @FSSKey");
                 vSqlCommand.Parameters.AddWithValue("@FSSKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.FssKey);
             }
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.ActKey > 0)
             {
                 vStringBuilder.AppendLine("and t1.ACT_Key = @ACTKey");
                 vSqlCommand.Parameters.AddWithValue("@ACTKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.ActKey);
             }
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.ExcKey > 0)
             {
                 vStringBuilder.AppendLine("and t1.EXC_Key = @EXCKey");
                 vSqlCommand.Parameters.AddWithValue("@EXCKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.ExcKey);
             }
         }
         vStringBuilder.AppendLine("order by t2.FSS_Key");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFanSessionActivity = new FanSessionActivity();
                 DataToObject(vFanSessionActivity, vSqlDataReader, false);
                 aFanSessionActivityCollection.FanSessionActivityList.Add(vFanSessionActivity);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Example #7
0
 /// <summary>
 ///   Loads the <see cref="SqlCommand"/> parameters with values from an <see cref="FanSessionActivity"/>.
 /// </summary>
 /// <param name="aSqlCommand">A <see cref="SqlDataReader"/> argument.</param>
 /// <param name="aWorkout">A <see cref="FanSessionActivity"/> argument.</param>
 public static void ObjectToData(SqlCommand aSqlCommand, FanSessionActivity aFanSessionActivity)
 {
     aSqlCommand.Parameters.AddWithValue("@WRTKey", aFanSessionActivity.WrtKey);
     aSqlCommand.Parameters.AddWithValue("@FANKey", aFanSessionActivity.FanKey);
     aSqlCommand.Parameters.AddWithValue("@FSSKey", aFanSessionActivity.FssKey);
     aSqlCommand.Parameters.AddWithValue("@EXCKey", aFanSessionActivity.ExcKey);
     aSqlCommand.Parameters.AddWithValue("@ACTKey", aFanSessionActivity.ActKey);
     aSqlCommand.Parameters.AddWithValue("@FSAResult", aFanSessionActivity.FsaResult);
 }
        /// <summary>
        ///   The overloaded Load method that will return a specific <see cref="FanSessionActivity"/> object, with keys in <c>aFanSessionActivity</c>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/>.</param>
        /// <exception cref="ArgumentNullException">If <c>aFanSessionActivity</c> is <c>null</c>.</exception>
        public static void Load(FanKey aFanKey, FanSessionActivity aFanSessionActivity)
        {
            if (aFanSessionActivity == null)
            {
                throw new ArgumentNullException("Load FanSessionActivity Business");
            }

            if (!FanFunctionAccessData.HasModeAccess(aFanKey, "FanSessionActivity", AccessMode.Read))
            {
                throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Read, "FanSessionActivity");
            }

            FanSessionActivityData.Load(aFanSessionActivity);
        }
Example #9
0
        /// <summary>
        ///   The overloaded Load method that will return a specific <see cref="FanSessionActivity"/> object, with keys in <c>aFanSessionActivity</c>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/>.</param>
        /// <exception cref="ArgumentNullException">If <c>aFanSessionActivity</c> is <c>null</c>.</exception>
        public static void Load(FanKey aFanKey, FanSessionActivity aFanSessionActivity)
        {
            if (aFanSessionActivity == null)
            {
                throw new ArgumentNullException("Load FanSessionActivity Business");
            }

            if (!FanFunctionAccessData.HasModeAccess(aFanKey, "FanSessionActivity", AccessMode.Read))
            {
                throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Read, "FanSessionActivity");
            }

            FanSessionActivityData.Load(aFanSessionActivity);
        }
Example #10
0
        /// <summary>
        ///    Assigns all <c>aSource</c> object's values to this instance of <see cref="FanSessionActivityCollection"/>.
        /// </summary>
        /// <param name="aSource">A source object.</param>
        public override void AssignFromSource(object aSource)
        {
            if (!(aSource is FanSessionActivityCollection))
            {
                throw new ArgumentException("Invalid assignment source", "FanSessionActivityCollection");
            }

            _isFiltered = (aSource as FanSessionActivityCollection)._isFiltered;
            _fanSessionActivityFilter = (aSource as FanSessionActivityCollection)._fanSessionActivityFilter;
            _fanSessionActivityList.Clear();
            foreach (FanSessionActivity vFanSessionActivitySource in (aSource as FanSessionActivityCollection)._fanSessionActivityList)
            {
                FanSessionActivity vFanSessionActivityTarget = new FanSessionActivity();
                vFanSessionActivityTarget.AssignFromSource(vFanSessionActivitySource);
                _fanSessionActivityList.Add(vFanSessionActivityTarget);
            }
        }
        /// <summary>
        ///    Assigns all <c>aSource</c> object's values to this instance of <see cref="FanSessionActivityCollection"/>.
        /// </summary>
        /// <param name="aSource">A source object.</param>
        public override void AssignFromSource(object aSource)
        {
            if (!(aSource is FanSessionActivityCollection))
            {
                throw new ArgumentException("Invalid assignment source", "FanSessionActivityCollection");
            }

            _isFiltered = (aSource as FanSessionActivityCollection)._isFiltered;
            _fanSessionActivityFilter = (aSource as FanSessionActivityCollection)._fanSessionActivityFilter;
            _fanSessionActivityList.Clear();
            foreach (FanSessionActivity vFanSessionActivitySource in (aSource as FanSessionActivityCollection)._fanSessionActivityList)
            {
                FanSessionActivity vFanSessionActivityTarget = new FanSessionActivity();
                vFanSessionActivityTarget.AssignFromSource(vFanSessionActivitySource);
                _fanSessionActivityList.Add(vFanSessionActivityTarget);
            }
        }
Example #12
0
 /// <summary>
 ///   The overloaded Load method that will return a specific <see cref="FanSessionActivity"/>, with keys in the <c>aFanSessionActivity</c> argument.
 /// </summary>
 /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFanSessionActivity</c> argument is <c>null</c>.</exception>
 /// <exception cref="Exception">If no record is found.</exception>
 public static void Load(FanSessionActivity aFanSessionActivity)
 {
     if (aFanSessionActivity == null)
     {
         throw new ArgumentNullException("aFanSessionActivity");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         vStringBuilder.AppendLine("and t2.WRT_Key = @WRTKey");
         vStringBuilder.AppendLine("and t2.FAN_Key = @FANKey");
         vStringBuilder.AppendLine("and t2.FSS_Key = @FSSKey");
         vStringBuilder.AppendLine("and t1.EXC_Key = @EXCKey");
         vStringBuilder.AppendLine("and t1.ACT_Key = @ACTKey");
         vSqlCommand.Parameters.AddWithValue("@WRTKey", aFanSessionActivity.WrtKey);
         vSqlCommand.Parameters.AddWithValue("@FANKey", aFanSessionActivity.FanKey);
         vSqlCommand.Parameters.AddWithValue("@FSSKey", aFanSessionActivity.FssKey);
         vSqlCommand.Parameters.AddWithValue("@EXCKey", aFanSessionActivity.ExcKey);
         vSqlCommand.Parameters.AddWithValue("@ACTKey", aFanSessionActivity.ActKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             if (!vSqlDataReader.HasRows)
             {
                 throw new Exception(String.Format("Expected FanSessionActivity not found: WRT_Key = {0}, FAN_Key = {1}, FSS_Key = {2}, EXC_Key = {3}, ACT_Key = {4}", aFanSessionActivity.WrtKey, aFanSessionActivity.FanKey, aFanSessionActivity.FssKey, aFanSessionActivity.ExcKey, aFanSessionActivity.ActKey));
             }
             vSqlDataReader.Read();
             DataToObject(aFanSessionActivity, vSqlDataReader, true);
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Example #13
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);
 }
        /// <summary>
        ///   Update a <see cref="FanSessionActivity"/> passed as an argument .
        /// </summary>
        /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/>.</param>
        public static void Update(FanSessionActivity aFanSessionActivity)
        {
            if (aFanSessionActivity == null)
            {
                throw new ArgumentNullException("aFanSessionActivity");
            }
            using (var vSqlCommand = new SqlCommand()
            {
                CommandType = CommandType.Text,
                Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
            })
            {
                var vStringBuilder = new StringBuilder();
                vStringBuilder.AppendLine("update FSS_FanSession");
                vStringBuilder.AppendLine("set    FSA_Result = @FSAResult");
                vStringBuilder.AppendLine("where  WRT_Key = @WRTKey");
                vStringBuilder.AppendLine("and    FAN_Key = @FANKey");
                vStringBuilder.AppendLine("and    FSS_Key = @FSSKey");
                vStringBuilder.AppendLine("and    EXC_Key = @EXCKey");
                vStringBuilder.AppendLine("and    ACT_Key = @ACTKey");
                ObjectToData(vSqlCommand, aFanSessionActivity);
                vSqlCommand.Parameters.AddWithValue("@FSSKey", aFanSessionActivity.FssKey);
                vSqlCommand.CommandText = vStringBuilder.ToString();
                vSqlCommand.Connection.Open();
                vSqlCommand.ExecuteNonQuery();
                vSqlCommand.Connection.Close();

            }
        }
 /// <summary>
 ///   Loads the <see cref="SqlCommand"/> parameters with values from an <see cref="FanSessionActivity"/>.
 /// </summary>
 /// <param name="aSqlCommand">A <see cref="SqlDataReader"/> argument.</param>
 /// <param name="aWorkout">A <see cref="FanSessionActivity"/> argument.</param>
 public static void ObjectToData(SqlCommand aSqlCommand, FanSessionActivity aFanSessionActivity)
 {
     aSqlCommand.Parameters.AddWithValue("@WRTKey", aFanSessionActivity.WrtKey);
     aSqlCommand.Parameters.AddWithValue("@FANKey", aFanSessionActivity.FanKey);
     aSqlCommand.Parameters.AddWithValue("@FSSKey", aFanSessionActivity.FssKey);
     aSqlCommand.Parameters.AddWithValue("@EXCKey", aFanSessionActivity.ExcKey);
     aSqlCommand.Parameters.AddWithValue("@ACTKey", aFanSessionActivity.ActKey);
     aSqlCommand.Parameters.AddWithValue("@FSAResult", aFanSessionActivity.FsaResult);
 }
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FanSessionActivityList</c> property a <see cref="FanSessionActivityCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="FanSessionActivity"/>, filtered by the filter properties of the passed <see cref="FanSessionActivityCollection"/>.
 /// </summary>
 /// <param name="aFanSessionActivityCollection">The <see cref="FanSessionActivityCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FanSessionActivityCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFanSessionActivityCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FanSessionActivityCollection aFanSessionActivityCollection)
 {
     if (aFanSessionActivityCollection == null)
     {
         throw new ArgumentNullException("aFanSessionActivityCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aFanSessionActivityCollection.IsFiltered)
         {
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.WrtKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.WRT_Key = @WRTKey");
                 vSqlCommand.Parameters.AddWithValue("@WRTKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.WrtKey);
             }
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.FanKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.FAN_Key = @FANKey");
                 vSqlCommand.Parameters.AddWithValue("@FANKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.FanKey);
             }
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.FssKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.FSS_Key = @FSSKey");
                 vSqlCommand.Parameters.AddWithValue("@FSSKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.FssKey);
             }
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.ActKey > 0)
             {
                 vStringBuilder.AppendLine("and t1.ACT_Key = @ACTKey");
                 vSqlCommand.Parameters.AddWithValue("@ACTKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.ActKey);
             }
             if (aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.ExcKey > 0)
             {
                 vStringBuilder.AppendLine("and t1.EXC_Key = @EXCKey");
                 vSqlCommand.Parameters.AddWithValue("@EXCKey", aFanSessionActivityCollection.FanSessionActivityFilter.FsaFilter.ExcKey);
             }
         }
         vStringBuilder.AppendLine("order by t2.FSS_Key");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFanSessionActivity = new FanSessionActivity();
                 DataToObject(vFanSessionActivity, vSqlDataReader, false);
                 aFanSessionActivityCollection.FanSessionActivityList.Add(vFanSessionActivity);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Example #17
0
 /// <summary>
 ///   Gets the <see cref="FanSessionActivity"/> by Key.
 /// </summary>
 /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
 /// <returns>FanSessionActivity as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetFanSessionActivity(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetFanSessionActivity");
     }
     FanSessionActivity vFanSessionActivity = new FanSessionActivity();
     vFanSessionActivity = XmlUtils.Deserialize<FanSessionActivity>(aXmlArgument);
     FanSessionActivityBusiness.Load(aFanKey, vFanSessionActivity);
     return XmlUtils.Serialize<FanSessionActivity>(vFanSessionActivity, true);
 }
 /// <summary>
 ///   The overloaded Load method that will return a specific <see cref="FanSessionActivity"/>, with keys in the <c>aFanSessionActivity</c> argument.
 /// </summary>
 /// <param name="aFanSessionActivity">A <see cref="FanSessionActivity"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFanSessionActivity</c> argument is <c>null</c>.</exception>
 /// <exception cref="Exception">If no record is found.</exception>
 public static void Load(FanSessionActivity aFanSessionActivity)
 {
     if (aFanSessionActivity == null)
     {
         throw new ArgumentNullException("aFanSessionActivity");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         vStringBuilder.AppendLine("and t2.WRT_Key = @WRTKey");
         vStringBuilder.AppendLine("and t2.FAN_Key = @FANKey");
         vStringBuilder.AppendLine("and t2.FSS_Key = @FSSKey");
         vStringBuilder.AppendLine("and t1.EXC_Key = @EXCKey");
         vStringBuilder.AppendLine("and t1.ACT_Key = @ACTKey");
         vSqlCommand.Parameters.AddWithValue("@WRTKey", aFanSessionActivity.WrtKey);
         vSqlCommand.Parameters.AddWithValue("@FANKey", aFanSessionActivity.FanKey);
         vSqlCommand.Parameters.AddWithValue("@FSSKey", aFanSessionActivity.FssKey);
         vSqlCommand.Parameters.AddWithValue("@EXCKey", aFanSessionActivity.ExcKey);
         vSqlCommand.Parameters.AddWithValue("@ACTKey", aFanSessionActivity.ActKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             if (!vSqlDataReader.HasRows)
             {
                 throw new Exception(String.Format("Expected FanSessionActivity not found: WRT_Key = {0}, FAN_Key = {1}, FSS_Key = {2}, EXC_Key = {3}, ACT_Key = {4}", aFanSessionActivity.WrtKey, aFanSessionActivity.FanKey, aFanSessionActivity.FssKey, aFanSessionActivity.ExcKey, aFanSessionActivity.ActKey));
             }
             vSqlDataReader.Read();
             DataToObject(aFanSessionActivity, vSqlDataReader, true);
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Example #19
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);
 }