public void addItemRecord() { NetSuiteService service = new NetSuiteService(); service.CookieContainer = new CookieContainer(); NetsuiteUser user = new NetsuiteUser("3451682", "*****@*****.**", "1026", "tridenT168"); Passport passport = user.prepare(user); Status status = service.login(passport).status; string itemName = this.ItemName; SearchStringField objItemName = new SearchStringField(); objItemName.searchValue = itemName; objItemName.@operator = SearchStringFieldOperator.@is; objItemName.operatorSpecified = true; ItemSearch objItemSearch = new ItemSearch(); objItemSearch.basic = new ItemSearchBasic(); objItemSearch.basic.itemId = objItemName; SearchPreferences searchPreferences = new SearchPreferences(); searchPreferences.bodyFieldsOnly = false; service.searchPreferences = searchPreferences; SearchResult objItemResult = service.search(objItemSearch); if (objItemResult.status.isSuccess != true) throw new Exception("Cannot find Item " + itemName + " " + objItemResult.status.statusDetail[0].message); if (objItemResult.recordList.Count() != 1) throw new Exception("More than one item found for item " + itemName); InventoryItem iRecord = new InventoryItem(); iRecord = ((InventoryItem)objItemResult.recordList[0]); this.itemRecord = new InventoryItem(); this.itemRecord=iRecord; }
internal void Configure(INetSuiteService service, SearchPreferences searchPref) { service.Timeout = System.Threading.Timeout.Infinite; service.Url = EndPointUrl; service.preferences = Preferences; service.searchPreferences = searchPref ?? SearchPreferences; if (service.CookieContainer == null) { service.CookieContainer = new System.Net.CookieContainer(); } if (service.applicationInfo != null) { service.applicationInfo.applicationId = ApplicationId; } else if (ApplicationId != null) { service.applicationInfo = new ApplicationInfo() { applicationId = ApplicationId }; } }
/// <summary>Retrieves the additional pages of records returned for the given search.</summary> /// <param name="searchId">The ID of the search.</param> /// <param name="pageIndex">Index of the page.</param> /// <param name="bodyFieldsOnly">Whether the search should return body fields only.</param> /// <returns>The records pertaining to specified search results page.</returns> public SearchResult SearchMoreWithId(string searchId, int pageIndex, bool bodyFieldsOnly) { SearchPreferences searchPref = Configuration.SearchPreferences.Duplicate(); searchPref.bodyFieldsOnly = bodyFieldsOnly; return(SearchMoreWithId(searchId, pageIndex, searchPref)); }
/// <summary> /// Searches the specified search. /// </summary> /// <param name="search">The search.</param> /// <param name="returnSearchColumns"> /// if set to <c>true</c> returns Search Columns rather than entity records. /// </param> /// <returns>The search result.</returns> public override SearchResult Search(SearchRecord search, bool returnSearchColumns) { SearchPreferences searchPref = Configuration.SearchPreferences.Duplicate(); searchPref.returnSearchColumns = returnSearchColumns; return(Search(search, searchPref)); }
/// <summary>Retrieves the additional pages of records returned for the given search.</summary> /// <param name="searchId">The ID of the search.</param> /// <param name="pageIndex">Index of the page.</param> /// <param name="searchPrefs">Preference settings for the current search.</param> /// <returns>The records pertaining to specified search results page.</returns> public SearchResult SearchMoreWithId(string searchId, int pageIndex, SearchPreferences searchPrefs) { return(InvokeService <SearchResult> ( new object[] { searchId, pageIndex }, "searchMoreWithId", searchPrefs )); }
/// <summary>Invokes the remote method using the specified parameters and settings.</summary> /// <param name="arg">Method arguments</param> /// <param name="method">Name of the remote method to execute.</param> /// <param name="searchPrefs">Search Preference settings.</param> /// <returns>Result of the web service.</returns> internal override T InvokeService <T>(object arg, string method, SearchPreferences searchPrefs) { lock (ServiceProxy) { Configuration.Configure(ServiceProxy, searchPrefs); T result = null; MethodInfo mi = ServiceProxy.GetType().GetMethod(method); ParameterInfo[] parameters = mi.GetParameters(); Func <object, T> invokerFunc = GetInvokerFunction <T>(mi, parameters); ServiceInvocationEventArgs invokerEventArgs = new ServiceInvocationEventArgs(method, arg); for (; invokerEventArgs.InvokationAttempt < Configuration.RetryCount; invokerEventArgs.InvokationAttempt++) { ServiceProxy.passport = Credentials.GetPassport(); OnBeforeServiceInvocation(invokerEventArgs); if (!invokerEventArgs.Cancel && this.IsSuspended) { throw new WebservicesLockdownException(); } else if (invokerEventArgs.Cancel) { break; } else if (_log.IsDebugEnabled && parameters.Length == 0) { LogInvocationMeaningfully(invokerEventArgs.MethodName); } else if (_log.IsDebugEnabled) { LogInvocationMeaningfully(invokerEventArgs.MethodName, invokerEventArgs.Arguments); } bool retry; result = TryInvokeService <T>(invokerFunc, invokerEventArgs, out retry); if (!retry) { break; } } if (invokerEventArgs.InvokationAttempt == Configuration.RetryCount) // Retry count was exhausted.. { invokerEventArgs.Exception = new RetryCountExhaustedException("Operation Failed", invokerEventArgs.Exception); OnServiceInvocationError(invokerEventArgs); throw invokerEventArgs.Exception; } return(result); } }
public void Set_Search_preferences_Return_Deals_to_show_on_map_that_matches() { var repository = new FakeRepository(); SearchPreferences sP = new SearchPreferences { Area = "Temple Bar", PriceMax = "No max", PropertyType = "Pub" }; // It has to return three results var results = repository.SearchResults(sP); // It has to return three results var actual = results.GetSearchListSearchResult.Count(); var expected = 3;//number of deals that match the search preferences Assert.AreEqual(expected, actual); }
/// <summary> /// Retrieves a page from a Search originally executed using the <paramref name="session"/> token. /// </summary> /// <param name="pageIndex">Index of the result page to be retrieved.</param> /// <param name="prefs">Preference settings to be used for the search.</param> /// <param name="session">The search session.</param> /// <returns>Results on the specified page.</returns> public SearchResult SearchMore(int pageIndex, SearchPreferences prefs, SearchSession session) { try { SearchResult result = session.ServiceManager.SearchMoreWithId(session.SearchId, pageIndex, prefs); session.SearchId = result.searchId; session.PageIndex = result.pageIndex; return(result); } catch (Exception ex) { _log.Error(ex.ToString()); throw new NsException(ex); } }
public ActionResult SearchDeal(SearchPreferences searchPreferences) { if (ModelState.IsValid) { var results = _repository.SearchResults(searchPreferences); //to avoid losing data in case you refresh the browser on next page. Using Tempdata you can lose them it Session["PubsToShowOnMap"] = results; //TempData["results"] = results; return(RedirectToAction("ShowResultsOnMap", "PubDeals")); } return(View()); }
/// <summary> /// Initializes a new instance of the <see cref="NetSuiteServiceConfiguration"/> class. /// </summary> public NetSuiteServiceConfiguration() { AddRequestSize = 10; DeleteRequestSize = 10; UpdateRequestSize = 10; RetryCount = 3; RetryInterval = 5; SearchPreferences = new SearchPreferences(); SearchPreferences.pageSize = 1000; SearchPreferences.pageSizeSpecified = true; SearchPreferences.bodyFieldsOnly = false; Preferences = new Preferences(); EndPointUrl = Settings.Default.ServiceManager_SuiteTalk_NetSuiteService; }
public static TinderProfile UpdateSearchPreferences(Guid token, Gender gender, int minAge, int maxAge, int radius) { SearchPreferences pref = new SearchPreferences() { age_filter_max = maxAge, age_filter_min = minAge, distance_filter = radius, Gender = (int)gender }; if (pref.Validate()) { return(UpdateSearchPreferences(token, pref)); } else { return(null); } }
/// <summary> /// Invokes the Web Service. /// </summary> /// <param name="arg">Argument(s) to be passed on to the remote method.</param> /// <param name="method">The remote method to be invoked.</param> /// <param name="prefs">Search preferences</param> /// <returns>The result of the WebService call.</returns> /// <remarks>When invoking a remote method that accepts multiple parameters, you should /// provide an <see cref="System.Object"/> array as <paramref name="arg"/>.</remarks> internal override T InvokeService <T>(object arg, string method, SearchPreferences prefs) { IServiceManager svcMgr = null; ServiceInvocationEventArgs invokerArgs = new ServiceInvocationEventArgs(method, arg); try { OnBeforeServiceInvocation(invokerArgs); svcMgr = ServicePoolManager.GetServiceManager(); T result; if (svcMgr is NetSuiteServiceManager) { result = ((NetSuiteServiceManager)svcMgr).InvokeService <T>(arg, method, prefs); } else { result = null; } ServicePoolManager.ReleaseServiceManager(svcMgr); svcMgr = null; invokerArgs.Result = result; OnAfterServiceInvocation(invokerArgs); return(result); } catch (Exception ex) { _log.Error(ex.ToString()); invokerArgs.Exception = ex; OnServiceInvocationError(invokerArgs); throw new NsException(ex); } finally { if (svcMgr != null) { ServicePoolManager.ReleaseServiceManager(svcMgr); } } }
public static async Task <Profile> ChangeSearchPreferences(this TinderClient client, SearchPreferences pref) { var url = ProfileEndpoint; var response = await new RestClient(url, client.XAuthToken).Post <Profile>(new { user = pref }); return(response); }
/// <summary> /// Searches NetSuite using the specified search parameters. /// </summary> /// <param name="searchRec">The search parameter.</param> /// <param name="prefs">The search preferences.</param> /// <returns>Results of the search.</returns> public override SearchResult Search(SearchRecord searchRec, SearchPreferences prefs) { return(InvokeService <SearchResult>(searchRec, "search", prefs)); }
public virtual async Task <SearchResult> searchAsync(SearchRecord searchRecord, SearchPreferences searchPreferences) { var originalPreferences = this.searchPreferences; this.searchPreferences = searchPreferences; var result = await this.searchAsync(searchRecord); this.searchPreferences = originalPreferences; return(result); }
public void itemFulfillmentSearch(string orderNumber) { NetSuiteService service = new NetSuiteService(); service.CookieContainer = new CookieContainer(); NetsuiteUser user = new NetsuiteUser("3451682", "*****@*****.**", "1026", "tridenT168"); Passport passport = user.prepare(user); Status status = service.login(passport).status; TransactionSearchAdvanced tranSearchAdvanced = new TransactionSearchAdvanced(); TransactionSearch tranSearch = new TransactionSearch(); SearchStringField orderID = new SearchStringField(); orderID.@operator = SearchStringFieldOperator.@is; orderID.operatorSpecified = true; orderID.searchValue = orderNumber; TransactionSearchBasic tranSearchBasic = new TransactionSearchBasic(); tranSearchBasic.tranId = orderID; tranSearch.basic = tranSearchBasic; tranSearchAdvanced.criteria = tranSearch; SearchPreferences searchPreferences = new SearchPreferences(); searchPreferences.bodyFieldsOnly = false; service.searchPreferences = searchPreferences; SearchResult transactionResult = service.search(tranSearchAdvanced); if (transactionResult.status.isSuccess != true) throw new Exception("Cannot find Order " + orderNumber + " " + transactionResult.status.statusDetail[0].message); if (transactionResult.recordList.Count() != 1) throw new Exception("More than one order found for item " + orderNumber); this.itemFulfillment = new com.netsuite.webservices.ItemFulfillment(); this.itemFulfillment = ((com.netsuite.webservices.ItemFulfillment)transactionResult.recordList[0]); }
public static TinderProfile UpdateSearchPreferences(Guid token, SearchPreferences pref) { var response = new RestMethods(TinderAPI.Profile, token).Post <TinderProfile>(pref); return(response); }
/// <summary> /// Searches using the specified search options. /// </summary> /// <param name="record">The search record.</param> /// <param name="prefs">Search Preferences</param> /// <returns>Response from the WebService.</returns> public abstract SearchResult Search(SearchRecord record, SearchPreferences prefs);
/// <summary> /// Strongly typed wrapper to the <see cref="InvokeService(object, string)"/> call. /// </summary> /// <typeparam name="T">Return type of the WebService call.</typeparam> /// <param name="arg">Argument(s) to be passed on to the remote method.</param> /// <param name="method">The remote method to be invoked.</param> /// <param name="prefs">Search Preferences to be used for this invocation.</param> /// <returns>The result of the WebService call.</returns> /// <remarks>IMPORTANT: This wrapper should not be used with remote methods that does /// not accept any parameters.</remarks> internal abstract T InvokeService <T>(object arg, string method, SearchPreferences prefs) where T : class;
public override void Get() { UnitsTypeSearch custSearch = new UnitsTypeSearch(); UnitsTypeSearchBasic custSearchBasic = new UnitsTypeSearchBasic(); custSearch.basic = custSearchBasic; Preferences prefs = new Preferences(); Service(true).preferences = prefs; prefs.warningAsErrorSpecified = true; prefs.warningAsError = false; SearchPreferences _srch_pref = new SearchPreferences(); Service().searchPreferences = _srch_pref; Service().searchPreferences.bodyFieldsOnly = false; bool bodyonly = Service().searchPreferences.bodyFieldsOnly; SearchResult response = Service().search(custSearch); if (response.totalRecords > 0) { List <UnitsOfMeasure> list = new List <UnitsOfMeasure>(); for (int i = 0; i < response.totalRecords; i++) { UnitsType cr = (UnitsType)response.recordList[i]; try { UnitsTypeUomList uomList = cr.uomList; for (int j = 0; j < uomList.uom.Length; j++) { UnitsOfMeasure entity = new UnitsOfMeasure(); entity.unit_id = Convert.ToInt32(cr.internalId); entity.details_id = Convert.ToInt32(uomList.uom[j].internalId); entity.Netsuite_Id = Convert.ToInt32(cr.internalId + uomList.uom[j].internalId); entity.InActive = cr.isInactive; entity.Name = cr.name; entity.baseUnit = uomList.uom[j].baseUnit; entity.unitName = uomList.uom[j].unitName; entity.pluralName = uomList.uom[j].pluralName; entity.abbreviation = uomList.uom[j].abbreviation; entity.pluralAbbreviation = uomList.uom[j].pluralAbbreviation; entity.conversionRate = (float)uomList.uom[j].conversionRate; list.Add(entity); } } catch (Exception ex) { throw ex; } } if (list.Count > 0) { new GenericeDAO <UnitsOfMeasure>().UnitmeasureNetSuiteIntegration(list); } } }