Beispiel #1
0
 /// <summary>
 ///   The <c>GetFunctionCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="FunctionCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="FunctionBusiness"/> with the newly deserialized <see cref="FunctionCollection"/> 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="FunctionCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetFunctionCollection(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetFunctionCollection");
     }
     FunctionCollection vFunctionCollection = new FunctionCollection();
     vFunctionCollection = XmlUtils.Deserialize<FunctionCollection>(aXmlArgument);
     FunctionBusiness.Load(aFanKey, vFunctionCollection);
     return XmlUtils.Serialize<FunctionCollection>(vFunctionCollection, true);
 }
Beispiel #2
0
        /// <summary>
        ///   The overloaded Load method that will fill the <c>FunctionList</c> property a <see cref="FunctionCollection"/> object as an
        ///   ordered <c>List</c> of <see cref="Function"/>, filtered by the filter properties of the passed <see cref="FunctionCollection"/>.
        /// </summary>
        /// <param name="aFunctionCollection">The <see cref="FunctionCollection"/> object that must be filled.</param>
        /// <remarks>
        ///   The filter properties of the <see cref="FunctionCollection"/> must be correctly completed by the calling application.
        /// </remarks>
        /// <exception cref="ArgumentNullException">If <c>aFunctionCollection</c> argument is <c>null</c>.</exception>
        public static void Load(FunctionCollection aFunctionCollection)
        {
            if (aFunctionCollection == null)
            {
                throw new ArgumentNullException("aFunctionCollection");
            }
            using (var vSqlCommand = new SqlCommand()
            {
                CommandType = CommandType.Text,
                Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
            })
            {
                var vStringBuilder = BuildSQL();
                if (aFunctionCollection.IsFiltered)
                {

                }
                vStringBuilder.AppendLine("order by t1.FNC_Name");
                vSqlCommand.CommandText = vStringBuilder.ToString();
                vSqlCommand.Connection.Open();
                using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
                {
                    while (vSqlDataReader.Read())
                    {
                        var vFunction = new Function();
                        DataToObject(vFunction, vSqlDataReader);
                        aFunctionCollection.FunctionList.Add(vFunction);
                    }
                    vSqlDataReader.Close();
                }
                vSqlCommand.Connection.Close();
            }
        }
Beispiel #3
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="FunctionCollection"/>.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aFunctionCollection">A <see cref="FunctionCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aFunctionCollection</c> argument is <c>null</c>.</exception>
        public static void Load(UserKey aUserKey, FunctionCollection aFunctionCollection)
        {
            if (aFunctionCollection == null)
            {
                throw new ArgumentNullException("Load Function Business");
            }

            if (!UserFunctionAccessData.HasModeAccess(aUserKey, "Function", AccessMode.List))
            {
                throw new ZpAccessException("Access Denied", String.Format("{0}", aUserKey.UsrKey), AccessMode.List, "Function");
            }

            FunctionData.Load(aFunctionCollection);
        }