public static bool UploadServices(dynamic json, string tableName) { try { FirebaseDB firebaseDB = new FirebaseDB(); FirebaseDB firebaseDBTeams = firebaseDB.Node(tableName); FirebaseResponse getResponse = firebaseDBTeams.Get(); if (getResponse.JSONContent == "" || getResponse.JSONContent == "null") { FirebaseResponse putNewBranchResponse = firebaseDBTeams.Put(newBranch); } bool isEmpty = (string.IsNullOrEmpty(json) || string.IsNullOrWhiteSpace(json) || json == "{}" || json == "[]") ? true : false; if (!isEmpty) { FirebaseResponse putResponse = firebaseDBTeams.Put(json); } return(true); } catch (Exception ex) { throw ex; } }
public static bool UploadProduct(List <Product> list) { try { Dictionary <string, Product> dataList = new Dictionary <string, Product>(); list.ForEach(l => { dataList.Add(l.Product_Code, l); }); var json = JsonConvert.SerializeObject(dataList); FirebaseDB.UploadServices(json, "Product"); return(true); } catch (Exception ex) { throw ex; } }
public static bool UploadPurchase(List <Purchase> list) { try { Dictionary <string, Purchase> purchases = new Dictionary <string, Purchase>(); list.ForEach(l => { purchases.Add(l.Abstract.BillID, l); }); var json = JsonConvert.SerializeObject(purchases); FirebaseDB.UploadServices(json, "Purchase"); return(true); } catch (Exception ex) { throw ex; } }
public static bool UploadCustomer(List <Customer> list) { try { Dictionary <string, Customer> dataList = new Dictionary <string, Customer>(); list.ForEach(l => { dataList.Add(l.CustomerID, l); }); var json = JsonConvert.SerializeObject(dataList); FirebaseDB.UploadServices(json, "Customer"); return(true); } catch (Exception ex) { throw ex; } }
public static bool UploadUser(List <User> list) { try { Dictionary <string, User> users = new Dictionary <string, User>(); list.ForEach(l => { users.Add(l.UserId, l); }); var json = JsonConvert.SerializeObject(users); FirebaseDB.UploadServices(json, "User"); return(true); } catch (Exception ex) { throw ex; } }
public static bool UploadSalesManBeat(List <SalesManBeat> list) { try { Dictionary <string, SalesManBeat> dataList = new Dictionary <string, SalesManBeat>(); list.ForEach(l => { dataList.Add(l.SalesmanID + "_" + l.BeatID + "_" + l.CustomerID, l); }); var json = JsonConvert.SerializeObject(dataList); FirebaseDB.UploadServices(json, "SalesManBeat"); return(true); } catch (Exception ex) { throw ex; } }
public static bool UploadSales(List <Sales> list) { try { Dictionary <string, Sales> sales = new Dictionary <string, Sales>(); list.ForEach(l => { sales.Add(l.Abstract.InvoiceID, l); }); var json = JsonConvert.SerializeObject(sales); FirebaseDB.UploadServices(json, "Sales"); return(true); } catch (Exception ex) { throw ex; } }
public static bool UploadServices(dynamic json, string tableName) { try { FirebaseDB firebaseDB = new FirebaseDB(); FirebaseDB firebaseDBTeams = firebaseDB.Node(tableName); FirebaseResponse getResponse = firebaseDBTeams.Get(); if (getResponse.JSONContent == "" || getResponse.JSONContent == "null") { FirebaseResponse putNewBranchResponse = firebaseDBTeams.Put(newBranch); } FirebaseResponse putResponse = firebaseDBTeams.Put(json); return(true); } catch (Exception ex) { throw ex; } }