public async Task <List <Order> > getOrders(WCObject wc, bool print = true) { List <Order> orders = await wc.Order.GetAll(); orders.Reverse(); foreach (Order order in orders) { if (alreadyPrintedOrders.Contains(order.number)) { continue; } if (printingEnabled && print) { //orderPopUpMessage(order); printOrder(order); } alreadyPrintedOrders.Add(order.number); if (alreadyPrintedOrders.Count > 10) { alreadyPrintedOrders.Remove(alreadyPrintedOrders.First()); } Properties.Settings.Default["lastPrintedTicketID"] = order.number; Properties.Settings.Default.Save(); } return(orders); }
async void HandleCustomEvent(object sender, PropertyChangedEventArgs a) { RestAPI rest = new RestAPI("http://mm-app.co.za/wp-json/wc/v3/", "ck_a25f96835aabfc64b09613eb8ec4a8c9bcd5dcd0", "cs_8f247c22353f25b905c96171379b89714f8f4003"); WCObject wc = new WCObject(rest); //This is my Scuff way of getting live Supplier Changes from the Firebase Network var y = await App.Current.MainPage.DisplayAlert("Flash Sale", Message, "Go Sale", "ok"); if (y) { //I cant test this but writing this from my head in Notepad xD || What I expect this to do is Instead of passing a ID into the title ill give a name //Then its gonna fetch every supplier then im going to check against every supplier if the title message I got from app.xaml.cs is = to one of the suppliers name's //It should set flashID to the id of that supplier and give that to the Flashsale page to display the item's thus no Ugly ints in the Push notifications string flashID; var p = await wc.Tag.GetAll(new Dictionary <string, string>() { { "per_page", "100" } }); foreach (var item in p) { if (_titlemessage == item.name) { flashID = item.id } } await Navigation.PushAsync(new FlashSale_s(flashID)); } }
private async Task <List <Product> > GetAllWithParams(Dictionary <string, string> pProductParams) { List <Product> _WooProducts = null; int _Page = 1; bool _GetMore = true; // if there is no page setting adding if (pProductParams.ContainsKey("page")) { pProductParams["page"] = "0"; } else { pProductParams.Add("page", "0"); } if (pProductParams.ContainsKey("per_page")) { pProductParams["per_page"] = "20"; } else { pProductParams.Add("per_page", "20"); } // retrieve products until the number of products returned is 0. try { RestAPI _RestAPI = _Woo.GetJSONRestAPI; WCObject _WC = new WCObject(_RestAPI); while (_GetMore) { pProductParams["page"] = _Page.ToString(); List <Product> TwentyProducts = await _WC.Product.GetAll(pProductParams); if (TwentyProducts.Count > 0) { if (_WooProducts == null) { _WooProducts = TwentyProducts; } else { _WooProducts.AddRange(TwentyProducts); } _Page++; } else { _GetMore = false; } } } catch (Exception ex) { if (_Woo.Logger != null) { _Woo.Logger.LogError("Error calling WOO REST API: " + ex.Message); } } return(_WooProducts); }
static async Task <int> Main(string[] args) { try { //dapper test var db = new SqlConnection(secrets.ConnectionString); db.Open(); var ddd = db.Query <object>("select * from users"); //woocommerce api test RestAPI rest = new RestAPI(secrets.SiteAddress, secrets.ConsumerKey, secrets.ConsumerPass); WCObject wc = new WCObject(rest); //Get all products var products = await wc.Product.GetAll(); return(0); } catch (Exception ex) { var msg = ex.Message.UnicodeToString(); return(0); } }
public AliExpressPoster( string restAPIUrl, string restAPIKey, string restAPISecret, PostType postType, double priceMarkupPercentage, double usdToMyrCurrencyRate, double productMinPriceAfterConvert, double productBelowMinMarkup) { this.restAPIKey = restAPIKey; this.restAPISecret = restAPISecret; this.postType = postType; this.priceMarkupPercentage = priceMarkupPercentage; this.usdToMyrCurrencyRate = usdToMyrCurrencyRate; this.productMinPriceAfterConvert = productMinPriceAfterConvert; this.productBelowMinMarkup = productBelowMinMarkup; RestAPI rest = new RestAPI( restAPIUrl, this.restAPIKey, this.restAPISecret); wc = new WCObject(rest); }
public APIController() { // Utilizamos o segredo aqui no caso de exemplo RestAPI rest = new RestAPI("https://mindboggle-257618.easywp.com/wp-json/wc/v3/", "ck_677e2069693b2a64310671ca9de93c1090f7e294", "cs_b1b0300b985fa3ccf3bbdec4f3d57e3734a05837"); wc = new WCObject(rest); }
public static async void GetAllProduct1() { var key = "ck_11eedd67dd05dadef7e9e3e5142d34536e6b5c4e"; var secret = "cs_bf52a8cf72941b774a9dd3e8ea1ea7314f67324c"; RestAPI rest = new RestAPI("http://jivori.com/wp-json/wc/v3/", key, secret); WCObject wc = new WCObject(rest); var dic = new System.Collections.Generic.Dictionary <string, string>(); dic.Add("per_page", "100"); int pageNumber = 1; dic.Add("page", pageNumber.ToString()); var products = new List <Product>(); bool endWhile = false; while (!endWhile) { var productsTemp = wc.Product.GetAll(dic).Result; if (productsTemp.Count > 0) { products.AddRange(productsTemp); products.ForEach(p => { Console.WriteLine(p.name); }); pageNumber++; dic["page"] = pageNumber.ToString(); } else { endWhile = true; } } Console.WriteLine("products.Count=" + products.Count); }
private WCObject GetObject() { RestAPI rest = new RestAPI($"{Endpoint}/wp-json/wc/v3/", Client, Secret); WCObject wc = new WCObject(rest); return(wc); }
public Rest(string RestApiLink, string key, string secretkey) { try { API = new RestAPI(RestApiLink, key, secretkey); wc = new WCObject(API); } catch (WebException ex) { if (ex.Message.Contains("404") == false) { MessageBox.Show(Regex.Replace( ex.Message.ToString(), @"\\u(?<Value>[a-zA-Z0-9]{4})", m => { return(((char)int.Parse(m.Groups["Value"].Value, NumberStyles.HexNumber)).ToString()); })); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private WCObject InitWCObject() { RestAPI rest = new RestAPI("http://speedrande.cz/wp-json/wc/v3/", "ck_f7cac2309cddac52a8d4ee02a80081e5cce180be", "cs_adda6c0249faf14510d93213aea5fcdd60e55ab1"); WCObject woocommerce = new WCObject(rest); return(woocommerce); }
public Form1() { InitializeComponent(); configuracao = new Configuracao(); _restApi = new RestAPI(configuracao.url, configuracao.wooKey, configuracao.wooSecret, requestFilter: RequestFilter, responseFilter: ResponseFilter); _restApi.Debug = true; _wc = new WCObject(_restApi); }
public Form1() { InitializeComponent(); rest = new RestAPI("https://www.bravocontrols.com/wp-json/wc/v2", "ck_5635f9d0ce065a46aecf8bb2a92fcccc1d5efd5a", "cs_85135c93196d8c186a60a4e6d9a12441e595140a"); wc = new WCObject(rest); m_current_Row = 0; m_current_Col = 0; }
public CategoryPage() { InitializeComponent(); RestAPI rest = new RestAPI(Constants.baseUrl, Constants.ConsumerKey, Constants.ConsumerSecret); wc = new WCObject(rest); GetCategories(); }
public App() { InitializeComponent(); MyRestAPI rest = new MyRestAPI(Constants.baseUrl, Constants.ConsumerKey, Constants.ConsumerSecret); wc = new WCObject(rest); MainPage = new NepalHouse.MainPage(); }
public static async void GetOneProduct() { var key = "ck_11eedd67dd05dadef7e9e3e5142d34536e6b5c4e"; var secret = "cs_bf52a8cf72941b774a9dd3e8ea1ea7314f67324c"; RestAPI rest = new RestAPI("http://jivori.com/wp-json/wc/v3/", key, secret); WCObject wc = new WCObject(rest); var productsTemp = wc.Product.Get(31727).Result; Console.WriteLine("Product Name=" + productsTemp.name); }
private void button1_Click(object sender, EventArgs e) { RestAPI rest = new RestAPI("http://www.dealliaomah.com/wc-api/v3/", "ck_4cb9634eb054bb803a84a2f9c4dfb60bb858fb54", "cs_e19b4dec1eb82d7a5803a46898e512fc96d20eb0"); WCObject wc = new WCObject(rest); var products = wc.GetOrders().Result; Console.WriteLine(products); }
public SyncroBaseWooCommerce() { var dati = LoginData(); RestAPI rest = new RestAPI(dati.WebServiceUrl, dati.keyPublic, dati.keyPrivate//"cs_691cad866d216a0c85f3d56aacc0a55c92165a21" ); _wc = new WCObject(rest); }
public void Test() { var rest = new RestAPI("http://provaale.atwebpages.com/wp-json/wc/v3/", "ck_8b2a242ed9688623d83efa63f21da8ae6b82736e", "cs_691cad866d216a0c85f3d56aacc0a55c92165a21"); WCObject wc = new WCObject(rest); //Get all products var products = wc.Product.GetAll(); products.Wait(); var prodList = products.Result; }
private async Task InitAsync() { //There is about 98 Suppliers currentley its just a Image with a Button that passes a ID to use to get all Products under that Supplier Its basiclly just a Categorie RestAPI rest = new RestAPI("http://mm-app.co.za/wp-json/wc/v3/", "ck_a25f96835aabfc64b09613eb8ec4a8c9bcd5dcd0", "cs_8f247c22353f25b905c96171379b89714f8f4003"); WCObject wc = new WCObject(rest); // var products = await wc.Tag.GetAll(); var p = await wc.Tag.GetAll(new Dictionary <string, string>() { { "per_page", "100" } }); productsListView.FlowItemsSource = p; }
private async Task InitAsync() { //I need to debug the app when I have a machine but The Variable products(More then one) arent loading on Orders wich is the Single product basicly RestAPI rest = new RestAPI("http://mm-app.co.za/wp-json/wc/v3/", "ck_a25f96835aabfc64b09613eb8ec4a8c9bcd5dcd0", "cs_8f247c22353f25b905c96171379b89714f8f4003"); WCObject wc = new WCObject(rest); var p = await wc.Product.GetAll(new Dictionary <string, string>() { { "tag", Suppliers.tagid }, { "per_page", "100" } });; productsListView.FlowItemsSource = p; }
public async void InitAsync(string z) { RestAPI rest = new RestAPI("http://mm-app.co.za/wp-json/wc/v3/", "ck_a25f96835aabfc64b09613eb8ec4a8c9bcd5dcd0", "cs_8f247c22353f25b905c96171379b89714f8f4003"); WCObject wc = new WCObject(rest); var p = await wc.Product.GetAll(new Dictionary <string, string>() { { "tag", z }, { "per_page", "80" } }); productsListView.FlowItemsSource = p; }
// Update STOCK public static async Task <Product> UpdateStock(int id, int stock) { try { WCObject wc = ApiClient(); return(await wc.Product.Update(id, new Product { stock_quantity = stock })); } catch (Exception e) { throw e; } }
// Create PRODUCT public static async Task <Product> AddProduct(Product product) { try { WCObject wc = ApiClient(); return(await wc.Product.Add(product)); } catch (Exception e) { throw e; } }
public async void Init() { RestAPI rest = new RestAPI("http://mm-app.co.za/wp-json/wc/v3/", "ck_a25f96835aabfc64b09613eb8ec4a8c9bcd5dcd0", "cs_8f247c22353f25b905c96171379b89714f8f4003"); WCObject wc = new WCObject(rest); var p = await wc.Order.Get(PassOid); SingleOrderList.ItemsSource = new Order[1] { p }; Lineorders.ItemsSource = p.line_items; }
private async Task <List <ProductCategory> > GetAll(Dictionary <string, string> ProductCategoryParams) { // RestAPI _RestAPI = _Woo.GetJSONRestAPI; List <ProductCategory> _WooProductCategories = null; bool _GetMore = true; int _Page = 1; if (ProductCategoryParams == null) { ProductCategoryParams = new Dictionary <string, string>(); } ProductCategoryParams.Add("per_page", "20"); ProductCategoryParams.Add("page", "0"); try { WCObject _WC = GetWCObject; //Get all ProductCategories while (_GetMore) { ProductCategoryParams["page"] = _Page.ToString(); List <ProductCategory> TwentyProductCategories = await _WC.Category.GetAll(ProductCategoryParams); if (TwentyProductCategories.Count > 0) { if (_WooProductCategories == null) { _WooProductCategories = TwentyProductCategories; } else { _WooProductCategories.AddRange(TwentyProductCategories); } _Page++; } else { _GetMore = false; } } } catch (Exception ex) { if (_Woo.Logger != null) { _Woo.Logger.LogError("Error calling WOO REST API: " + ex.Message); } } return(_WooProductCategories); }
public static async void EditProduct() { var key = "ck_11eedd67dd05dadef7e9e3e5142d34536e6b5c4e"; var secret = "cs_bf52a8cf72941b774a9dd3e8ea1ea7314f67324c"; RestAPI rest = new RestAPI("http://jivori.com/wp-json/wc/v3/", key, secret); WCObject wc = new WCObject(rest); //Product Pr = wc.Product.Get(31727).Result; //Console.WriteLine("Product Name=" + Pr.name); Product Pr = new Product(); Pr.description = "یه کتونی فوق العاده با کیفیت و شیک با طراحی مدرن و پر طرفدار، استفاده از بافت کشی با 2 طرح متفاوت ریلی و شبکه ای به صورت یک تیکه ، بافت برند این محصول با رنگ تیره در کنار کفش و نیز بافت شبکه ای 2 رنگ بر روی ساق کفش که ترکیب دو رنگ متفاوت طوسی و صورتی هارمونی رنگی چشم نوازی ایجاد کرده ، جنس اشبالت تیکه دوزی شده بر روی زبانه و پشت کار باعث مقاومت شده ، جا بندی های تعبیه شده در رویه کفش ، استفاده از فناوری دایکات در کناره های کار و چاپ های روی زبانه و پشت کار همچنین زیره ی ریلی ، طرح کپسولی و 2 تیکه ی این کتونی باعث شده تا ما این کتونی شیک و راحت رو به تمامی خانوم های باسلیقه و به روز پیشنهاد کنیم ."; Pr.description = "Test it"; Pr = wc.Product.Update(31727, Pr).Result; }
public async Task updateOrdersTableAsync(bool print = true) { try { rest = new WooCommerceNET.RestAPI(Properties.Settings.Default.restAPIURL, Properties.Settings.Default.restAPIKey, Properties.Settings.Default.restAPISecret); wc = new WCObject(rest); orders = await getOrders(wc, print); displayOrders(orders); } catch (Exception e) { printErrorMessage(e.Message + "\n\nPREVERI!!!\nTiskanje spletnih naročil mogoče ne deluje"); } }
public static async void AddProduct() { var key = "ck_11eedd67dd05dadef7e9e3e5142d34536e6b5c4e"; var secret = "cs_bf52a8cf72941b774a9dd3e8ea1ea7314f67324c"; RestAPI rest = new RestAPI("http://jivori.com/wp-json/wc/v3/", key, secret); WCObject wc = new WCObject(rest); Product Pr = new Product(); Pr.name = "تست API"; Pr.sku = "9055"; Pr.description = "تست می کنیم"; var productsTemp = wc.Product.Add(Pr).Result; Console.WriteLine("Product Name=" + productsTemp.name); }
public async Task <List <ProductAttributeTerm> > GetAttributeTermsByAtttribute(ProductAttribute pProductAttribute) { RestAPI _RestAPI = _Woo.GetJSONRestAPI; List <ProductAttributeTerm> _WooProductAttributeTerms = null; bool _GetMore = true; int _Page = 1; Dictionary <string, string> _ProductAttributeTermParams = new Dictionary <string, string>(); _ProductAttributeTermParams.Add("per_page", "20"); _ProductAttributeTermParams.Add("page", "0"); try { WCObject _WC = new WCObject(_RestAPI); //Get all ProductAttributeTerms while (_GetMore) { _ProductAttributeTermParams["page"] = _Page.ToString(); List <ProductAttributeTerm> TwentyProductAttributeTerms = await _WC.Attribute.Terms.GetAll(pProductAttribute.id, _ProductAttributeTermParams); if (TwentyProductAttributeTerms.Count > 0) { if (_WooProductAttributeTerms == null) { _WooProductAttributeTerms = TwentyProductAttributeTerms; } else { _WooProductAttributeTerms.AddRange(TwentyProductAttributeTerms); } _Page++; } else { _GetMore = false; } } } catch (Exception ex) { if (_Woo.Logger != null) { _Woo.Logger.LogError("Error calling WOO REST API: " + ex.Message); } } return(_WooProductAttributeTerms); }
// Get ORDERS created after a date public static async Task <List <Order> > GetOrders(string date) { try { WCObject wc = ApiClient(); var orders = await wc.Order.GetAll(new Dictionary <string, string>() { { "after", date } }); return(orders); } catch (Exception e) { throw e; } }