Example #1
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="UserCollection"/>.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aUserCollection">A <see cref="UserCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aUserCollection</c> argument is <c>null</c>.</exception>
        public static void Load(UserKey aUserKey, UserCollection aUserCollection)
        {
            if (aUserCollection == null)
            {
                throw new ArgumentNullException("Load User Business");
            }

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

            UserData.Load(aUserCollection);
        }
Example #2
0
 /// <summary>
 /// Gets a UserCollection
 /// </summary>
 /// <param name="aUserToken">A user token.</param>
 /// <param name="aUserCollection">A user collection.</param>
 public static void GetUserCollection(UserToken aUserToken, UserCollection aUserCollection)
 {
     UserCallHandler.ServiceCall<UserCollection>(aUserToken, "GetUserCollection", aUserCollection);
 }
Example #3
0
 /// <summary>
 ///   The <c>GetUserCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="UserCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="UserBusiness"/> with the newly deserialized <see cref="UserCollection"/> 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="UserCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetUserCollection(UserKey aUserKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetUserCollection");
     }
     UserCollection vUserCollection = new UserCollection();
     vUserCollection = XmlUtils.Deserialize<UserCollection>(aXmlArgument);
     UserBusiness.Load(aUserKey, vUserCollection);
     return XmlUtils.Serialize<UserCollection>(vUserCollection, true);
 }
Example #4
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>UserList</c> property a <see cref="UserCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="User"/>, filtered by the filter properties of the passed <see cref="UserCollection"/>.
 /// </summary>
 /// <param name="aUserCollection">The <see cref="UserCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="UserCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aUserCollection</c> argument is <c>null</c>.</exception>
 public static void Load(UserCollection aUserCollection)
 {
     if (aUserCollection == null)
     {
         throw new ArgumentNullException("aUserCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(false);
         if (aUserCollection.IsFiltered)
         {
             vStringBuilder.AppendLine("where t1.USR_WebContact = 'Y'");
         }
         vStringBuilder.AppendLine("order by t1.USR_ID");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vUser = new User();
                 DataToObject(vUser, vSqlDataReader, false);
                 aUserCollection.UserList.Add(vUser);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }