Example #1
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FedList</c> property a <see cref="FedCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="Fed"/>, filtered by the filter properties of the passed <see cref="FedCollection"/>.
 /// </summary>
 /// <param name="aFedCollection">The <see cref="FedCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FedCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFedCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FedCollection aFedCollection)
 {
     if (aFedCollection == null)
     {
         throw new ArgumentNullException("aFedCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(false);
         if (aFedCollection.IsFiltered)
         {
             vStringBuilder.AppendFormat("where t1.FED_Name is like '%{0}%", aFedCollection.FedFilter.FedNameFilter);
         }
         vStringBuilder.AppendLine("order by t1.FED_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFed = new Fed();
                 DataToObject(vFed, vSqlDataReader, false);
                 aFedCollection.FedList.Add(vFed);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Example #2
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="FedCollection"/>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aFedCollection">A <see cref="FedCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aFedCollection</c> argument is <c>null</c>.</exception>
        public static void Load(FanKey aFanKey, FedCollection aFedCollection)
        {
            if (aFedCollection == null)
            {
                throw new ArgumentNullException("Load Fed Business");
            }

            //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Fed", AccessMode.List))
            //{
            //    throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FednKey), AccessMode.List, "Fed");
            //}

            FedData.Load(aFedCollection);
        }
Example #3
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="FedCollection"/>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aFedCollection">A <see cref="FedCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aFedCollection</c> argument is <c>null</c>.</exception>
        public static void Load(FanKey aFanKey, FedCollection aFedCollection)
        {
            if (aFedCollection == null)
            {
                throw new ArgumentNullException("Load Fed Business");
            }

            //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Fed", AccessMode.List))
            //{
            //    throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FednKey), AccessMode.List, "Fed");
            //}

            FedData.Load(aFedCollection);
        }
Example #4
0
 /// <summary>
 ///   The <c>GetFedCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="FedCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="FedBusiness"/> with the newly deserialized <see cref="FedCollection"/> 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="FedCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetFedCollection(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetFedCollection");
     }
     FedCollection vFedCollection = new FedCollection();
     vFedCollection = XmlUtils.Deserialize<FedCollection>(aXmlArgument);
     FedBusiness.Load(aFanKey, vFedCollection);
     return XmlUtils.Serialize<FedCollection>(vFedCollection, true);
 }
Example #5
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FedList</c> property a <see cref="FedCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="Fed"/>, filtered by the filter properties of the passed <see cref="FedCollection"/>.
 /// </summary>
 /// <param name="aFedCollection">The <see cref="FedCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FedCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFedCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FedCollection aFedCollection)
 {
     if (aFedCollection == null)
     {
         throw new ArgumentNullException("aFedCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(false);
         if (aFedCollection.IsFiltered)
         {
             vStringBuilder.AppendFormat("where t1.FED_Name is like '%{0}%", aFedCollection.FedFilter.FedNameFilter);
         }
         vStringBuilder.AppendLine("order by t1.FED_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFed = new Fed();
                 DataToObject(vFed, vSqlDataReader, false);
                 aFedCollection.FedList.Add(vFed);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }