//Prepare and send POST Request to Specified URL public async Task fn_retrieveLoginSession(string strPassword) { Boolean check = false; try { string pstrSystem = "client_" + propStrSystem.ToLower(); HTTPRestViewModel oHttpRestVm = new HTTPRestViewModel(); string function = "https://ww3.allnone.ie/client/" + pstrSystem + "/cti/userAPP_main.asp"; string strForOutput = ""; List <KeyValuePair <string, string> > listKVmyParameter = fnAddParamsToLoginPOST(strPassword, pstrSystem); strForOutput = await oHttpRestVm.RESTcalls_POST_BXPAPI(function, listKVmyParameter); if (strForOutput == "N/A") { return; } check = fn_ParseLoginXMLDocument(strForOutput, function, pstrSystem); } catch (Exception e) { e.Message.ToString(); } settingCheck = true; return; }
//Push a record into the campaign public async Task fnInjectContactRecord(string fieldToInjectSubject, string fieldToInjectContentDescription, int formToLookup) { HTTPRestViewModel ohttp = new HTTPRestViewModel(); string subjectBox = "strCDA_" + formToLookup + "_field_0_1"; string descriptionBox = "strCDA_" + formToLookup + "_field_0_2"; #region Parameters List <KeyValuePair <String, string> > parameters = new List <KeyValuePair <string, string> >(); KeyValuePair <string, string> parameter = new KeyValuePair <string, string>("strFunction", "insert_formrecord"); parameters.Add(parameter); parameter = new KeyValuePair <string, string>("strSystem", myLogin.propStrSystemUsed); parameters.Add(parameter); parameter = new KeyValuePair <string, string>("intClient_Id", myLogin.propIntClient_Id.ToString()); parameters.Add(parameter); parameter = new KeyValuePair <string, string>("strClient_SessionField", myLogin.propStrClient_SessionField); parameters.Add(parameter); parameter = new KeyValuePair <string, string>("intCampaign_Id", formToLookup.ToString()); parameters.Add(parameter); parameter = new KeyValuePair <string, string>("strSearch_Field", subjectBox + "[[--SEP--]]" + descriptionBox); parameters.Add(parameter); parameter = new KeyValuePair <string, string>("strSearch_Value", fieldToInjectSubject + "[[--SEP--]]" + fieldToInjectContentDescription); parameters.Add(parameter); parameter = new KeyValuePair <string, string>("strReturn_Fields", "intCDA_" + formToLookup + "_Id"); parameters.Add(parameter); #endregion string output = await ohttp.RESTcalls_POST_BXPAPI(myLogin.propStrFunctionURL, parameters); if (output.Contains("<intErrorId>0</intErrorId>")) { MessageDialog myMessage = new MessageDialog("Successfully added a ticket!"); await myMessage.ShowAsync(); } return; }
//Searches a refined searched based on first and Last name. private async Task fnSearchByFirstAndLastName(int formToLookup, HTTPRestViewModel oHttpRestViewModel, string searchfield, string searchValues) { #region Parameters List <KeyValuePair <string, string> > kvHttpRequestParameters = new List <KeyValuePair <string, string> >(); KeyValuePair <string, string> parameter = new KeyValuePair <string, string>("strFunction", "formlookup"); kvHttpRequestParameters.Add(parameter); parameter = new KeyValuePair <string, string>("strSystem", myLogin.propStrSystemUsed); kvHttpRequestParameters.Add(parameter); parameter = new KeyValuePair <string, string>("intClient_Id", myLogin.propIntClient_Id.ToString()); kvHttpRequestParameters.Add(parameter); parameter = new KeyValuePair <string, string>("strClient_SessionField", myLogin.propStrClient_SessionField); kvHttpRequestParameters.Add(parameter); parameter = new KeyValuePair <string, string>("intCampaign_Id", formToLookup.ToString()); kvHttpRequestParameters.Add(parameter); parameter = new KeyValuePair <string, string>("strSearch_Field", searchfield); kvHttpRequestParameters.Add(parameter); parameter = new KeyValuePair <string, string>("strSearch_Value", searchValues); kvHttpRequestParameters.Add(parameter); parameter = new KeyValuePair <string, string>("strReturn_Fields", returnField + "," + returnField2 + "," + returnField3 + "," + returnField4); kvHttpRequestParameters.Add(parameter); #endregion string output = await oHttpRestViewModel.RESTcalls_POST_BXPAPI(myLogin.propStrFunctionURL, kvHttpRequestParameters); fnParseContactXMLDocument(output); }
//POST to API URL for retieval of Hamsters public async Task fn_PostCallForHamsterXMLRetrieval() { HTTPRestViewModel oHttpClient = new HTTPRestViewModel(); Login login = Login.Instance; #region Parameters List <KeyValuePair <string, string> > colKVParams = new List <KeyValuePair <string, string> >(); addingParamsToList(login, colKVParams); #endregion fn_ParseThroughHamsterXML(await oHttpClient.RESTcalls_POST_BXPAPI(login.propStrFunctionURL, colKVParams)); }
//Send a Post request to the BXPAPP API public async Task fn_PostingToServerForDiary(string strFunctionToCall) { Login myLogin = Login.Instance; HTTPRestViewModel oHttpViewModel = new HTTPRestViewModel(); List <KeyValuePair <string, string> > listKVParameters = fn_addingPostParamsToList(strFunctionToCall, myLogin); string RESTAPIFunction = myLogin.propStrFunctionURL; if (RESTAPIFunction.Equals("N/A")) { return; } fnParsingThroughRetrievedDiary(await oHttpViewModel.RESTcalls_POST_BXPAPI(RESTAPIFunction, listKVParameters)); }
//This is for listee injection public async Task <Boolean> fn_POSTToServerInsert(string strtitle) { Login login = Login.Instance; HTTPRestViewModel oHttpViewModel = new HTTPRestViewModel(); List <KeyValuePair <string, string> > kvListOfParameters = new List <KeyValuePair <string, string> >(); fn_addingParametersForInsert(login, strtitle, kvListOfParameters); string check = await oHttpViewModel.RESTcalls_POST_BXPAPI(login.propStrFunctionURL, kvListOfParameters); if (check.Equals("N/A")) { return(false); } return(true); }
//This is for pulling down the total Set of listees. public async Task fn_POSTToServerForAllListees(string day, string strFunctionToCall) { Login login = Login.Instance; HTTPRestViewModel oHttpViewModel = new HTTPRestViewModel(); List <KeyValuePair <string, string> > kvListOfParameters = new List <KeyValuePair <string, string> >(); if (strFunctionToCall.Equals("list_listee_incomplete")) { fn_addingParametersFortotalToDoList(login, kvListOfParameters); } else if (strFunctionToCall.Equals("list_listee_due")) { fn_addingParametersForDayToDoList(day, login, kvListOfParameters); } fn_parsingListeeList(await oHttpViewModel.RESTcalls_POST_BXPAPI(login.propStrFunctionURL, kvListOfParameters)); }
//Prepare Post call for Primary configuration settings of app. public async Task <Boolean> fn_retrieveConfigPrimaryData() { Login myLogin = Login.Instance; HTTPRestViewModel ohttpViewModel = new HTTPRestViewModel(); #region ParametersForPost List <KeyValuePair <string, string> > listKvparameters = new List <KeyValuePair <string, string> >(); KeyValuePair <string, string> kvMyparameters = new KeyValuePair <string, string>("strFunction", "config_primary"); listKvparameters.Add(kvMyparameters); kvMyparameters = new KeyValuePair <string, string>("strSystem", myLogin.propStrSystemUsed); listKvparameters.Add(kvMyparameters); kvMyparameters = new KeyValuePair <string, string>("intClient_id", myLogin.propIntClient_Id.ToString()); listKvparameters.Add(kvMyparameters); kvMyparameters = new KeyValuePair <string, string>("strClient_SessionField", myLogin.propStrClient_SessionField); listKvparameters.Add(kvMyparameters); #endregion string xmlParsingOutput = await ohttpViewModel.RESTcalls_POST_BXPAPI(myLogin.propStrFunctionURL, listKvparameters); return(fn_parsePrimaryConfigXML(xmlParsingOutput)); }
//Prepare Post call for the set of buttons. Cycles through all buttons public async Task fn_retrieveSettingsbuttonData() { Login myLogin = Login.Instance; HTTPRestViewModel ohttpViewModel = new HTTPRestViewModel(); for (int i = 0; i < 10; i++) { #region ParametersForPost List <KeyValuePair <string, string> > listKvparameters = new List <KeyValuePair <string, string> >(); KeyValuePair <string, string> kvMyparameters = new KeyValuePair <string, string>("strFunction", "config_button" + i); listKvparameters.Add(kvMyparameters); kvMyparameters = new KeyValuePair <string, string>("strSystem", myLogin.propStrSystemUsed); listKvparameters.Add(kvMyparameters); kvMyparameters = new KeyValuePair <string, string>("intClient_id", myLogin.propIntClient_Id.ToString()); listKvparameters.Add(kvMyparameters); kvMyparameters = new KeyValuePair <string, string>("strClient_SessionField", myLogin.propStrClient_SessionField); listKvparameters.Add(kvMyparameters); #endregion string a = await ohttpViewModel.RESTcalls_POST_BXPAPI(myLogin.propStrFunctionURL, listKvparameters); propObSetting.propstrInterfaceButtons.Add(fn_parseButtonXML(a, i)); } }