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

            vFanRoleCollection = XmlUtils.Deserialize <FanRoleCollection>(aXmlArgument);
            FanRoleBusiness.Load(aFanKey, vFanRoleCollection);
            return(XmlUtils.Serialize <FanRoleCollection>(vFanRoleCollection, true));
        }
コード例 #2
0
ファイル: FanRoleBusiness.cs プロジェクト: heinschulie/zfit
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="FanRoleCollection"/>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aFanRoleCollection">A <see cref="FanRoleCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aFanRoleCollection</c> argument is <c>null</c>.</exception>
        public static void Load(FanKey aFanKey, FanRoleCollection aFanRoleCollection)
        {
            if (aFanRoleCollection == null)
            {
                throw new ArgumentNullException("Load FanRole Business");
            }

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

            FanRoleData.Load(aFanRoleCollection);
        }
コード例 #3
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FanRoleList</c> property a <see cref="FanRoleCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="FanRole"/>, filtered by the filter properties of the passed <see cref="FanRoleCollection"/>.
 /// </summary>
 /// <param name="aFanRoleCollection">The <see cref="FanRoleCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FanRoleCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFanRoleCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FanRoleCollection aFanRoleCollection)
 {
     if (aFanRoleCollection == null)
     {
         throw new ArgumentNullException("aFanRoleCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aFanRoleCollection.IsFiltered)
         {
             if (aFanRoleCollection.FanKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t1.FAN_Key = @FANKey");
                 vSqlCommand.Parameters.AddWithValue("@FANKey", aFanRoleCollection.FanKeyFilter);
             }
         }
         vStringBuilder.AppendLine("order by t2.FRL_Key");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFanRole = new FanRole();
                 DataToObject(vFanRole, vSqlDataReader);
                 aFanRoleCollection.FanRoleList.Add(vFanRole);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
コード例 #4
0
ファイル: FanImplementation.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   The <c>GetFanRoleCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="FanRoleCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="FanRoleBusiness"/> with the newly deserialized <see cref="FanRoleCollection"/> 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="FanRoleCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetFanRoleCollection(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetFanRoleCollection");
     }
     FanRoleCollection vFanRoleCollection = new FanRoleCollection();
     vFanRoleCollection = XmlUtils.Deserialize<FanRoleCollection>(aXmlArgument);
     FanRoleBusiness.Load(aFanKey, vFanRoleCollection);
     return XmlUtils.Serialize<FanRoleCollection>(vFanRoleCollection, true);
 }
コード例 #5
0
ファイル: FanRoleBusiness.cs プロジェクト: heinschulie/zfit
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="FanRoleCollection"/>.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aFanRoleCollection">A <see cref="FanRoleCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aFanRoleCollection</c> argument is <c>null</c>.</exception>
        public static void Load(UserKey aUserKey, FanRoleCollection aFanRoleCollection)
        {
            if (aFanRoleCollection == null)
            {
                throw new ArgumentNullException("Load FanRole Business");
            }

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

            FanRoleData.Load(aFanRoleCollection);
        }
コード例 #6
0
ファイル: FanRoleData.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FanRoleList</c> property a <see cref="FanRoleCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="FanRole"/>, filtered by the filter properties of the passed <see cref="FanRoleCollection"/>.
 /// </summary>
 /// <param name="aFanRoleCollection">The <see cref="FanRoleCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FanRoleCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFanRoleCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FanRoleCollection aFanRoleCollection)
 {
     if (aFanRoleCollection == null)
     {
         throw new ArgumentNullException("aFanRoleCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aFanRoleCollection.IsFiltered)
         {
             if (aFanRoleCollection.FanKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t1.FAN_Key = @FANKey");
                 vSqlCommand.Parameters.AddWithValue("@FANKey", aFanRoleCollection.FanKeyFilter);
             }
         }
         vStringBuilder.AppendLine("order by t2.FRL_Key");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFanRole = new FanRole();
                 DataToObject(vFanRole, vSqlDataReader);
                 aFanRoleCollection.FanRoleList.Add(vFanRole);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }