/// <summary> /// The overloaded Load method that will return a <see cref="ContributorLanguageCollection"/>. /// </summary> /// <param name="aUserKey">A <see cref="UserKey"/> object.</param> /// <param name="aContributorLanguageCollection">A <see cref="ContributorLanguageCollection"/> object.</param> /// <exception cref="ArgumentNullException">If <c>aContributorLanguageCollection</c> argument is <c>null</c>.</exception> public static void Load(UserKey aUserKey, ContributorLanguageCollection aContributorLanguageCollection) { if (aContributorLanguageCollection == null) { throw new ArgumentNullException("Load ContributorLanguage Business"); } //if (!UserFunctionAccessData.HasModeAccess(aUserKey, "ContributorLanguage", AccessMode.List)) //{ // throw new ZpAccessException("Access Denied", String.Format("{0}", aUserKey.UsrKey), AccessMode.List, "ContributorLanguage"); //} ContributorLanguageData.Load(aContributorLanguageCollection); }
/// <summary> /// Gets a specified <see cref="ContributorLanguageCollection"/>. /// </summary> /// <param name="aUserToken">A <see cref="UserToken"/> object used for Access Control.</param> /// <param name="aContributorLanguageCollection"><see cref="ContributorLanguage"/>Collection object.</param> public static void GetContributorLanguageCollection(UserToken aUserToken, ContributorLanguageCollection aContributorLanguageCollection) { UserCallHandler.ServiceCall<ContributorLanguageCollection>(aUserToken, "GetContributorLanguageCollection", aContributorLanguageCollection); }
/// <summary> /// The <c>GetContributorLanguageCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="ContributorLanguageCollection"/> object. /// It invokes the <c>Insert</c> method of <see cref="ContributorLanguageBusiness"/> with the newly deserialized <see cref="ContributorLanguageCollection"/> 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="ContributorLanguageCollection"/> as XML <see cref="string"/>.</returns> /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception> public static string GetContributorLanguageCollection(UserKey aUserKey, string aXmlArgument) { if (aXmlArgument == null) { throw new ArgumentNullException("aXmlArgument of GetContributorLanguageCollection"); } ContributorLanguageCollection vContributorLanguageCollection = new ContributorLanguageCollection(); vContributorLanguageCollection = XmlUtils.Deserialize<ContributorLanguageCollection>(aXmlArgument); ContributorLanguageBusiness.Load(aUserKey, vContributorLanguageCollection); return XmlUtils.Serialize<ContributorLanguageCollection>(vContributorLanguageCollection, true); }
/// <summary> /// The overloaded Load method that will fill the <c>ContributorLanguageList</c> property a <see cref="ContributorLanguageCollection"/> object as an /// ordered <c>List</c> of <see cref="ContributorLanguage"/>, filtered by the filter properties of the passed <see cref="ContributorLanguageCollection"/>. /// </summary> /// <param name="aContributorLanguageCollection">The <see cref="ContributorLanguageCollection"/> object that must be filled.</param> /// <remarks> /// The filter properties of the <see cref="ContributorLanguageCollection"/> must be correctly completed by the calling application. /// </remarks> /// <exception cref="ArgumentNullException">If <c>aContributorLanguageCollection</c> argument is <c>null</c>.</exception> public static void Load(ContributorLanguageCollection aContributorLanguageCollection) { if (aContributorLanguageCollection == null) { throw new ArgumentNullException("aContributorLanguageCollection"); } using (var vSqlCommand = new SqlCommand() { CommandType = CommandType.Text, Connection = new SqlConnection(Connection.Instance.SqlConnectionString) }) { var vStringBuilder = BuildSQL(); if (aContributorLanguageCollection.ContributorLanguageFilter.IsFiltered) { if (aContributorLanguageCollection.ContributorLanguageFilter.ContributorKeyFilter > 0) { vStringBuilder.AppendLine("and contributorlanguage.CON_Key = @CONKey"); vSqlCommand.Parameters.AddWithValue("@CONKey", aContributorLanguageCollection.ContributorLanguageFilter.ContributorKeyFilter); } if (aContributorLanguageCollection.ContributorLanguageFilter.ContributorKeyFilter > 0) { vStringBuilder.AppendLine("and contributorlanguage.LAN_Key = @LANKey"); vSqlCommand.Parameters.AddWithValue("@LANKey", aContributorLanguageCollection.ContributorLanguageFilter.LanguageKeyFilter); } } vStringBuilder.AppendLine("order by LAN_Name"); vSqlCommand.CommandText = vStringBuilder.ToString(); vSqlCommand.Connection.Open(); using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader()) { while (vSqlDataReader.Read()) { var vContributorLanguage = new ContributorLanguage(); DataToObject(vContributorLanguage, vSqlDataReader); aContributorLanguageCollection.ContributorLanguageList.Add(vContributorLanguage); } vSqlDataReader.Close(); } vSqlCommand.Connection.Close(); } }