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 HttpResponseMessage GetAgreementByTypeId(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); IViewFacadeService viewFacadeService = AsmRepository.GetServiceProxyCachedOrDefault <IViewFacadeService>(ah); BaseQueryRequest request = new BaseQueryRequest(); request.FilterCriteria = new CriteriaCollection(); //Agreement type is a user-configured property. The value in //this key-value pair is the agreement type ID. You can get this //value from the Configuration Module or from a call to //the AgreementManagementConfigurationService. request.FilterCriteria.Add(new Criteria("TypeId", id)); AgreementViewCollection coll = viewFacadeService.GetAgreementView(request); if (coll != null) { return(Request.CreateResponse(HttpStatusCode.OK, coll)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public HttpResponseMessage getDeviceinAgreementDetailByCustId(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah); var viewService = AsmRepository.GetServiceProxy <IViewFacadeService>(ah); var viewD = viewService.GetCustomerDeviceView(new BaseQueryRequest() { FilterCriteria = Op.Eq("CustomerId", id), PageCriteria = new PageCriteria() { Page = 0, PageSize = 100 }, DeepLoad = true }); if (viewD != null) { return(Request.CreateResponse(HttpStatusCode.OK, viewD)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
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 HttpResponseMessage GetSoftwareProduct(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah); //This value is the customer's ID number. int customerId = id; //In ICC, a Page can hold up to 20 records. Page = 0 returns ALL records. int page = 0; //Call the method and display the results. var agreements = agreementManagementService.GetSoftwareForAgreementDetailById(2912043); if (agreements != null) { return(Request.CreateResponse(HttpStatusCode.OK, agreements)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public HttpResponseMessage CreateNote([FromBody] CreateNoteParams created_data) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(created_data.username_ad, created_data.password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); 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 = created_data.the_categoryId; //1 //new_note.CategoryKey = "ADMINPOS"; new_note.CompletionStageId = created_data.the_completionStageId; //1 //new_note.CompletionStageKey = NoteCompletionStage.ENTITY_ID.ToString(); new_note.Body = created_data.the_body_note; new_note.CustomerId = created_data.the_customerId; Note the_new_note = customersConfiguration.CreateNote(new_note, 0); if (the_new_note != null) { return(Request.CreateResponse(HttpStatusCode.OK, the_new_note)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public HttpResponseMessage GetLedgerAccounts(String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var financeConfigurationService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceConfigurationService>(ah); //Instantiate a request object and its FilterCriteria LedgerAccountQueryRequest request = new LedgerAccountQueryRequest(); request.FilterCriteria = new CriteriaCollection(); //Populate the FilterCriteria, using In operator to perform an "Or" query. //request.FilterCriteria.Add(new Criteria("LedgerAccountCode", "U2001", Operator.In)); //request.FilterCriteria.Add(new Criteria("LedgerAccountCode", "RU2001", Operator.In)); //request.FilterCriteria.Add(new Criteria("LedgerAccountCode", "P9500", Operator.In)); //request.FilterCriteria.Add(new Criteria("LedgerAccountCode", "RP9500", Operator.In)); request.FilterCriteria.Add(new Criteria("IconId", "", Operator.Like)); //Call the method. LedgerAccountCollection collection = financeConfigurationService.GetLedgerAccounts(request); //Display the results. if (collection != null && collection.Items.Count > 0) { return(Request.CreateResponse(HttpStatusCode.OK, collection)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public HttpResponseMessage GetDeviceById(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var devicesService = AsmRepository.GetServiceProxyCachedOrDefault <IDevicesService>(authHeader); //var provinces = devicesService.GetDeviceById(id); //parameter id Device devices = devicesService.GetDeviceById(id); //List<string> list = new List<string>(); //list.Add("deviceId"); list.Add(devices.Id.ToString()); //list.Add("SerialNumber"); list.Add(devices.SerialNumber); //list.Add("Shidate"); list.Add(devices.ShipDate.ToString()); //list.Add("StatusId"); list.Add(devices.StatusId.ToString()); //list.Add("ModelId"); list.Add(devices.ModelId.ToString()); //list.Add("BigCarReferenceNumber"); list.Add(devices.BigCAReferenceNumber); if (devices != null) { return(Request.CreateResponse(HttpStatusCode.OK, devices)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } //return devices; }
public HttpResponseMessage GetServiceTypeById(String username_ad, String password_ad, int id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var TSService = AsmRepository.GetServiceProxyCachedOrDefault <IWorkforceConfigurationService>(ah); BaseQueryRequest request = new BaseQueryRequest(); request.FilterCriteria = new CriteriaCollection(); request.FilterCriteria.Add(new Criteria("Id", id)); ServiceTypeCollection servicetype = TSService.GetServiceTypeList(request); if (servicetype != null) { return(Request.CreateResponse(HttpStatusCode.OK, servicetype)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public QuoteInvoiceCollection GetQuoteByCustomerId(String username_ad, String password_ad, int id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var billingService = AsmRepository.GetServiceProxyCachedOrDefault <IBillingEngineService>(ah); var financeService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceService>(ah); var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah); #region Step 1 //First, get Pending quotes to check their QuoteDates. //Instantiate a class for the request. BaseQueryRequest req = new BaseQueryRequest(); req.FilterCriteria = new CriteriaCollection(); //Define the selection criteria. //Replace 73948 with the CustomerId of the customer you want. req.FilterCriteria.Add("CustomerId", id); //Get the customer's QuoteInvoices. QuoteInvoiceCollection qts = billingService.FindQuoteInvoices(req); if (qts != null && qts.Items.Count > 0) { return(qts); //foreach (var q in qts) //{ // Console.WriteLine("Customer ID {0}: QuoteDate = {1} QuoteInvoice ID = {2}", // q.CustomerId, q.QuoteDate, q.Id); // Console.WriteLine("Quote amount = {0} Quote type = {1}", // q.TotalAmount, q.QuoteType); // //If the QuoteDate < Today, then regenerate the quote. // if (q.QuoteDate < System.DateTime.Today) // { // QuoteInvoiceRequest request = new QuoteInvoiceRequest(); // request.QuoteId = q.Id; // //If Save = True, ICC saves the QuoteInvoice. // //To get the quote info but not commit it to the database, // //set the flag to False. This is useful when // //you only want to know what the customer would pay next // //period, but you don't want to create the quote. // request.Save = true; // //Regenerate the quote to save Today's quote info. // QuoteInvoiceResponse response = billingService.RegenerateQuoteInvoice(request); // Console.WriteLine("New quote generated. ID = {0}; Amount = {1}", // response.NewQuoteInvoice.Id, response.NewQuoteInvoice.TotalAmount); // } // else // { // Console.WriteLine("Customer's quotes are up-to-date."); // } //} } else { return(null); } #endregion step 1 }
public HttpResponseMessage AddDeposit(String username_ad, String password_ad, int customer_id, int deposite_amount) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var customersService = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(authHeader); var financeService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceService>(authHeader); var financeConfigurationService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceConfigurationService>(authHeader); var fa = financeService.GetFinancialAccountsForCustomer(customer_id, new CriteriaCollection() { new Criteria() { Key = "TypeId", Operator = Operator.Equal, Value = "1" // 1 means quote billing financial account } }, 0); if (fa.TotalCount == 0) { //Console.WriteLine("There are no finanical account on customer with id : " + customer_id); return(null); } CreateManualAdjustmentFTsResult the_result = financeService.CreateManualAdjustmentFTs(new CreateManualAdjustmentFTsRequest() { FinancialTransactions = new FinancialTransactionCollection() { new FinancialTransaction() { BaseAmount = deposite_amount, Comment = "This is deposit for Testing!", CurrencyId = 1, CreatedByEvent = 500, LedgerAccountId = 416, FinancialAccountId = fa.Items[0].Id.Value, PeriodFrom = DateTime.Now, PeriodTo = DateTime.Now.AddDays(90) } } }); if (the_result != null) { return(Request.CreateResponse(HttpStatusCode.OK, the_result)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public int GetAgreementByTypeId(String username_ad, String password_ad, int productId, int amount, String dt) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var priceServce = AsmRepository.AllServices.GetPricingService(ah); var agService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah); int listprice_condition_id = 0; var listprice_conditions = agService.GetAgreementDetailWithPricing(productId); DateTime myDate = DateTime.ParseExact(dt, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); if (listprice_conditions.PricingInfoCollection.Items.Count > 0) { listprice_condition_id = listprice_conditions.PricingInfoCollection.Items[0].ListPriceConditionId.Value; return(listprice_condition_id); } else { //Console.WriteLine("There are no pirce found on this product, please check your configuraitons! agreement detail id : " + agreement_detail_id); return(0); } var priceOverride = priceServce.GetPriceOverridesByListPriceConditionId(listprice_condition_id, (int)Entities.AgreementDetail, productId, 0); if (priceOverride.Items.Count == 0) { priceServce.CreatePriceOverride(new PriceOverride() { Amount = amount, CurrencyId = 1, ListPriceConditionId = listprice_condition_id, EntityId = productId, EntityType = (int)Entities.AgreementDetail, OverrideType = PayMedia.ApplicationServices.Pricing.ServiceContracts.OverrideTypes.FixedPrice, Recurring = true, //OverrideInvoiceText = "New Price from 2017-5-16" }, 0); } else { priceOverride.Items[0].Amount = amount; if (myDate < DateTime.Now) { priceServce.UpdatePriceOverride(priceOverride.Items[0], 0); } else { priceServce.ScheduleUpdatePriceOverride(priceOverride.Items[0], myDate, 0); } } }
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 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 Device retrieveDevice(String username_ad, String password_ad, string serial_number) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); 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(username_ad, password_ad, device_serial_number, reason156_RetriveDevice); // Second step - change stock handler transferDevice(username_ad, password_ad, reason183_Returned, to_stockhandler_id, device_serial_number); // Third Step - option 1 : change to in stock updateDeviceStatus(username_ad, password_ad, 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); return(devices); }
public List <ServiceProviderCollection> GetServiceProviders(String username_ad, String password_ad) { //HttpContext.Current.Server.ScriptTimeout = 300; Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var sp_Service = AsmRepository.GetServiceProxyCachedOrDefault <IWorkforceService>(authHeader); int i = 0; int ada = 0; int total_data = 0; List <ServiceProviderCollection> initialList = new List <ServiceProviderCollection>(); #region get service provider do { var serv_providers = sp_Service.GetServiceProviders(i); if (serv_providers.Items.Capacity > 0) { ada = 1; initialList.Add(serv_providers); total_data = total_data + serv_providers.Count(); i++; //Console.WriteLine("total sp = {0} ----", serv_providers.Count()); } else if (serv_providers.Items.Capacity == 0) { ada = 0; //Console.WriteLine("end of program"); break; } else { return(null); //Console.WriteLine("Cannot find a sp."); } } while (ada != 0); return(initialList); //Console.WriteLine("total data = {0} ----", total_data); #endregion }
public TimeSlotAvailability GetTimeSlotInfoWithServProvIdParams([FromBody] TimeSlotParams time_slot_param) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(time_slot_param.username_ad, time_slot_param.password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); IWorkforceService woService = AsmRepository.AllServices.GetWorkforceService(ah); ICustomersService customerService = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(ah); DateTime dt = DateTime.ParseExact(time_slot_param.Date, "yyyy-MM-dd", CultureInfo.InvariantCulture); Customer cust = new Customer(); cust = customerService.GetCustomer(time_slot_param.customer_id); var sp = woService.FindSPServiceWithGeoInfo(new FindSPServiceCriteria() { AddressId = time_slot_param.serv_addr_id, ServiceTypeId = time_slot_param.serv_type_id, ServiceProviderId = time_slot_param.serv_prov_id, Active = true, PageSize = 100 }, 1); TimeSlotAvailability var_timeslotAvailability = new TimeSlotAvailability(); var var_timeslotAvailabilityItem = new List <TimeSlotAvailabilityItem>(); foreach (SPServiceWithGeoInfo serviceprovider in sp.Items) { var sps = woService.GetServiceProviderServiceByServiceTypeGeoDefGroupIdandProviderId(serviceprovider.ServiceTypeId.Value, serviceprovider.GeoDefinitionGroupId.Value, serviceprovider.ServiceProviderId.Value); TimeSlotDescription[] timeslot = woService.GetTimeSlotsByServiceProviderServiceId(sps.Id.Value, dt); // print the timeslot for this service var_timeslotAvailabilityItem.Add(new TimeSlotAvailabilityItem() { the_SPServiceWithGeoInfo = serviceprovider, the_timeslot = timeslot }); } var_timeslotAvailability.TimeItemsData = var_timeslotAvailabilityItem; return(var_timeslotAvailability); }
public HttpResponseMessage getAgreementDetailByCustId(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah); AgreementDetailCollection adc = agreementManagementService.GetAgreementDetailsForCustomer(id, 1); if (adc != null) { return(Request.CreateResponse(HttpStatusCode.OK, adc)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
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 HttpResponseMessage GetValidAddressById(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var customersConfiguration = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersConfigurationService>(authHeader); int val_addr_id = id; ValidAddress var_valid_addr = customersConfiguration.GetValidAddress(val_addr_id); if (var_valid_addr != null) { return(Request.CreateResponse(HttpStatusCode.OK, var_valid_addr)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
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 HttpResponseMessage GetFinancialAccountById(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var financeService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceService>(authHeader); int financialAccountId = id; FinancialAccount financialAccount = financeService.GetFinancialAccount(financialAccountId); if (financialAccount != null) { return(Request.CreateResponse(HttpStatusCode.OK, financialAccount)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
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 HttpResponseMessage GetShippingOrderByCustomerId(String username_ad, String password_ad, int id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var TSService = AsmRepository.GetServiceProxyCachedOrDefault <IOrderManagementService>(ah); var servicetype = TSService.GetShippedOrders(id, 1); if (servicetype != null) { return(Request.CreateResponse(HttpStatusCode.OK, servicetype)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
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 StockHandlerCollection GetStockHandlerByActiveStatus(String username_ad, String password_ad, int id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var TSService = AsmRepository.GetServiceProxyCachedOrDefault <ILogisticsService>(ah); BaseQueryRequest request = new BaseQueryRequest(); request.FilterCriteria = new CriteriaCollection(); request.FilterCriteria.Add(new Criteria("Active", id)); var servicetype = TSService.GetStockHandlers(request); if (servicetype != null) { return(servicetype); } else { return(null); } }
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 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 HttpResponseMessage GetCommercialProduct(String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var productCatalogConfigurationService = AsmRepository.GetServiceProxyCachedOrDefault <IProductCatalogConfigurationService>(ah); //As of MR26, these are the properties you can use in the BaseQueryRequest. //Use Visual Studio's Intellisense function or see the API Reference Library //for the latest properties and descriptions. //CommercialProduct c = new CommercialProduct(); //c.AgreementDetailSpearId; //c.AllowedBusinessUnits; //c.AllowedDisconnectSettings; //c.AllowedEventsId; //c.AllowedForPurchasedOfferDefinition; //c.AllowedMarketSegmentIds; //c.AllowedModels; //c.AllowedPaymentType; //c.AllowIndefiniteSleep; //c.AllowQtyToBeUpdated; //c.AllowRedistributeFunds; //c.AllowSleep; //c.ApplyRemainingFunds; //c.AreDevicesPresent; //c.Availability; //c.AvailableDate; //c.BusinessUnitId; //c.CAEntitlements; //c.CaptureRuleId; //c.CategoryId; //c.CategoryWeight; //c.ChargeForUnderlyingTP; //c.CommercialProductIds; //c.ContractPeriodIdToOverrideOnAD; //c.DefaultChargePeriod; //c.DefaultDisconnectionSetting; //c.DefaultFinanceOptionId; //c.DefaultPaymentType; //c.Description; //c.EditRulesId; //c.EPCMappings; //c.ExcludedCommercialProducts; //c.ExternalId; //c.ExternalProductCodeId; //c.Hyperlink; //c.IconId; //c.Id; //c.InvoiceLineTexts; //c.IsServiceContract; //c.IsShippingOrderProduct; //c.IsStockHandlerOrderProduct; //c.IsUnitOfMeasurementRequired; //c.MatchQuantity; //c.MaxSleepDays; //c.MinSleepDays; //c.Name; //c.Notes; //c.OverrideCAEntitlements; //c.PrepaidRequiredBalance; //c.PrepaidRequiredBalanceReconnect; //c.RequiredCommercialProducts; //c.SellFrom; //c.SellTo; //c.TaxExternalProductCodeId; //c.TechnicalProductIds; //c.TechnicalProducts; //c.Terms; //c.UnitOfMeasurementId; //c.UsersRoles; //Instantiate and initialize the filter criteria (key-value pairs) //for the BaseQueryRequest object. BaseQueryRequest request = new BaseQueryRequest(); CriteriaCollection criteria = new CriteriaCollection(); //request.FilterCriteria.Add(new Criteria("ExternalId", 92591)); request.FilterCriteria.Add(new Criteria("IconId", "")); //Call the method and display the results. CommercialProductCollection coll = productCatalogConfigurationService.GetCommercialProducts(request); if (coll != null) { return(Request.CreateResponse(HttpStatusCode.OK, coll)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public HttpResponseMessage doPaymentWithFulfillQuote(String username_ad, String password_ad, int customer_id, int deposite_amount, string merchant_bank) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var customersService = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(authHeader); var financeService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceService>(authHeader); var financeConfigurationService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceConfigurationService>(authHeader); var fa = financeService.GetFinancialAccountsForCustomer(customer_id, new CriteriaCollection() { new Criteria() { Key = "TypeId", Operator = Operator.Equal, Value = "1" // 1 means quote billing financial account } }, 0); if (fa.TotalCount == 0) { //Console.WriteLine("There are no finanical account on customer with id : " + customerid); return(null); } int ledgerid = 3; //3 means that customer do payment int faid = fa.Items[0].Id.Value; int userid = 1; // You should use your login user id(ICC User ID) to replace this number var cu = customersService.GetCustomerWithoutCustomFields(customer_id); int businessunitid = cu.BusinessUnitId.Value; SHA1 sha = new SHA1CryptoServiceProvider(); FinancialTransactionCollection ft = financeService.CreatePaymentTransactions(new FinancialTransactionCollection() { new FinancialTransaction() { //CreatedByUserId=userid, CustomerId = customer_id, BusinessUnitId = businessunitid, LedgerAccountId = ledgerid, FinancialAccountId = faid, CreatedByEvent = 514, //for customer payment with fullfill quote //CreatedByEvent = 500, //for manual debit or credit //CreatedByEvent = 515, //for manual payment without fullfill quote //PaidForInvoice = , BaseAmount = deposite_amount, //FinanceBatchCode = "Payment Mode : Cash", //ThirdPartyTransactionDescription = "Cheque # :123", ThirdPartyTransactionDescription = merchant_bank, //ExtraPaymentInfo = "Transfer Mode :/Cheque Bank : /Payment By : ", BankDate = DateTime.Now, // Cheque Date //PaymentReferenceNumber = "Reference Number : 12456", //UniqueTransactionId = sha.ComputeHash(Encoding.ASCII.GetBytes("Reference Number : 124567")), Comment = "", Extended = "", //TransactionType = FinancialTransactionTypes.Payment, //TransactionSubType = FinancialTransactionSubtypes.AccountsReceivable } }, PaymentReceiptNumberingMethod.Automatic); //return ft; if (ft != null) { return(Request.CreateResponse(HttpStatusCode.OK, ft)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }