Beispiel #1
0
        public static List<Client> HelloWorld()
        {
            //Client vClient = new Client();
            //vClient.ClnKey = 3;
            //UserServiceConsumer.GetClient(ServerSession.GetUserToken(HttpContext.Current.Session), vClient);
            //return vClient;

            ClientCollection vClientCollection = new ClientCollection();
            UserServiceConsumer.GetClientCollection(ServerSession.GetUserToken(HttpContext.Current.Session), vClientCollection);
            return vClientCollection.ClientList;

            //return "Hello: " + DateTime.Now.Millisecond;
        }
Beispiel #2
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="ClientCollection"/>.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aClientCollection">A <see cref="ClientCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aClientCollection</c> argument is <c>null</c>.</exception>
        public static void Load(UserKey aUserKey, ClientCollection aClientCollection)
        {
            if (aClientCollection == null)
            {
                throw new ArgumentNullException("Load Client Business");
            }

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

            ClientData.Load(aClientCollection);
        }
Beispiel #3
0
        public static List<Client> AjaxClnJobCollection()
        {
            if (ServerSession.GetUserToken(HttpContext.Current.Session) == null)
            {
                setUserToken();
            }
            UserToken vUserToken = new UserToken();
            vUserToken.AssignFromSource(ServerSession.GetUserToken(HttpContext.Current.Session));

            ClientCollection vClientCollection = new ClientCollection();
            UserServiceConsumer.GetClientCollection(vUserToken, vClientCollection);

            foreach (Client vClient in vClientCollection.ClientList)
            {
                JobCollection vJobCollection = new JobCollection();
                vJobCollection.JobFilter.IsFiltered = true;
                vJobCollection.JobFilter.ClientKeyFilter = vClient.ClnKey;
                UserServiceConsumer.GetJobCollection(vUserToken, vJobCollection);
                foreach (Job vJob in vJobCollection.JobList)
                {
                    WorkItemCollection vWorkItemCollection = new WorkItemCollection();
                    vWorkItemCollection.WorkItemFilter.IsFiltered = true;
                    vWorkItemCollection.WorkItemFilter.ClientKeyFilter = vJob.ClnKey;
                    vWorkItemCollection.WorkItemFilter.JobKeyFilter = vJob.JobbKey;
                    UserServiceConsumer.GetWorkItemCollection(vUserToken, vWorkItemCollection);
                    foreach (WorkItem vWorkItem in vWorkItemCollection.WorkItemList)
                    {
                        vJob.children.Add(vWorkItem);
                    }
                    vJob.value = vJob.children.Count();
                    if (vClient.ClnKey == vJob.ClnKey)
                        vClient.children.Add(vJob);
                }
                vClient.value = vClient.children.Count();
            }
            return vClientCollection.ClientList;
        }
Beispiel #4
0
        public static List<Client> AjaxClnDocCollection()
        {
            if (ServerSession.GetUserToken(HttpContext.Current.Session) == null)
            {
                setUserToken();
            }

            ClientCollection vClientCollection = new ClientCollection();
            UserServiceConsumer.GetClientCollection(ServerSession.GetUserToken(HttpContext.Current.Session), vClientCollection);

            foreach (Client vClient in vClientCollection.ClientList)
            {
                DocumentCollection vDocumentCollection = new DocumentCollection();
                vDocumentCollection.DocumentFilter.IsFiltered = true;
                vDocumentCollection.DocumentFilter.DocumentClientKeyFilter = vClient.ClnKey;
                UserServiceConsumer.GetDocumentCollection(ServerSession.GetUserToken(HttpContext.Current.Session), vDocumentCollection);
                foreach (Document vDocument in vDocumentCollection.DocumentList)
                {
                    //if (vClient.ClnKey == vDocument.ClnKey)
                        vClient.children.Add(vDocument);
                }
            }
            return vClientCollection.ClientList;
        }
Beispiel #5
0
 /// <summary>
 ///   Gets a specified <see cref="ClientCollection"/>.
 /// </summary>
 /// <param name="aUserToken">A <see cref="UserToken"/> object used for Access Control.</param>
 /// <param name="aClientCollection"><see cref="Client"/>Collection object.</param>
 public static void GetClientCollection(UserToken aUserToken, ClientCollection aClientCollection)
 {
     UserCallHandler.ServiceCall<ClientCollection>(aUserToken, "GetClientCollection", aClientCollection);
 }
Beispiel #6
0
 /// <summary>
 ///   The <c>GetClientCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="ClientCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="ClientBusiness"/> with the newly deserialized <see cref="ClientCollection"/> 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="ClientCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetClientCollection(UserKey aUserKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetClientCollection");
     }
     ClientCollection vClientCollection = new ClientCollection();
     vClientCollection = XmlUtils.Deserialize<ClientCollection>(aXmlArgument);
     ClientBusiness.Load(aUserKey, vClientCollection);
     return XmlUtils.Serialize<ClientCollection>(vClientCollection, true);
 }
Beispiel #7
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>ClientList</c> property a <see cref="ClientCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="Client"/>, filtered by the filter properties of the passed <see cref="ClientCollection"/>.
 /// </summary>
 /// <param name="aClientCollection">The <see cref="ClientCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="ClientCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aClientCollection</c> argument is <c>null</c>.</exception>
 public static void Load(ClientCollection aClientCollection)
 {
     if (aClientCollection == null)
     {
         throw new ArgumentNullException("aClientCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(false);
         vStringBuilder.AppendLine("order by t1.CLN_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vClient = new Client();
                 DataToObject(vClient, vSqlDataReader, false);
                 aClientCollection.ClientList.Add(vClient);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }