Esempio n. 1
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>RoleList</c> property a <see cref="RoleCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="Role"/>, filtered by the filter properties of the passed <see cref="RoleCollection"/>.
 /// </summary>
 /// <param name="aRoleCollection">The <see cref="RoleCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="RoleCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aRoleCollection</c> argument is <c>null</c>.</exception>
 public static void Load(RoleCollection aRoleCollection)
 {
     if (aRoleCollection == null)
     {
         throw new ArgumentNullException("aRoleCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aRoleCollection.IsFiltered)
         {
         }
         vStringBuilder.AppendLine("order by t1.ROL_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vRole = new Role();
                 DataToObject(vRole, vSqlDataReader);
                 aRoleCollection.RoleList.Add(vRole);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Esempio n. 2
0
        /// <summary>
        ///   The <c>GetRoleCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="RoleCollection"/> object.
        ///   It invokes the <c>Insert</c> method of <see cref="RoleBusiness"/> with the newly deserialized <see cref="RoleCollection"/> 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="RoleCollection"/> as XML <see cref="string"/>.</returns>
        /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
        public static string GetRoleCollection(FanKey aFanKey, string aXmlArgument)
        {
            if (aXmlArgument == null)
            {
                throw new ArgumentNullException("aXmlArgument of GetRoleCollection");
            }
            RoleCollection vRoleCollection = new RoleCollection();

            vRoleCollection = XmlUtils.Deserialize <RoleCollection>(aXmlArgument);
            RoleBusiness.Load(aFanKey, vRoleCollection);
            return(XmlUtils.Serialize <RoleCollection>(vRoleCollection, true));
        }
Esempio n. 3
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="RoleCollection"/>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aRoleCollection">A <see cref="RoleCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aRoleCollection</c> argument is <c>null</c>.</exception>
        public static void Load(FanKey aFanKey, RoleCollection aRoleCollection)
        {
            if (aRoleCollection == null)
            {
                throw new ArgumentNullException("Load Role Business");
            }

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

            RoleData.Load(aRoleCollection);
        }
Esempio n. 4
0
 /// <summary>
 ///   Gets a specified <see cref="RoleCollection"/>.
 /// </summary>
 /// <param name="aRoleCollection"><see cref="Role"/>Collection object.</param>
 /// <param name="aUserToken">A user token.</param>
 public static void GetRoleCollection(UserToken aUserToken, RoleCollection aRoleCollection)
 {
     UserCallHandler.ServiceCall<RoleCollection>(aUserToken, "GetRoleCollection", aRoleCollection);
 }
Esempio n. 5
0
        /// <summary>
        ///   The overloaded Load method that will fill the <c>RoleList</c> property a <see cref="RoleCollection"/> object as an
        ///   ordered <c>List</c> of <see cref="Role"/>, filtered by the filter properties of the passed <see cref="RoleCollection"/>.
        /// </summary>
        /// <param name="aRoleCollection">The <see cref="RoleCollection"/> object that must be filled.</param>
        /// <remarks>
        ///   The filter properties of the <see cref="RoleCollection"/> must be correctly completed by the calling application.
        /// </remarks>
        /// <exception cref="ArgumentNullException">If <c>aRoleCollection</c> argument is <c>null</c>.</exception>
        public static void Load(RoleCollection aRoleCollection)
        {
            if (aRoleCollection == null)
            {
                throw new ArgumentNullException("aRoleCollection");
            }
            using (var vSqlCommand = new SqlCommand()
            {
                CommandType = CommandType.Text,
                Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
            })
            {
                var vStringBuilder = BuildSQL();
                if (aRoleCollection.IsFiltered)
                {

                }
                vStringBuilder.AppendLine("order by t1.ROL_Name");
                vSqlCommand.CommandText = vStringBuilder.ToString();
                vSqlCommand.Connection.Open();
                using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
                {
                    while (vSqlDataReader.Read())
                    {
                        var vRole = new Role();
                        DataToObject(vRole, vSqlDataReader);
                        aRoleCollection.RoleList.Add(vRole);
                    }
                    vSqlDataReader.Close();
                }
                vSqlCommand.Connection.Close();
            }
        }
Esempio n. 6
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="RoleCollection"/>.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aRoleCollection">A <see cref="RoleCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aRoleCollection</c> argument is <c>null</c>.</exception>
        public static void Load(UserKey aUserKey, RoleCollection aRoleCollection)
        {
            if (aRoleCollection == null)
            {
                throw new ArgumentNullException("Load Role Business");
            }

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

            RoleData.Load(aRoleCollection);
        }
Esempio n. 7
0
 /// <summary>
 ///   Gets a specified <see cref="RoleCollection"/>.
 /// </summary>
 /// <param name="aRoleCollection"><see cref="Role"/>Collection object.</param>
 /// <param name="aUserToken">A user token.</param>
 public static void GetRoleCollection(UserToken aUserToken, RoleCollection aRoleCollection)
 {
     UserCallHandler.ServiceCall <RoleCollection>(aUserToken, "GetRoleCollection", aRoleCollection);
 }
Esempio n. 8
0
 /// <summary>
 ///   The <c>GetRoleCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="RoleCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="RoleBusiness"/> with the newly deserialized <see cref="RoleCollection"/> 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="RoleCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetRoleCollection(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetRoleCollection");
     }
     RoleCollection vRoleCollection = new RoleCollection();
     vRoleCollection = XmlUtils.Deserialize<RoleCollection>(aXmlArgument);
     RoleBusiness.Load(aFanKey, vRoleCollection);
     return XmlUtils.Serialize<RoleCollection>(vRoleCollection, true);
 }
Esempio n. 9
0
 /// <summary>
 ///   Gets a specified <see cref="RoleCollection"/>.
 /// </summary>
 /// <param name="aRoleCollection"><see cref="Role"/>Collection object.</param>
 /// <param name="aFanToken">A fantoken.</param>
 public static void GetRoleCollection(FanToken aFanToken, RoleCollection aRoleCollection)
 {
     FanCallHandler.ServiceCall <RoleCollection>(aFanToken, "GetRoleCollection", aRoleCollection);
 }
Esempio n. 10
0
 /// <summary>
 ///   Gets a specified <see cref="RoleCollection"/>.
 /// </summary>
 /// <param name="aRoleCollection"><see cref="Role"/>Collection object.</param>
 /// <param name="aFanToken">A fantoken.</param>
 public static void GetRoleCollection(FanToken aFanToken, RoleCollection aRoleCollection)
 {
     FanCallHandler.ServiceCall<RoleCollection>(aFanToken, "GetRoleCollection", aRoleCollection);
 }