示例#1
0
        public static List<Language> AjaxLanCollection()
        {
            if (ServerSession.GetUserToken(HttpContext.Current.Session) == null)
            {
                setUserToken();
            }
            UserToken vUserToken = new UserToken();
            vUserToken.AssignFromSource(ServerSession.GetUserToken(HttpContext.Current.Session));

            LanguageCollection vLanguageCollection = new LanguageCollection();
            UserServiceConsumer.GetLanguageCollection(vUserToken, vLanguageCollection);

            return vLanguageCollection.LanguageList;
        }
示例#2
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="LanguageCollection"/>.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aLanguageCollection">A <see cref="LanguageCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aLanguageCollection</c> argument is <c>null</c>.</exception>
        public static void Load(UserKey aUserKey, LanguageCollection aLanguageCollection)
        {
            if (aLanguageCollection == null)
            {
                throw new ArgumentNullException("Load Language Business");
            }

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

            LanguageData.Load(aLanguageCollection);
        }
示例#3
0
 /// <summary>
 ///   Gets a specified <see cref="LanguageCollection"/>.
 /// </summary>
 /// <param name="aUserToken">A <see cref="UserToken"/> object used for Access Control.</param>
 /// <param name="aLanguageCollection"><see cref="Language"/>Collection object.</param>
 public static void GetLanguageCollection(UserToken aUserToken, LanguageCollection aLanguageCollection)
 {
     UserCallHandler.ServiceCall<LanguageCollection>(aUserToken, "GetLanguageCollection", aLanguageCollection);
 }
示例#4
0
 /// <summary>
 ///   The <c>GetLanguageCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="LanguageCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="LanguageBusiness"/> with the newly deserialized <see cref="LanguageCollection"/> 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="LanguageCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetLanguageCollection(UserKey aUserKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetLanguageCollection");
     }
     LanguageCollection vLanguageCollection = new LanguageCollection();
     vLanguageCollection = XmlUtils.Deserialize<LanguageCollection>(aXmlArgument);
     LanguageBusiness.Load(aUserKey, vLanguageCollection);
     return XmlUtils.Serialize<LanguageCollection>(vLanguageCollection, 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;
        }
示例#6
0
        /// <summary>
        ///   The overloaded Load method that will fill the <c>LanguageList</c> property a <see cref="LanguageCollection"/> object as an
        ///   ordered <c>List</c> of <see cref="Language"/>, filtered by the filter properties of the passed <see cref="LanguageCollection"/>.
        /// </summary>
        /// <param name="aLanguageCollection">The <see cref="LanguageCollection"/> object that must be filled.</param>
        /// <remarks>
        ///   The filter properties of the <see cref="LanguageCollection"/> must be correctly completed by the calling application.
        /// </remarks>
        /// <exception cref="ArgumentNullException">If <c>aLanguageCollection</c> argument is <c>null</c>.</exception>
        public static void Load(LanguageCollection aLanguageCollection)
        {
            if (aLanguageCollection == null)
            {
                throw new ArgumentNullException("aLanguageCollection");
            }
            using (var vSqlCommand = new SqlCommand()
            {
                CommandType = CommandType.Text,
                Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
            })
            {
                var vStringBuilder = BuildSQL();

                vStringBuilder.AppendLine("order by t1.LAN_Name");
                vSqlCommand.CommandText = vStringBuilder.ToString();
                vSqlCommand.Connection.Open();
                using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
                {
                    while (vSqlDataReader.Read())
                    {
                        var vLanguage = new Language();
                        DataToObject(vLanguage, vSqlDataReader);
                        aLanguageCollection.LanguageList.Add(vLanguage);
                    }
                    vSqlDataReader.Close();
                }
                vSqlCommand.Connection.Close();
            }
        }