예제 #1
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);
        }
예제 #2
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);
 }
예제 #3
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(UserKey aUserKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetRoleCollection");
     }
     RoleCollection vRoleCollection = new RoleCollection();
     vRoleCollection = XmlUtils.Deserialize<RoleCollection>(aXmlArgument);
     RoleBusiness.Load(aUserKey, vRoleCollection);
     return XmlUtils.Serialize<RoleCollection>(vRoleCollection, true);
 }
예제 #4
0
파일: RoleData.cs 프로젝트: heinschulie/z2z
        /// <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();
            }
        }