Example #1
0
        /// <summary>
        ///   The <c>GetRoleFunctionCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="RoleFunctionCollection"/> object.
        ///   It invokes the <c>Insert</c> method of <see cref="RoleFunctionBusiness"/> with the newly deserialized <see cref="RoleFunctionCollection"/> 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="RoleFunctionCollection"/> as XML <see cref="string"/>.</returns>
        /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
        public static string GetRoleFunctionCollection(FanKey aFanKey, string aXmlArgument)
        {
            if (aXmlArgument == null)
            {
                throw new ArgumentNullException("aXmlArgument of GetRoleFunctionCollection");
            }
            RoleFunctionCollection vRoleFunctionCollection = new RoleFunctionCollection();

            vRoleFunctionCollection = XmlUtils.Deserialize <RoleFunctionCollection>(aXmlArgument);
            RoleFunctionBusiness.Load(aFanKey, vRoleFunctionCollection);
            return(XmlUtils.Serialize <RoleFunctionCollection>(vRoleFunctionCollection, true));
        }
Example #2
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="RoleFunctionCollection"/>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aRoleFunctionCollection">A <see cref="RoleFunctionCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aRoleFunctionCollection</c> argument is <c>null</c>.</exception>
        public static void Load(FanKey aFanKey, RoleFunctionCollection aRoleFunctionCollection)
        {
            if (aRoleFunctionCollection == null)
            {
                throw new ArgumentNullException("Load RoleFunction Business");
            }

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

            RoleFunctionData.Load(aRoleFunctionCollection);
        }
Example #3
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>RoleFunctionList</c> property a <see cref="RoleFunctionCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="RoleFunction"/>, filtered by the filter properties of the passed <see cref="RoleFunctionCollection"/>.
 /// </summary>
 /// <param name="aRoleFunctionCollection">The <see cref="RoleFunctionCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="RoleFunctionCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunctionCollection</c> argument is <c>null</c>.</exception>
 public static void Load(RoleFunctionCollection aRoleFunctionCollection)
 {
     if (aRoleFunctionCollection == null)
     {
         throw new ArgumentNullException("aRoleFunctionCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aRoleFunctionCollection.IsFiltered)
         {
             if (aRoleFunctionCollection.RoleKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t1.ROL_Key = @ROLKey");
                 vSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunctionCollection.RoleKeyFilter);
             }
             if (aRoleFunctionCollection.FunctionKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t2.FNC_Key = @FNCKey");
                 vSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunctionCollection.FunctionKeyFilter);
             }
         }
         vStringBuilder.AppendLine("order by t3.RFC_Key");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vRoleFunction = new RoleFunction();
                 DataToObject(vRoleFunction, vSqlDataReader);
                 aRoleFunctionCollection.RoleFunctionList.Add(vRoleFunction);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Example #4
0
 /// <summary>
 ///   The <c>GetRoleFunctionCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="RoleFunctionCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="RoleFunctionBusiness"/> with the newly deserialized <see cref="RoleFunctionCollection"/> 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="RoleFunctionCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetRoleFunctionCollection(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetRoleFunctionCollection");
     }
     RoleFunctionCollection vRoleFunctionCollection = new RoleFunctionCollection();
     vRoleFunctionCollection = XmlUtils.Deserialize<RoleFunctionCollection>(aXmlArgument);
     RoleFunctionBusiness.Load(aFanKey, vRoleFunctionCollection);
     return XmlUtils.Serialize<RoleFunctionCollection>(vRoleFunctionCollection, true);
 }
Example #5
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>RoleFunctionList</c> property a <see cref="RoleFunctionCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="RoleFunction"/>, filtered by the filter properties of the passed <see cref="RoleFunctionCollection"/>.
 /// </summary>
 /// <param name="aRoleFunctionCollection">The <see cref="RoleFunctionCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="RoleFunctionCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunctionCollection</c> argument is <c>null</c>.</exception>
 public static void Load(RoleFunctionCollection aRoleFunctionCollection)
 {
     if (aRoleFunctionCollection == null)
     {
         throw new ArgumentNullException("aRoleFunctionCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aRoleFunctionCollection.IsFiltered)
         {
             if (aRoleFunctionCollection.RoleKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t1.ROL_Key = @ROLKey");
                 vSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunctionCollection.RoleKeyFilter);
             }
             if (aRoleFunctionCollection.FunctionKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t2.FNC_Key = @FNCKey");
                 vSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunctionCollection.FunctionKeyFilter);
             }
         }
         vStringBuilder.AppendLine("order by t3.RFC_Key");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vRoleFunction = new RoleFunction();
                 DataToObject(vRoleFunction, vSqlDataReader);
                 aRoleFunctionCollection.RoleFunctionList.Add(vRoleFunction);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Example #6
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="RoleFunctionCollection"/>.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aRoleFunctionCollection">A <see cref="RoleFunctionCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aRoleFunctionCollection</c> argument is <c>null</c>.</exception>
        public static void Load(UserKey aUserKey, RoleFunctionCollection aRoleFunctionCollection)
        {
            if (aRoleFunctionCollection == null)
            {
                throw new ArgumentNullException("Load RoleFunction Business");
            }

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

            RoleFunctionData.Load(aRoleFunctionCollection);
        }