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

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

            ContributorData.Load(aContributorCollection);
        }
예제 #2
0
 /// <summary>
 ///   Gets a specified <see cref="ContributorCollection"/>.
 /// </summary>
 /// <param name="aUserToken">A <see cref="UserToken"/> object used for Access Control.</param>
 /// <param name="aContributorCollection"><see cref="Contributor"/>Collection object.</param>
 public static void GetContributorCollection(UserToken aUserToken, ContributorCollection aContributorCollection)
 {
     UserCallHandler.ServiceCall<ContributorCollection>(aUserToken, "GetContributorCollection", aContributorCollection);
 }
예제 #3
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>ContributorList</c> property a <see cref="ContributorCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="Contributor"/>, filtered by the filter properties of the passed <see cref="ContributorCollection"/>.
 /// </summary>
 /// <param name="aContributorCollection">The <see cref="ContributorCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="ContributorCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aContributorCollection</c> argument is <c>null</c>.</exception>
 public static void Load(ContributorCollection aContributorCollection)
 {
     if (aContributorCollection == null)
     {
         throw new ArgumentNullException("aContributorCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aContributorCollection.ContributorFilter.IsFiltered)
         {
             vStringBuilder.AppendLine("     , CTL_ContributorLanguage t2");
             vStringBuilder.AppendLine("where  t1.CON_Key = t2.CON_Key");
             vStringBuilder.AppendLine("and    t2.LAN_Key = @LANKEY");
             vStringBuilder.AppendLine("and    t2.CTL_Rating >= @CTLRating");
             vSqlCommand.Parameters.AddWithValue("@LANKEY", aContributorCollection.ContributorFilter.LanguageFilter);
             vSqlCommand.Parameters.AddWithValue("@CTLRating", aContributorCollection.ContributorFilter.RatingFilter);
             vStringBuilder.AppendLine("order by t2.CTL_Rating");
         }
         else
         {
             vStringBuilder.AppendLine("order by t1.CON_Surname");
         }
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vContributor = new Contributor();
                 DataToObject(vContributor, vSqlDataReader, false);
                 aContributorCollection.ContributorList.Add(vContributor);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
예제 #4
0
 /// <summary>
 ///   The <c>GetContributorCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="ContributorCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="ContributorBusiness"/> with the newly deserialized <see cref="ContributorCollection"/> 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="ContributorCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetContributorCollection(UserKey aUserKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetContributorCollection");
     }
     ContributorCollection vContributorCollection = new ContributorCollection();
     vContributorCollection = XmlUtils.Deserialize<ContributorCollection>(aXmlArgument);
     ContributorBusiness.Load(aUserKey, vContributorCollection);
     return XmlUtils.Serialize<ContributorCollection>(vContributorCollection, true);
 }
예제 #5
0
        public static List<Contributor> AjaxConLanCollection()
        {
            if (ServerSession.GetUserToken(HttpContext.Current.Session) == null)
            {
                setUserToken();
            }
            UserToken vUserToken = new UserToken();
            vUserToken.AssignFromSource(ServerSession.GetUserToken(HttpContext.Current.Session));

            ContributorCollection vContributorCollection = new ContributorCollection();
            UserServiceConsumer.GetContributorCollection(vUserToken, vContributorCollection);

            foreach (Contributor vContributor in vContributorCollection.ContributorList)
            {
                LanguageCollection vLanguageCollection = new LanguageCollection();
                UserServiceConsumer.GetLanguageCollection(vUserToken, vLanguageCollection);
                foreach (Language vLanguage in vLanguageCollection.LanguageList)
                {
                    vContributor.children.Add(vLanguage);
                }

                vContributor.value = vContributor.children.Count();
            }
            return vContributorCollection.ContributorList;
        }