Пример #1
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="JobTypeCollection"/>.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aJobTypeCollection">A <see cref="JobTypeCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aJobTypeCollection</c> argument is <c>null</c>.</exception>
        public static void Load(UserKey aUserKey, JobTypeCollection aJobTypeCollection)
        {
            if (aJobTypeCollection == null)
            {
                throw new ArgumentNullException("Load JobType Business");
            }

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

            JobTypeData.Load(aJobTypeCollection);
        }
Пример #2
0
        public static List<JobType> AjaxJbtCollection()
        {
            if (ServerSession.GetUserToken(HttpContext.Current.Session) == null)
            {
                setUserToken();
            }
            UserToken vUserToken = new UserToken();
            vUserToken.AssignFromSource(ServerSession.GetUserToken(HttpContext.Current.Session));

            JobTypeCollection vJobTypeCollection = new JobTypeCollection();
            UserServiceConsumer.GetJobTypeCollection(vUserToken, vJobTypeCollection);

            return vJobTypeCollection.JobTypeList;
        }
Пример #3
0
 /// <summary>
 ///   Gets a specified <see cref="JobTypeCollection"/>.
 /// </summary>
 /// <param name="aUserToken">A <see cref="UserToken"/> object used for Access Control.</param>
 /// <param name="aJobTypeCollection"><see cref="JobType"/>Collection object.</param>
 public static void GetJobTypeCollection(UserToken aUserToken, JobTypeCollection aJobTypeCollection)
 {
     UserCallHandler.ServiceCall<JobTypeCollection>(aUserToken, "GetJobTypeCollection", aJobTypeCollection);
 }
Пример #4
0
 /// <summary>
 ///   The <c>GetJobTypeCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="JobTypeCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="JobTypeBusiness"/> with the newly deserialized <see cref="JobTypeCollection"/> 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="JobTypeCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetJobTypeCollection(UserKey aUserKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetJobTypeCollection");
     }
     JobTypeCollection vJobTypeCollection = new JobTypeCollection();
     vJobTypeCollection = XmlUtils.Deserialize<JobTypeCollection>(aXmlArgument);
     JobTypeBusiness.Load(aUserKey, vJobTypeCollection);
     return XmlUtils.Serialize<JobTypeCollection>(vJobTypeCollection, true);
 }
Пример #5
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>JobTypeList</c> property a <see cref="JobTypeCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="JobType"/>, filtered by the filter properties of the passed <see cref="JobTypeCollection"/>.
 /// </summary>
 /// <param name="aJobTypeCollection">The <see cref="JobTypeCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="JobTypeCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aJobTypeCollection</c> argument is <c>null</c>.</exception>
 public static void Load(JobTypeCollection aJobTypeCollection)
 {
     if (aJobTypeCollection == null)
     {
         throw new ArgumentNullException("aJobTypeCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(false);
         vStringBuilder.AppendLine("order by JBT_Type");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vJobType = new JobType();
                 DataToObject(vJobType, vSqlDataReader, false);
                 aJobTypeCollection.JobTypeList.Add(vJobType);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }