コード例 #1
0
        public void getWorkOrderByCustomerId()
        {
            #region Authenticate and create proxies
            Authentication_class var_auth = new Authentication_class();
            AuthenticationHeader ah       = var_auth.getAuthentication_header();
            AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc");
            var workforceService = AsmRepository.GetServiceProxyCachedOrDefault <IWorkforceService>(ah);
            #endregion
            //Instantiate the request object and define filter criteria
            //GetWorkOrdersRequest implements the BaseQueryRequest, so you can filter, sort,
            //and page the returned records.
            //You can use the properties of WorkOrder to filter and sort.
            GetWorkOrdersRequest request = new GetWorkOrdersRequest();
            request.FilterCriteria.Add("CustomerId", 16190);
            request.FilterCriteria.Add("WorkOrderStatusId", 1);
            #region Get the customer's work orders and display the results.
            WorkOrderCollection coll = workforceService.GetWorkOrders(request);

            if (coll != null && coll.Items.Count > 0)
            {
                foreach (WorkOrder w in coll)
                {
                    Console.WriteLine("Found Work Order ID = {0}; Create Date = {1}", w.Id, w.RegisteredDateTime);
                }
            }
            else
            {
                Console.WriteLine("Sorry--No work orders found.");
            }
            Console.ReadLine();
            #endregion
        }
コード例 #2
0
        public void getWorkOrderUpdateWorkOrder()
        {
            #region Authenticate and create proxies
            Authentication_class var_auth = new Authentication_class();
            AuthenticationHeader ah       = var_auth.getAuthentication_header();
            AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc");
            var workforceService = AsmRepository.GetServiceProxyCachedOrDefault <IWorkforceService>(ah);
            #endregion
            //Instantiate the request object and define filter criteria
            //GetWorkOrdersRequest implements the BaseQueryRequest, so you can filter, sort,
            //and page the returned records.
            //You can use the properties of WorkOrder to filter and sort.
            GetWorkOrdersRequest request = new GetWorkOrdersRequest();
            request.FilterCriteria.Add("CustomerId", 16190);
            request.FilterCriteria.Add("WorkOrderStatusId", 1);
            #region Get the customer's work orders and display the results.
            WorkOrderCollection coll = workforceService.GetWorkOrders(request);

            if (coll != null && coll.Items.Count > 0)
            {
                foreach (WorkOrder w in coll)
                {
                    Console.WriteLine("Found Work Order ID = {0}; Create Date = {1}", w.Id, w.RegisteredDateTime);
                }
            }
            else
            {
                Console.WriteLine("Sorry--No work orders found.");
            }
            Console.ReadLine();
            #endregion
            //Now, instantiate a new WorkOrder and call GetWorkOrder to populate it with the
            // values of the work order you want to change.

            //"1333" is the ID of the work order you want to change.
            WorkOrder workOrder = workforceService.GetWorkOrder(1333);
            //Pass in the values you want to change.
            //workOrder.ServiceProviderId = 32086;
            //workOrder.AddressId = 1215;
            workOrder.ProblemDescription = "bbbbbbbbbbbbbbbbbbbbbbb";


            //"0" is the default reason. ICC throws an error if a default reason is not configured.
            //int reasonKey = 0;
            int reasonKey = 12; // for update problem description field
            //Call UpdateWorkOrder to update the work order and display the results.
            WorkOrder updatedWorkOrder = workforceService.UpdateWorkOrder(workOrder, reasonKey);
            Console.WriteLine("Updated WorkOrder ID {0}; Service Provider ID = {1}", updatedWorkOrder.Id, updatedWorkOrder.ServiceProviderId);
            Console.ReadLine();
        }