private void AddItem(object sender, SerialDataReceivedEventArgs e) { api api = new api(); getBarcode(); Product nieuwProdukt = api.GetProduct(code); if (nieuwProdukt == null) { MessageBox.Show("Product niet gevonden", code); return; } if (nieuwProdukt.naam == "notfound") { MessageBox.Show("Product niet gevonden", code); } else { Dispatcher.Invoke(() => { //voeg product toe aan de lijst ProductenLijst.Add(nieuwProdukt); }); } }
public void testRequest() { //arrange api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); //api request = new api("1a08b2e1fd07fa4150f91b80636906a9a29b8e47", "57645cb550c37"); var parameters = new api.Parameters(); parameters.Add("report_name", "Sample SEO Check-Up Report"); parameters.Add("business_names", "Le Bernardin"); parameters.Add("schedule", "Adhoc"); parameters.Add("day_of_month", "2"); parameters.Add("report_type", "with"); parameters.Add("address1", "155 Weest 51st Street"); parameters.Add("address2", ""); parameters.Add("city", "New York"); parameters.Add("state_code", "NY"); parameters.Add("postcode", "10019"); parameters.Add("phone_number", "+1 212-554-1515"); parameters.Add("country", "USA"); parameters.Add("business-category", "Restaurant"); parameters.Add("search_terms", "['restaurant manhattan', 'cafe new york']"); //act var success = request.Post("v4/gpw/add", parameters); dynamic obj = JsonConvert.DeserializeObject(success.Content); //assert Assert.AreEqual(HttpStatusCode.OK, success.StatusCode); Assert.IsTrue(obj.success == "true"); }
private void Button_Click_3(object sender, RoutedEventArgs e) { api Shoppinglistapi = new api(); Shoppinglistapi.CreateShoppinglist(shoppinglistname.Text, GlobalSettings.Id); }
private void Login(string naam, string pass) // inlogknop { api api = new api(); User loginUser = api.GetUser(naam, pass); if (loginUser.Name != null) { GlobalSettings.Id = loginUser.Id; GlobalSettings.Naam = loginUser.Name; GlobalSettings.Email = loginUser.Email; GlobalSettings.Pass = loginUser.Password; char[] seperator = ".".ToCharArray(); GlobalSettings.AllergieList = loginUser.allergies.Split(seperator).ToList(); MainWindow.AppWindow.switchPage(2); MainWindow.AppWindow.EnableButtons(); MainWindow.AppWindow.GetShoppinglist(); } else { MessageBox.Show("Kan gebruiker niet vinden", "Error!", MessageBoxButton.OK); TxtUser.Clear(); TxtPass.Clear(); } }
public ActionResult Index(string id) { String sError = ""; Componente oComp = new Componente(); api obj = new api(); DataTable b = obj.verificar(out sError); try{ if (b.Rows[0].ItemArray[0].ToString() == "1") { System.Net.WebClient wc = new System.Net.WebClient(); string webData = wc.DownloadString("http://www.mindicador.cl/api"); DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(api)); MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(webData)); obj = (api)ser.ReadObject(stream); obj.updValor(obj.dolar.valor, obj.uf.valor, out sError); } }catch (Exception e) { logger.Error(e.Message); sError = "No se pudo actualizar los valores de la UF y del Dolar al valor de hoy. Por favor contáctese con el administrador"; ViewBag.Error = sError; return(View()); } oComp.cargaListaPlantillas(out sError); oComp.CargaBreadcrumbs(id, "1", out sError); oComp.CargaFamilias(out sError); oComp.idCotizacion = id; ViewBag.Error = sError; return(View(oComp)); }
public static IRestResponse FetchProfileUrl() { api Api = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); batchApi batchRequest = new batchApi(Api); // Create a new batch int batchId = batchRequest.Create(); var parameters = new api.Parameters(); parameters.Add("batch-id", batchId); parameters.Add("business-names", "La Bernardin\nBernardin Cafe\nBernardin restaraunt"); parameters.Add("country", "USA"); parameters.Add("city", "New York"); parameters.Add("postcode", "10019"); parameters.Add("local-directory", "google"); var jobId = Api.Post("/v4/ld/fetch-profile-url", parameters); if (jobId.ResponseStatus == ResponseStatus.Completed) { dynamic job = JsonConvert.DeserializeObject(jobId.Content); if (!job.success) { string message = "Error adding job"; var batchException = new ApplicationException(message + job.errors, job.ErrorException); throw batchException; } } else { throw new ApplicationException(jobId.ErrorMessage); } // Commit the batch, resturns true or false bool commit = batchRequest.Commit(batchId); // Poll for results. In a real world example you should do this in a backgroud process, such as HangFire, or use the Task Parallel Library to create a BackGroundWorker Task. // It is bad practice to use Thread.Sleep(). This is only for the example and will actually freeze the UI until the while loop is finished. var results = batchRequest.GetResults(batchId); dynamic directoryResults = JsonConvert.DeserializeObject(results.Content); if (directoryResults.success) { while (directoryResults.status != "Stopped" || directoryResults.status != "Finished") { Thread.Sleep(10000); results = batchRequest.GetResults(batchId); directoryResults = JsonConvert.DeserializeObject(results.Content); } return(results); } else { const string message = "Error Retrieving batch results "; var batchException = new ApplicationException(message, results.ErrorException); throw batchException; } }
public static IRestResponse updateReport() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var reportId = 1; var parameters = new api.Parameters(); parameters.Add("report_name", "Sample SEO Check-Up Report"); parameters.Add("business_names", "Le Bernardin"); parameters.Add("schedule", "Adhoc"); parameters.Add("day_of_month", "2"); parameters.Add("report_type", "with"); parameters.Add("address1", "155 Weest 51st Street"); parameters.Add("address2", ""); parameters.Add("city", "New York"); parameters.Add("state_code", "NY"); parameters.Add("postcode", "10019"); parameters.Add("phone_number", "+1 212-554-1515"); parameters.Add("country", "USA"); parameters.Add("business-category", "Restaurant"); parameters.Add("search-terms", "['restaurant manhattan', 'cafe new york']"); var success = request.Put("v4/gpw/" + reportId + "", parameters); return(success); }
public string jsonReceiverEdit(List <ComponenteJson> componenteJson) { string sError = ""; api obj = new api(); Componente oComponente = new Componente(); try { DataTable b = obj.verificar(out sError); if (b.Rows[0].ItemArray[0].ToString() == "1") { System.Net.WebClient wc = new System.Net.WebClient(); string webData = wc.DownloadString("http://www.mindicador.cl/api"); DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(api)); MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(webData)); obj = (api)ser.ReadObject(stream); obj.updValor(obj.dolar.valor, obj.uf.valor, out sError); } else { oComponente.EditaComponente(componenteJson, out sError); } } catch (Exception ex) { logger.Error(ex.Message); sError = "No se pudo actualizar los valores de la UF y del Dolar al valor de hoy. Por favor contáctese con el administrador"; ViewBag.Error = sError; } return(sError); }
public void start(api api2) { this.api = api2; reset(); txt_phone.PreviewKeyDown += Txt_phone_PreviewKeyDown; txt_code.PreviewKeyDown += Txt_code_PreviewKeyDown; txt_phone.TextChanged += Txt_phone_TextChanged; }
private void RegisterUser(string naam, string wachtwoord, string email, List <string> allergie) { api api = new api(); api.CreateUser(naam, wachtwoord, email, allergie); MainWindow.AppWindow.switchPage(6); }
internal bool Login(string url, string username, string password) { _cherwellService = new api { CookieContainer = new CookieContainer(), Url = url }; return(_cherwellService.Login(username, password)); }
public static IRestResponse getAllReports() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var parameters = new api.Parameters(); var results = request.Get("v2/lsrc/get-all", parameters); return(results); }
internal bool Login(string username, string password) { _cherwellService = new api { CookieContainer = new CookieContainer(500, 100, 8192) }; return(_cherwellService.Login(username, password)); }
public static int addClient() { api Api = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); batchApi batchRequest = new batchApi(Api); var success = batchRequest.Create(); return(success); }
//public FaceImpl(Face x, Manager m) : // this(x, // m, // x.PersonID == null ? null : m.GetPerson((int)x.PersonID)) //{} public FaceImpl(Face x, Manager m, api.Person person) { PictureId = x.PictureID; FaceId = x.FaceID; UKey = x.FaceUKey; Person = person; Path = m.GetFacePath(x.PictureID, x.FaceID, false, (api.FaceState) x.FaceStateID); Selected = x.Selected; // just a way to flag a picture for later sql work FaceState = (api.FaceState) x.FaceStateID; }
internal void show(api val) { if (a.api != null) { a.api = null; } a.api = val; stage.Child = val.stack; val.z_focus(); }
public static IRestResponse getReviewsGrowth() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var reportId = 141; var parameters = new api.Parameters(); var growth = request.Get("v4/rf/" + reportId + "/reviews/growth", parameters); return(growth); }
public static IRestResponse getReviewsDirectories() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var reportId = 141; var parameters = new api.Parameters(); var directories = request.Get("v4/rf/" + reportId + "/directories", parameters); return(directories); }
public static IRestResponse getReviewsStarCounts() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var reportId = 141; var parameters = new api.Parameters(); var stars = request.Get("v4/rf/" + reportId + "/stars/count", parameters); return(stars); }
public static IRestResponse deleteReport() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var reportId = 1; var parameters = new api.Parameters(); var success = request.Delete("v4/gpw/" + reportId + "", parameters); return(success); }
public static IRestResponse getReport() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var reportId = 1; var parameters = new api.Parameters(); var results = request.Get("v4/gpw/" + reportId + "", parameters); return(results); }
static T doapi <T>(string api, Dictionary <string, string> values) where T : Resp { var wc = new WebClient(); wc.Proxy = null; last = new Sdk.api() { name = api, ps = values }; if (!string.IsNullOrEmpty(user.uk)) { wc.Headers.Add("Cookie", "ukey=" + user.uk); } var fs = new NameValueCollection(); if (values != null) { foreach (var k in values.Keys) { fs.Add(k, values[k]); } } string json = ""; try { Debug.WriteLine("doapi:" + api + "@post->" + Serialize.ToJson(values)); var data = wc.UploadValues(gateway + api, fs); json = Encoding.UTF8.GetString(data); Debug.WriteLine("doapi:" + api + "@back->->" + json); } catch (Exception ex) { Debug.WriteLine("doapi:" + api + "@err->" + ex.Message); return(new Resp() { issucc = false, msg = ex.Message } as T); } finally { last = null; wc.Dispose(); } if (json.Contains("0x0006") && api != "check") { var ck = Check(); if (last != null && ck) { return(doapi <T>(last.name, last.ps as Dictionary <string, string>)); } } return(Serialize.FromJson <T>(json)); }
public static IRestResponse deleteReport() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var parameters = new api.Parameters(); parameters.Add("campaign-id", "9907"); var success = request.Delete("v2/lsrc/delete", parameters); return(success); }
public static IRestResponse deleteReport() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var parameters = new api.Parameters(); parameters.Add("report-id", "860"); var success = request.Delete("v4/lscu", parameters); return(success); }
public static IRestResponse searchReports() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var parameters = new api.Parameters(); parameters.Add("q", "Bodega Wine Bar"); var results = request.Get("v4/lscu/search", parameters); return(results); }
public static IRestResponse getReportResults() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var parameters = new api.Parameters(); parameters.Add("report-id", "2457"); var results = request.Get("v2/ct/get-results", parameters); return(results); }
public static IRestResponse deleteReport() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var parameters = new api.Parameters(); parameters.Add("report-id", "682"); var success = request.Post("v2/ct/delete", parameters); return(success); }
public static IRestResponse runReport() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var parameters = new api.Parameters(); parameters.Add("campaign-id", "50"); var success = request.Post("v2/lsrc/run", parameters); return(success); }
public static IRestResponse getReportHistory() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var parameters = new api.Parameters(); parameters.Add("campaign-id", "50"); var results = request.Get("/v2/lsrc/history/get", parameters); return(results); }
public static IRestResponse runReport() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var parameters = new api.Parameters(); parameters.Add("report-id", "1"); var success = request.Put("v4/gpw/run", parameters); return(success); }
public static IRestResponse updateReport() { api request = new api("<INSERT_API_KEY>", "<INSERT_API_SECRET>"); var reportId = 1; var parameters = new api.Parameters(); parameters.Add("business-name", "Le Bernardin"); parameters.Add("contact-telephone", "+1 212-554-1515"); var success = request.Put("v4/rf/" + reportId + "", parameters); return(success); }
private void Restset_Complete(api.Restset value) { this.tables.rest = database.tables.Rest.Insert(value.restlist); this.Rest_Changed?.Invoke(); }
private void Groupexit_Complete(api.Groupexit value) { this.tables.team = database.tables.Team.Insert(value.groupinfo); this.Team_Changed?.Invoke(); }
private void Cardmultidel_Complete(api.Cardmultidel value) { this.tables.team = database.tables.Team.Insert(value.groupinfo); this.Team_Changed?.Invoke(); }
private void Searchnext_Complete(api.Searchnext value) { this.tables.team = database.tables.Team.Insert(value.groupinfo); this.Team_Changed?.Invoke(); }
public AccountController(IKcsarContext db, api.IFormsAuthentication formsAuth, System.Web.Security.MembershipProvider provider) : base(db) { Provider = provider; FormsAuth = formsAuth; }
String GetFacePath(String pidString, int faceId, bool markup, api.FaceState fs) { String extension = markup ? ".markup" : ""; extension = extension + ( fs == api.FaceState.rejected ? ".reject.jpg" : ".jpg"); var p = _pictureStorage + "\\" + CurrentSettingID.ToString() + "." + pidString + ".Face_" + faceId.ToString() + extension; //System.Diagnostics.Debug.WriteLine(p); return p; }
public String GetFacePath(int pictureId, int faceId, bool markup, api.FaceState fs) { return GetFacePath(GetStringPid(pictureId), faceId, markup, fs); }
/// <summary> /// Gets the API URL. /// </summary> /// <returns> /// The URL. /// </returns> /// <param name='x'> /// Api /// </param> /// <param name='p'> /// List of parameters /// </param> private string getUrl(api x, List<string> p = null) { string url = string.Format("{0}{1}.php", (isLive ? Server_Production : Server_Test), x ); if( p != null) url += "?" + String.Join( "&" , p); return url.Replace(" ", "+"); }