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 }
public void createNote() { int reasonkey = 1; //Create the authentication header, initialize with credentials, and //create the service proxy. For details, see the API Developer's //Guide and the Reference Library CHM. Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var customersConfiguration = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(ah); //Instanstiate and initialize a ValidAddress object. //For a description of each property, see the API Reference Library CHM. Note new_note = new Note(); new_note.CategoryId = 1; //new_note.CategoryKey = "ADMINPOS"; new_note.CompletionStageId = 1; //new_note.CompletionStageKey = NoteCompletionStage.ENTITY_ID.ToString(); new_note.Body = "tes notes dari huda"; new_note.CustomerId = 35153; Note the_new_note = customersConfiguration.CreateNote(new_note, 0); Console.WriteLine("note created. ID = {0}", the_new_note.Id); Console.ReadLine(); }
public void updateDeviceStatus(string serial_number, int reason_id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl(var_auth.var_url_asm); var whService = AsmRepository.AllServices.GetLogisticsService(authHeader); var prodcService = AsmRepository.AllServices.GetProductCatalogConfigurationService(authHeader); IDevicesService deviceService = AsmRepository.AllServices.GetDevicesService(authHeader); int return_status = 0; try { Device device = deviceService.GetDeviceBySerialNumber(serial_number); if (device != null) { deviceService.UpdateDeviceStatus(device.Id.Value, reason_id); //return_status = 1; Console.WriteLine("device id = " + device.Id, "serial number = " + device.SerialNumber); } else { //return_status = 0; Console.WriteLine("Can't find device with serial number : " + serial_number); } } catch (Exception ex) { //return null; Console.WriteLine("Errors : " + ex.Message); Console.WriteLine("Stack : " + ex.StackTrace); } }
public void transferDevice(int reason183, int to_stockhandler_id, string sn) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl(var_auth.var_url_asm); var whService = AsmRepository.AllServices.GetLogisticsService(authHeader); var prodcService = AsmRepository.AllServices.GetProductCatalogConfigurationService(authHeader); var deviceService = AsmRepository.AllServices.GetDevicesService(authHeader); try { BuildList bl = new BuildList(); bl.TransactionType = BuildListTransactionType.TransferToAnotherStockHandler; bl.Reason = reason183; bl.StockHandlerId = to_stockhandler_id; // Create build list var nbl = deviceService.CreateBuildList(bl); // Add device to build list deviceService.AddDeviceToBuildListManually(nbl.Id.Value, sn); // Perform build list var bl1 = deviceService.PerformBuildListAction(nbl.Id.Value); } catch (Exception ex) { Console.WriteLine("Errors : " + ex.Message); Console.WriteLine("Stack : " + ex.StackTrace); } }
public WorkOrder CompleteWorkOrder(WorkOrder wo_param, int reason_param, string work_desc_param, string action_taken, int completion_reason_id_param) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl(var_auth.var_url_asm); WorkOrder ww = null; var woService = AsmRepository.AllServices.GetWorkforceService(authHeader); var wo = AsmRepository.AllServices.GetWorkforceService(authHeader).GetWorkOrder(wo_param.Id.Value); try { string temp_work_description = wo_param.ProblemDescription; string temp_action_taken = wo_param.ActionTaken; wo.ProblemDescription = temp_work_description + "#" + work_desc_param; wo.ActionTaken = temp_action_taken + "#" + action_taken; wo.CompletedDateTime = DateTime.Now; wo.ReasonKey = 99470; ww = woService.CompleteWorkOrder(wo, 99470); return(ww); } catch (Exception ex) { msg = "Exceptions : " + ex.Message + " Stack : " + ex.StackTrace; Console.WriteLine(msg); } // Console.WriteLine(msg); return(ww); }
public int find_geodefinition(string param_postal_code) { int var_geodefid = 0; Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://192.168.177.4/asm/all/servicelocation.svc"); var customersConfigurationService = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersConfigurationService>(ah); var customersService = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(ah); //Instantiate a request object GeoDefinitionCriteria criteria = new GeoDefinitionCriteria(); //If you know the customer's address ID, you can replace "481" with the addressId //and use the returned address to populate the address criteria. //Address address = customersService.GetAddress(param_serv_addr_id); //If your GeoDefinitions are configured on address details, and if you do not //know the customer's addressId, set FindByFullAddressDetails to True and //enter the address details. //criteria.FindByFullAddressDetails = true; //criteria.CountryId = 1; //criteria.Province = 1; //criteria.BigCity = "LOS ANGELES"; //criteria.SmallCity = null; //criteria.PostalCode = "95BH1"; //criteria.Street = "VINE ST"; //If your GeoDefinitions are configured on postal code, and if you do not //know the customer's addressId, set FindByPostalCode to True and //enter the postal code. criteria.FindByPostalCode = true; criteria.PostalCode = param_postal_code; //Get the GeoDefinition for the address. There should be only one. //If there are more than one, then there is an error in the GeoDefinition //configuration. GeoDefinitionCollection collection = customersConfigurationService.FindGeoDefinitions(criteria); //Display the results. if (collection != null && collection.Items.Count > 0) { foreach (var item in collection) { var_geodefid = item.Id.Value; //Console.WriteLine("GeoDefId {0} <==> geolocation {1}", item.Id, item.GeoLocations); } return(var_geodefid); } else { return(0); //Console.WriteLine("I found nothing."); } //Console.ReadLine(); }
public void getServiceProvider(WorkOrder wo) { #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 custService = AsmRepository.AllServices.GetCustomersService(ah); var custcService = AsmRepository.AllServices.GetCustomersConfigurationService(ah); var woService = AsmRepository.AllServices.GetWorkforceService(ah); #endregion try { var va = custService.GetAddress(wo.AddressId.Value); var geo = custcService.FindGeoDefinitions(new GeoDefinitionCriteria() { PostalCode = va.PostalCode }); int spid = wo.ServiceProviderId.Value; int serviceTypeId = wo.ServiceTypeId.Value; int[] geos = new int[1]; geos[0] = geo.Items[0].Id.Value; Console.WriteLine("ServiceProvider Id : " + spid + " Service Type Id : " + serviceTypeId + " GeoDef ID : " + geos[0]); // Get Service Provider Service Info var sps = woService.GetServiceProviderServicesByServiceProviderIdServiceTypeIdAndGeoDefIds( spid, serviceTypeId, geos, 0 ); foreach (var sps1 in sps.Items) { Console.WriteLine("Servoce Provider Service : " + sps1.Description + " Service Provider Id : " + sps1.ServiceProviderId + " Service Type Id " + sps1.ServiceTypeId + " Geo Group ID : " + sps1.GeoDefinitionGroupId); var timeslot = woService.GetTimeSlotsByServiceProviderServiceId(sps1.Id.Value, DateTime.Now); // print the timeslot for this service for (int i = 0; i < timeslot.Length; i++) { Console.WriteLine("Date : " + timeslot[i].Date + " Time Slot ID : " + timeslot[i].TimeSlotId + " Service Provider Service Id : " + timeslot[i].ServiceProviderServiceId + "Remain Slot : " + timeslot[i].RemainingCapacity + " Is Avaiable : " + timeslot[i].IsAvailable); } } } catch (Exception ex) { var msg = "Exceptions : " + ex.Message + " Stack : " + ex.StackTrace; Console.WriteLine(msg); } }
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(); }
public void retrieveDevice(string serial_number) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl(var_auth.var_url_asm); var devicesService = AsmRepository.GetServiceProxyCachedOrDefault <IDevicesService>(ah); string device_serial_number = serial_number; //device serial number int reason156_RetriveDevice = 99146; int reason183_Returned = 99149; int reason156_InStock = 99152; int reason156_ReturnToManufactory = 99151; int reason156_RepairedStock = 99153; int reason156_RefurbishedStock = 99154; int reason156_Damaged = 99155; int to_stockhandler_id = 1015; // the destination stocck handler of the device //var deviceh = new deviceHandler(authHeader); // First step - change to to be return updateDeviceStatus(device_serial_number, reason156_RetriveDevice); // Second step - change stock handler transferDevice(reason183_Returned, to_stockhandler_id, device_serial_number); // Third Step - option 1 : change to in stock updateDeviceStatus(device_serial_number, reason156_InStock); // Third Step - option 2 : change to repaired stock //var the_device = updateDeviceStatus(username_ad, password_ad, device_serial_number, reason156_RepairedStock); // Third Step - option 3 : change to refurbished stock //var the_device = updateDeviceStatus(username_ad, password_ad, device_serial_number, reason156_RefurbishedStock); // Third Step - option 4 : change to return to manufactory //var the_device = updateDeviceStatus(username_ad, password_ad, device_serial_number, reason156_ReturnToManufactory); // Third Step - option 5 : change to damaged //var the_device = updateDeviceStatus(username_ad, password_ad, device_serial_number, reason156_Damaged); //----------- --------------- Device devices = devicesService.GetDeviceBySerialNumber(serial_number); }
public void createValidAddress() { //Create the authentication header, initialize with credentials, and //create the service proxy. For details, see the API Developer's //Guide and the Reference Library CHM. Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var customersConfiguration = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersConfigurationService>(ah); //Instanstiate and initialize a ValidAddress object. //For a description of each property, see the API Reference Library CHM. ValidAddress validAddressParams = new ValidAddress(); validAddressParams.Active = true; validAddressParams.BigCity = "zzzzzzzz"; validAddressParams.CountryId = 1; validAddressParams.CreateDateTime = System.DateTime.Now; //To populate a CustomField, instantiate a collection, and... validAddressParams.CustomFields = new CustomFieldValueCollection(); //...note that you must use the string value of the custom field's name //to add an instance to the collection. //validAddressParams.CustomFields.Add(new CustomFieldValue ("Number of Active Outlets", "12")); validAddressParams.ExternalAddressId = 2929134; validAddressParams.SmallCity = "qqqqqqqq"; validAddressParams.ProvinceId = 2; //validAddressParams.ExternalReference = "MOR"; //validAddressParams.HouseNumberNumeric = 2982; validAddressParams.ManuallyAdded = false; validAddressParams.PostalCode = "666666"; validAddressParams.Street = "wwwwwww"; validAddressParams.UniqueAddress = false; //Call the method and display the results. ValidAddress validAddress = customersConfiguration.CreateValidAddress(validAddressParams); Console.WriteLine("Valid address created. ID = {0}", validAddress.Id); Console.ReadLine(); }
public void getValidAddress() { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var customersService = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(authHeader); var valid_address_Service = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersConfigurationService>(authHeader); #region Find customer by phone number //Instantiate a BaseQueryRequest for your filter criteria. BaseQueryRequest request = new BaseQueryRequest(); request.FilterCriteria = Op.Like("CountryId", "1"); //request.FilterCriteria = Op.Like("ProvinceId", "1"); request.FilterCriteria = Op.Like("PostalCode", "24410000"); ValidAddressCollection val_address = valid_address_Service.GetValidAddresses(request); if (val_address != null) { foreach (ValidAddress c in val_address) { Console.WriteLine("Found valid address ID {0}, countryId = {1} - provinceId = {2} - bigcity = {3} - smallcity = {4} - postalcode = {5} - street = {6}", c.Id, c.CountryId, c.ProvinceId, c.BigCity, c.SmallCity, c.PostalCode, c.Street); } } else { Console.WriteLine("Cannot find a customer with that phone number."); } Console.WriteLine("total customer = {0} ----", val_address.Count()); //You will need to enter some error handling in case there is more than //one matching customer. Console.ReadLine(); #endregion }
public WorkOrder UpdateWorkOrderWithOutTimeSlotComplete(WorkOrder wo, int reason_id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl(var_auth.var_url_asm); var woService = AsmRepository.AllServices.GetWorkforceService(authHeader); try { wo.ProblemDescription = wo.ProblemDescription + " updated by reason"; wo.ReasonKey = 99470; WorkOrder ww = woService.UpdateWorkOrder(wo, 99470); return(ww); } catch (Exception ex) { msg = "Exceptions : " + ex.Message + " Stack : " + ex.StackTrace; Console.WriteLine(msg); return(null); } }
public void GetCustomerDeviceView(int cust_id) { //Create the authentication header, initialize with credentials, and //create the service proxy. For details, see the API Developer's //Guide and the Reference Library CHM. Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl(var_auth.var_url_asm); var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(authHeader); int agreementId = 99; //In ICC, a Page contains up to 20 records. For ALL //records, set Page to 0; int page = 0; //Call the method and display the results. DevicePerAgreementDetailCollection dpads = agreementManagementService.GetDevicesPerAgreementDetail(agreementId, page); if (dpads != null && dpads.Items.Count > 0) { foreach (var d in dpads) { Console.WriteLine("Device ID = {0}; Technical Product ID = {1} ", d.DeviceId, d.TechnicalProductId); if (d.SoftwarePerAgreementDetails != null) { foreach (var s in d.SoftwarePerAgreementDetails) { Console.WriteLine("Linked to Software Technical Product ID {0}", s.TechnicalProductId); } } } } else { Console.WriteLine("This device has no DpADs."); } Console.ReadLine(); }
public int getserviceproviderservice_byserviceprovideridandgeoid(int param_serv_prov_id, int param_serv_type_id, int param_geodef_id) { int var_servprovservid = 0; Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://192.168.177.4/asm/all/servicelocation.svc"); var customersConfigurationService = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersConfigurationService>(ah); var customersService = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(ah); var aa = AsmRepository.AllServices.GetWorkforceService(ah); int[] arr1 = new int[] { param_geodef_id }; var bb = aa.GetServiceProviderServicesByServiceProviderIdServiceTypeIdAndGeoDefIds(param_serv_prov_id, param_serv_type_id, arr1, 1); foreach (var item in bb.Items) { var_servprovservid = item.Id.Value; //Console.WriteLine("serviceproviderserviceid {0} <==> ServiceProviderId {1} <==> servicetytpeid = {2}", item.Id, item.ServiceProviderId, item.ServiceTypeId); } return(var_servprovservid); }
public void getTimeslotbyPostalcode(int address_id, int service_type_id) { #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 custService = AsmRepository.AllServices.GetCustomersService(ah); var custcService = AsmRepository.AllServices.GetCustomersConfigurationService(ah); var woService = AsmRepository.AllServices.GetWorkforceService(ah); #endregion DateTime myDate = DateTime.ParseExact("2017-08-08 09:00:00", "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); var sp = woService.FindSPServiceWithGeoInfo(new FindSPServiceCriteria() { AddressId = address_id, ServiceTypeId = service_type_id, Active = true, PageSize = 100 }, 1); foreach (var serviceprovider in sp.Items) { Console.WriteLine("Service Provider Id : " + serviceprovider.ServiceProviderId + " Name : " + serviceprovider.ServiceProviderName + " Service Type Id : " + serviceprovider.ServiceTypeId + " Service ID : " + serviceprovider.ServiceId + " Geo Group Id :" + serviceprovider.GeoDefinitionGroupId); var sps = woService.GetServiceProviderServiceByServiceTypeGeoDefGroupIdandProviderId(serviceprovider.ServiceTypeId.Value, serviceprovider.GeoDefinitionGroupId.Value, serviceprovider.ServiceProviderId.Value); var timeslot = woService.GetTimeSlotsByServiceProviderServiceId(sps.Id.Value, myDate); // print the timeslot for this service for (int i = 0; i < timeslot.Length; i++) { Console.WriteLine("Date :" + timeslot[i].Date + " Time Slot ID : " + timeslot[i].TimeSlotId + " Service Provider Service Id : " + timeslot[i].ServiceProviderServiceId + "Remain Slot : " + timeslot[i].RemainingCapacity + " Is Avaiable : " + timeslot[i].IsAvailable); } } }
public void GetAddressEntityViewCollection(int cust_id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var TSService = AsmRepository.GetServiceProxyCachedOrDefault <IViewFacadeService>(ah); BaseQueryRequest request = new BaseQueryRequest(); request.FilterCriteria = new CriteriaCollection(); request.FilterCriteria.Add(new Criteria("CustomerId", cust_id)); var servicetype = TSService.GetAddressEntityViewCollection(request); if (servicetype != null) { Console.WriteLine(servicetype.Items[0].Id); } else { Console.WriteLine("kosong"); } }
public void createworkorder() { 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); var sandboxService = AsmRepository.AllServices.GetSandBoxManagerService(ah); int sandboxId = sandboxService.CreateSandbox(); int var_starting_timeslot_id = 0; int reasonKey = 14659; WorkOrder workOrder = new WorkOrder(); workOrder.AgreementId = 6420654; workOrder.CustomerId = 500038560; // 500045570 workOrder.FinancialAccountId = 4281525; workOrder.ServiceProviderId = 32958; workOrder.ServiceTypeId = 1; DateTime myDate = DateTime.ParseExact("2017-09-04 01:00:00 PM", "yyyy-MM-dd hh:mm:ss tt", CultureInfo.InvariantCulture); workOrder.ServiceDateTime = myDate; int dy = myDate.Day; int mn = myDate.Month; int yy = myDate.Year; int hh = myDate.Hour; int mm = myDate.Minute; int ss = myDate.Second; //DateTime date1 = DateTime.ParseExact(yy + "-" + mn + "-" + dy + " " + "09:00:00 AM", "yyyy-MM-dd hh:mm:ss tt", CultureInfo.InvariantCulture); //DateTime date2 = DateTime.ParseExact(yy + "-" + mn + "-" + dy + " " + "12:00:00 PM", "yyyy-MM-dd hh:mm:ss tt", CultureInfo.InvariantCulture); //DateTime date3 = DateTime.ParseExact(yy + "-" + mn + "-" + dy + " " + "01:00:00 PM", "yyyy-MM-dd hh:mm:ss tt", CultureInfo.InvariantCulture); //DateTime date4 = DateTime.ParseExact(yy + "-" + mn + "-" + dy + " " + "04:00:00 PM", "yyyy-MM-dd hh:mm:ss tt", CultureInfo.InvariantCulture); if (hh.ToString() == "09" || hh.ToString() == "9") { var_starting_timeslot_id = 1; } else if (hh.ToString() == "12") { var_starting_timeslot_id = 2; } else if (hh.ToString() == "13" || hh.ToString() == "1") { var_starting_timeslot_id = 3; } else if (hh.ToString() == "16" || hh.ToString() == "4") { var_starting_timeslot_id = 4; } //workOrder.ServiceProviderServiceId = 1; workOrder.AddressId = 10310193; int var_geodef_id = find_geodefinition("11520001"); int var_servprovserv_id = getserviceproviderservice_byserviceprovideridandgeoid(workOrder.ServiceProviderId.Value, workOrder.ServiceTypeId.Value, var_geodef_id); workOrder.ServiceProviderServiceId = var_servprovserv_id; workOrder.ProblemDescription = "Customer spilled coffee on decoder."; workOrder.SandboxSkipValidation = false; workOrder.WorkOrderServices = new WorkOrderServiceCollection { new WorkOrderService { //Required. Replace this value with a valid ID for the work order //service. ServiceId = 84, //Replace this value with the serial number of the device that needs to //be repaired. DeviceSerialNumber = "2010001019", //Replace this value with a valid Reason ID for event 62. //ReasonId = 14659, //Replace this value with how many of the services the customer needs. Quantity = 1, } }; AsmRepository.AllServices.GetCustomersService(ah).GetCustomer(workOrder.CustomerId.Value); var wo = workforceService.CreateWorkOrderWithStartingTimeslot(workOrder, new TimeSlotAllocationParameters { StartingTimeSlotId = 1 }, reasonKey); //WorkOrder wo = workforceService.CreateWorkOrder(workOrder, reasonKey); if (wo.WorkOrderServices.Items.Count == 0) { Console.WriteLine("Something bad happened. Sandbox rolled back."); Console.ReadLine(); //The "false" value in this line of code rolls back the sandbox. sandboxService.FinalizeSandbox(sandboxId, false); return; } sandboxService.FinalizeSandbox(sandboxId, true); Console.WriteLine("Congratulations! Created Work Order ID = {0}.", wo.Id); Console.WriteLine(var_starting_timeslot_id); //UpdateWorkOrderWithTimeSlot(wo, 62); Console.ReadLine(); }
public void duplicationCheck() { ICustomersService custService = null; ICustomersConfigurationService custcService = null; Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); custService = AsmRepository.AllServices.GetCustomersService(authHeader); custcService = AsmRepository.AllServices.GetCustomersConfigurationService(authHeader); var ads = custcService.GetValidAddresses(new BaseQueryRequest() { FilterCriteria = new CriteriaCollection() { new Criteria() { Key = "PostalCode", Operator = Operator.Equal, Value = "11140000" } } }); //var ads = custcService.GetCountries(new BaseQueryRequest() //{ // FilterCriteria = new CriteriaCollection() // { // new Criteria() // { // Key = "Id", // Operator = Operator.Equal, // Value = "1" // } // } //}); var findCustomers = custService.GetDuplicateCustomers(new DuplicateCustomerCriteria() { ValidAddressId = ads.Items[0].Id.Value, CustomerCaptureCategory = CustomerCaptureCategory.ResidentialCustomers, FirstName = "TEST NANA", Surname = "UAT LIVE", //HouseNumberAlpha = "123", //Extra = "chongqing", // Address Line 1 //ExtraExtra = "yuzhongqu", // Address Line 2 HomePhone = "02192554175", WorkPhone = "6281808843210", Fax1 = "045465888452", // emergency Number Fax2 = "02192554175", // Mobile Phone //CustomField1 = "aaaaa", //CustomField2 = "bbbbb", ReferenceTypeKey = 1, // ReferenceNumber = "RN123", }); foreach (var cust in findCustomers) { //Console.WriteLine("ID : "); Console.WriteLine("ID : " + cust.Id); Console.WriteLine("ID : " + cust.Id.Value + " Name% : " + cust.SimilarityOfCustomerName + " Address% : " + cust.SimilarityOfAddress + " Phone% : " + cust.SimilarityOfPhone + " RefNum% : " + cust.SimilarityOfReference); } //Console.WriteLine("ID : " ); Console.Read(); }
public void getFinancialTransactionView(int FA_id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var viewFacade = AsmRepository.GetServiceProxyCachedOrDefault <IViewFacadeService>(authHeader); #region BaseQueryRequest FilterCriteria //As of MR24, these are the properties you can use in the //BaseQueryRequest filter. Use Visual Studio's Intellisense to get the //list of properties that are valid in your version of ICC. //FinancialTransactionView f = new FinancialTransactionView //f.AmtExclTax; //f.AmtInclTax; //f.AppearedOnInvoiceNumber; //f.ApprdOnInvoiceId; //f.BankDatetime; //f.BaseAmount; //f.BusinessUnitDescription; //f.BusinessUnitId; //f.CreateDatetime; //f.CreatedByEvent; //f.CreatedByUserId; //f.CreatedByUserName; //f.CurrencyId; //f.CurrencyMnemonic; //f.CustomerId; //f.DebitOrCredit; //f.EntityId; //f.EntityType; //f.ExternalAgentId; //f.ExternalAgentName; //f.ExternalTaxAreaId; //f.ExternalTransactionId; //f.ExtraPaymentInfo; //f.FinanceBatchId; //f.FinancialAccountId; //f.HistoryId; //f.Id; //f.InternalComment; //f.InvoiceLineText; //f.InvoiceRunId; //f.IsPending; //f.LedgerAccountDescription; //f.LedgerAccountId; //f.ListPriceAmount; //f.ListPriceConditionId; //f.ListPriceTypeName; //f.MarketSegmentId; //f.MarketSegmentName; //f.ModelId; //f.NumberOfUnits; //f.OriginalAmount; //f.OriginalCurrencyId; //f.PaidForAccountId; //f.PaidForCustomerName; //f.PaidForInformation; //f.PaidForInvoiceId; //f.PaymentRefNum; //f.PeriodFrom; //f.PeriodizationRunId; //f.PeriodTo; //f.PriceAdjustDefId; //f.ProductId; //f.ReceiptNumber; //f.ReversedTransId; //f.TaxAmt1; //f.TaxAmt2; //f.TaxAmt3; //f.TaxType1; //f.TaxType2; //f.TaxType3; //f.TransactionSubType; //f.TransactionType; //f.TransferAccountId; //f.UserKey; //f.UserLocationName; #endregion //Instantiate a request object. BaseQueryRequest request = new BaseQueryRequest(); //Page 0 returns ALL matching records. Page 0 can have a major //performance impact. Use it only when you know that //the number of matching records is small. request.PageCriteria = new PageCriteria { Page = 0 }; //Instantiate the CollectionCriteria. request.FilterCriteria = new CriteriaCollection(); //In this example, we have only one criteria: //FinancialAccountId is 401. //To learn how to set selection criteria in a BaseQueryRequest, //see the code sample called Code_BaseQuery_Request.pdf. request.FilterCriteria.Add(new Criteria("FinancialAccountId", FA_id)); //Call the method. var ftViewCollection = viewFacade.GetFinancialTransactionView(request); //Display the results, one screenful at a time. if (ftViewCollection != null && ftViewCollection.Items.Count > 0) { foreach (FinancialTransactionView f in ftViewCollection.Items) { #region Pause after a screenful of records //This snippet pauses when the screen is full. When the user presses //Enter, the screen clears and another screenful of records is loaded. //if (Console.WindowHeight == Console.CursorTop) //{ // Console.WriteLine("Press Enter for another screen of records."); // Console.ReadLine(); // Console.Clear(); //} #endregion Console.WriteLine("Found FT {0}, total amount = {1}", f.Id, f.AmtInclTax); } } else { Console.WriteLine("I found nothing."); } Console.ReadLine(); }
public WorkOrder UpdateWorkOrderWithTimeSlot(WorkOrder wo, int reasonid) { WorkOrder wou = null; Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var custService = AsmRepository.AllServices.GetCustomersService(authHeader); var custcService = AsmRepository.AllServices.GetCustomersConfigurationService(authHeader); var woService = AsmRepository.AllServices.GetWorkforceService(authHeader); var wocService = AsmRepository.AllServices.GetWorkforceConfigurationService(authHeader); try { TimeSlotDescription[] timeslots = null; var va = custService.GetAddress(wo.AddressId.Value); var geo = custcService.FindGeoDefinitions(new GeoDefinitionCriteria() { PostalCode = va.PostalCode }); int spid = wo.ServiceProviderId.Value; int serviceTypeId = wo.ServiceTypeId.Value; int[] geos = new int[1]; geos[0] = geo.Items[0].Id.Value; // Get Service Provider Service Info var sps = woService.GetServiceProviderServicesByServiceProviderIdServiceTypeIdAndGeoDefIds( spid, serviceTypeId, geos, 0 ); // Get all avaiable timeslot foreach (var sps1 in sps.Items) { timeslots = woService.GetTimeSlotsByServiceProviderServiceId(sps1.Id.Value, DateTime.Now); } if (timeslots == null) { Console.WriteLine("No avaiable time slot , please check the setting! work order id : " + wo.Id.Value); return(null); } else { // Here, i used the first avaiable time slot. For MNC, please use the timeslot that the CSR choose. It is better pass TimeSlotDescription as input parameter wou = woService.UpdateWorkOrderWithStartingTimeslot(wo, new TimeSlotAllocationParameters { StartingTimeSlotId = timeslots[0].TimeSlotId.Value, AllocationOverrideType = TimeSlotAllocationOverrideType.Capacity, ServiceDate = wo.ServiceDateTime, // ServiceProviderServiceId = timeslots[0].ServiceProviderServiceId.Value }, reasonid); } } catch (Exception ex) { msg = "Exceptions : " + ex.Message + " Stack : " + ex.StackTrace; Console.WriteLine(msg); } msg = "Work Order " + wo.Id + " Updated by using reason id : " + reasonid; Console.WriteLine(msg); return(wou); }
public void getAgreementDetail() { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var m_IAgreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(authHeader); var viewService = AsmRepository.GetServiceProxy <IViewFacadeService>(authHeader); AgreementDetailCollection adc = m_IAgreementManagementService.GetAgreementDetailsForCustomer(500016733, 1); if (adc != null && adc.Items.Count > 0) { foreach (AgreementDetail a in adc.Items) { Console.WriteLine("Found product ID {0}: Status ID = {1}", a.CommercialProductId, a.Status); } } else { Console.WriteLine("I found nothing."); } var viewD = viewService.GetCustomerDeviceView(new BaseQueryRequest() { FilterCriteria = Op.Eq("CustomerId", 500016733), PageCriteria = new PageCriteria() { Page = 0, PageSize = 100 }, DeepLoad = true }); foreach (var device in viewD.Items) { // here you can call GetDeviceView to get more info, parameters are the same like above GetCustomerDeviceView , just change Op.Eq("CustomerId", customer_id) to Op,Eq("Id",device.Id.Value) Console.WriteLine("Device ID : " + device.DeviceId.Value + " Serial Number : " + device.SerialNumber + " Status : " + device.DeviceStatusName + " Model:" + device.ModelDescription); } var viewAg = viewService.GetAgreementDetailView(new BaseQueryRequest() { FilterCriteria = Op.Eq("CustomerId", 500016733), PageCriteria = new PageCriteria() { Page = 0, PageSize = 100 } }); foreach (var product in viewAg.Items) { Console.WriteLine("Agreement Detail ID : " + product.Id.Value + " Product Name :" + product.CommercialProductName + " Charge Until Date : " + product.ChargeUntilDate + " Charge Period : " + product.ChargePeriodName + " Finance Option : " + product.FinanceOptionName + " Recurring Price : " + product.RecurringListPrice + " Status :" + product.StatusName); } Console.ReadLine(); }
public void GetShippingOrderByCustomerId(int cust_id) { //Create the authentication header, initialize with credentials, and //create the service proxy. For details, see the API Developer's //Guide and the Reference Library CHM. Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); IOrderManagementService orderManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IOrderManagementService>(authHeader); BaseQueryRequest request = new BaseQueryRequest(); //Page = 0 returns a maximum of 20 records. If you want all reecords, you must //iterate through the pages. request.PageCriteria = new PageCriteria { Page = 0 }; CriteriaCollection criteria = new CriteriaCollection(); //Here is a list of properties you can search on. This list is valid as of MR22. //For property descriptions, see the API Reference Library (CHM file). //Use Intellisense for the current list of properties. //ShippingOrder so = new ShippingOrder(); //so.AgreementId; //so.Comment; //so.CreateDateTime; //so.CustomerId; //so.CustomFields.Add; //so.Destination; //so.FinancialAccountId; //so.FullyReceiveReturnedOrder; //so.Id; //so.IgnoreAgreementId; //so.OldStatusId; //so.ParentOrderId; //so.ReceivedQuantity; //so.Reference; //so.ReturnedQuantity; //so.SandboxId; //so.SandboxSkipValidation; //so.ShipByDate; //so.ShipFromStockHandlerId; //so.ShippedDate; //so.ShippedQuantity; //so.ShippingMethodId; //so.ShippingOrderLines.Add; //so.ShipToAddressId; //so.ShipToPartyId; //so.ShipToPostalCode; //so.StatusId; //so.TotalQuantity; //so.TrackingNumbers; //so.TypeId; //By default, the search uses a logical AND between search criteria. //Use || to perform a logical OR. criteria.Add("CustomerId", cust_id); request.FilterCriteria = criteria; ShippingOrderCollection soc = orderManagementService.GetShippingOrders(request); if (soc != null && soc.Items.Count > 0) { foreach (ShippingOrder shippingOrder in soc.Items) { Console.WriteLine("Found Shipping Order ID: {0}", shippingOrder.Id); } } else { Console.WriteLine("No records found."); } Console.ReadLine(); }