private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { System.Timers.Timer timer = (System.Timers.Timer)sender; Console.WriteLine("Write in Log"); var myEntityO = new { opened = new Dictionary <string, string> { { ".sv", "timestamp" } } }; Task <PushResponse> t = client.PushAsync(door + "/Log/", myEntityO); t.Wait(); string key = t.Result.Result.name; Thread.Sleep(new Random().Next(2000, 10000)); var myEntityC = new { closed = new Dictionary <string, string> { { ".sv", "timestamp" } } }; client.UpdateAsync(door + "/Log/" + key, myEntityC); timer.Enabled = false; timer.Interval = new Random().Next(10000, 50000); timer.Enabled = true; }
private async void Button_Click(object sender, RoutedEventArgs e) { patvirtintiButton.IsEnabled = false; Loading(); if (randomCode == EmailBox.Text) { vartotojasSaved.Epastas = newEmail; await client.UpdateAsync("Paskyros/" + keySaved, vartotojasSaved); string newKey = String.Join("", Encoding.ASCII.GetBytes(vartotojasSaved.Epastas)); await client.UpdateAsync("Paskyros/" + newKey, vartotojasSaved); client.Delete("Paskyros/" + keySaved); //perjungiame į prisijungimo langą var loginForm = new Prisijungimas(); loginForm.generalEventText.Content = "El. paštas pakeistas, galite prisijungti!"; loginForm.generalEventText.Foreground = Brushes.Green; loginForm.generalEventText.Visibility = Visibility.Visible; loginForm.Show(); Close(); } else { Unloading(); generalEventText.Content = "Neteisingas kodas!"; generalEventText.Foreground = Brushes.Red; generalEventText.Visibility = Visibility.Visible; patvirtintiButton.IsEnabled = true; } }
private async void btncambiar_Click(object sender, EventArgs e) { var data = new info { id = lblid.Text, control = lblctl.Text, nombre = lblnombreD.Text, empresa = lblempresa.Text, asesor = lblasesor.Text, proyecto = lblproyecto.Text, carrera = lblcarrera.Text, correo = lblcorreo.Text, tel = lblcorreoD.Text, status = cbstatus.Text, }; var s = new info { status = cbstatus.Text, }; if (lblid.Text == " ") { MessageBox.Show("Seleccione un estudiante"); } else { FirebaseResponse res = await client.UpdateAsync("estudiante/" + lblid.Text, data); FirebaseResponse res2 = await client.UpdateAsync("Control/" + lblctl.Text, s); info resu = res.ResultAs <info>(); MessageBox.Show("Datos actualizados"); grid(); } }
public async void UpdatePatientMember(Patient patient) { var response = await client.UpdateAsync("Patient/" + patient.id, patient); var result = response.ResultAs <Patient>(); Console.WriteLine("Successfully updated"); }
public async void Update() { _firebaseRequestManagerMock.Setup( firebaseRequestManager => firebaseRequestManager.PatchAsync("todos", _expected)) .Returns(Task.FromResult(_expectedResponse)); var response = await _firebaseClient.UpdateAsync("todos", _expected); Assert.NotNull(response); Assert.AreEqual(response.Body, _expected.ToJson()); }
private async void IssaugotiPranesimus_Click(object sender, RoutedEventArgs e) { Loading(); if (PajamuGavimas.IsChecked == true) { vartotojasSaved.Notification_Gavimas = true; } else { vartotojasSaved.Notification_Gavimas = false; } if (PajamuIssiuntimas.IsChecked == true) { vartotojasSaved.Notification_Siuntimas = true; } else { vartotojasSaved.Notification_Siuntimas = false; } if (PrasymuGavimas.IsChecked == true) { vartotojasSaved.Notification_Prasymas = true; } else { vartotojasSaved.Notification_Prasymas = false; } await client.UpdateAsync("Paskyros/" + keySaved, vartotojasSaved); Unloading(); }
//Funtiile de adaugare in baza de date pentru fiecare tabel in parte public async Task addProdusAsync(Produs produs) { //Se ia numarul de id-uri din baza de date FirebaseResponse idResponse = await client.GetAsync("Counter/ProdCNT"); Counter get = idResponse.ResultAs <Counter>(); get.nr = get.nr + 1; nrProduse = get.nr; //Se face update in baza de date la numarul de produse adaugate FirebaseResponse updateId = await client.UpdateAsync("Counter/ProdCNT", get); //Se introduce produsul cu id-ul sau var data = new Data { Id = get.nr, Denumire = produs.Denumire, Pret = produs.Pret, Gramaj = produs.Gramaj, Retetar = produs.Retetar }; SetResponse response = await client.SetAsync("Produse/" + get.nr.ToString(), data); Data result = response.ResultAs <Data>(); //listaProduse(); }
private async void PateiktiButton(object sender, RoutedEventArgs e) { if (vartotojasSaved.Saskaitos.Count == 9) { generalEventText.Content = "Jūs turite maksimalų skaičių sąskaitų!"; return; } if (kodoTextBox.Password != vartotojasSaved.ShortSecurityCode.ToString()) { generalEventText.Content = "Neteisingas 4-ių skaičių kodas!"; return; } if (pavadinimoTextBox.Text == "") { generalEventText.Content = "Pavadinimas negali likti tuščias!"; return; } IsEnabled = false; Loading(); Panel.SetZIndex(greyedOut, 9); Saskaita naujaSaskaita = new Saskaita(pavadinimoTextBox.Text, CreateIban(), 0, DateTime.Now.Date); vartotojasSaved.Saskaitos.Add(naujaSaskaita); await client.UpdateAsync("Paskyros/" + keySaved, vartotojasSaved); closeBackground.Visibility = Visibility.Collapsed; closeButton.Visibility = Visibility.Collapsed; patvirtintiBackround.Visibility = Visibility.Collapsed; patvirtintiButton.Visibility = Visibility.Collapsed; SukurimasDescription.Visibility = Visibility.Collapsed; SukurtiLabel.Visibility = Visibility.Collapsed; sukurtiWindow.Visibility = Visibility.Collapsed; greyedOut.Visibility = Visibility.Collapsed; kodoTextBox.Visibility = Visibility.Collapsed; kodoDescription.Visibility = Visibility.Collapsed; pavadinimoDescription.Visibility = Visibility.Collapsed; pavadinimoTextBox.Visibility = Visibility.Collapsed; underLine_1.Visibility = Visibility.Collapsed; underLine_2.Visibility = Visibility.Collapsed; generalEventText.Visibility = Visibility.Collapsed; kodoTextBox.Clear(); generalEventText.Content = ""; pavadinimoTextBox.Clear(); var manoSaskaitos = new ManoSaskaitos(vartotojasSaved, keySaved); manoSaskaitos.Show(); Close(); }
private async void CreateButton(object sender, RoutedEventArgs e) { pateiktiButton.IsEnabled = false; Loading(); // tikrina ar įvesti kodai atitinka reikalavimus FourDigitValidation(sender, e); SixDigitValidation(sender, e); // tikrina ar nėra klaidų pranešimų dėl kodų if (!fourDigitError.IsVisible & !sixDigitError.IsVisible) { // paskyrai priskiriami kodai paskyra.ShortSecurityCode = Int32.Parse(fourDigitTextBox.Password); paskyra.LongSecurityCode = Int32.Parse(sixDigitTextBox.Password); // paskyra atnaujinama duomenų bazėje FirebaseResponse response = await client.UpdateAsync("Paskyros/" + key, paskyra); var apzvalga = new Apzvalga(paskyra, key); apzvalga.Show(); Close(); } else { Unloading(); pateiktiButton.IsEnabled = true; } }
private async void Button_Click_1(object sender, RoutedEventArgs e) { Loading(); // nuskaitom paskyra is duomenu bazes string key = String.Join("", Encoding.ASCII.GetBytes(ValidEmail(Emailtextbox.Text))); var response = await client.GetAsync("Paskyros/" + key); Vartotojas paskyra = response.ResultAs <Vartotojas>(); // ieškome ar egzistuoja tokia paskyra duomenų bazėje if (randomCode == codetextbox.Text) { string newPass = Security.RandomPassword(); string messageBody = "Jūsu naujas slaptažodis: " + newPass; string messageSubject = "Naujas slaptažodis"; MailMessage message = SiustiLaiska.CreateMessage(email, Registracija.projektoEpastas, messageBody, messageSubject); SiustiLaiska.SendMessage(Registracija.projektoEpastas, Registracija.projektoSlaptazodis, message); newPass = Security.HashingPassword(newPass); paskyra.Slaptazodis = newPass; FirebaseResponse update = await client.UpdateAsync("Paskyros/" + key.ToString(), paskyra); var prisijungimas = new Prisijungimas(); prisijungimas.generalEventText.Content = "Slaptažodis pakeistas, jį gausite paštu!"; prisijungimas.generalEventText.Foreground = Brushes.Green; prisijungimas.generalEventText.Visibility = Visibility.Visible; prisijungimas.Show(); Close(); } else { generalEventText.Content = "Neteisingas kodas!"; Unloading(); } }
protected async void Updat_Details(object sender, EventArgs e) { int i = 0; FirebaseResponse respo = await client.GetAsync("counter"); Counter_class get = respo.ResultAs <Counter_class>(); int cnt = Convert.ToInt32(get.cnt); while (true) { if (i == cnt) { break; } i++; FirebaseResponse respon = await client.GetAsync("user/" + i); Data result1 = respon.ResultAs <Data>(); string user1 = result1.Username; try { if (Label1.Text == user1) { var data = new Data { EstablishName = name1.Text, Email = emails1.Text, Phone = phon1.Text, Address = addr1.Text, Username = Label1.Text, Date = date.Text, Password = this.Encrypt(pass.Text.Trim()), Retypepassword = this.Encrypt(repass.Text.Trim()), RegisterType = rtype.Text }; FirebaseResponse response = await client.UpdateAsync("user/" + i, data); Data result = response.ResultAs <Data>(); name1.Visible = false; name.Visible = true; phon.Visible = true; phon1.Visible = false; addr.Visible = true; addr1.Visible = false; emails.Visible = true; emails1.Visible = false; types.Visible = true; bu1.Visible = true; bu2.Visible = false; GetData(Label1.Text); } } catch { } } }
internal static async Task <T> UpdateAsync <T>(string parent_node, string child_node, T insertData) { string address = parent_node + "/" + child_node; FirebaseResponse response = await client.UpdateAsync(address, insertData); return(response.ResultAs <T>()); }
public async Task <T> UpdateFireDataAsync <T>(T info, string path) { FirebaseResponse response = await cliente.UpdateAsync(path, info); T todo = response.ResultAs <T>(); //The response will contain the data written return(todo); }
public async Task <Wallet> UpdateWalletAsync(string userPublicKey, Wallet walletItem) { var response = await _client.UpdateAsync($"wallets/{userPublicKey}", walletItem); var result = response.ResultAs <Wallet>(); return(result); }
private async void Insertar() { var datex = new Datex { val = "null" }; FirebaseResponse au = await fireCliente.UpdateAsync("Mark0/", datex); }
/// <summary> /// Add announcement to course /// Author: Jacob Tan /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void addAnnoBtn_Click(object sender, EventArgs e) { var data = new Announcement { id = annoTextBox.Text }; FirebaseResponse response = await client.UpdateAsync("CourseList/" + courseName + "/Announcements/", data); Announcement a = response.ResultAs <Announcement>(); }
private async void Guardar_Click(object sender, EventArgs e) { deleteUser(); SaveUser(); var data = new Data { ID = textBox2.Text }; FirebaseResponse response = await client.UpdateAsync("Comunicados/ID", data); MessageBox.Show("Comunicado enviado"); }
private async void button6_Click(object sender, EventArgs e) { var todo = new Todo { name = "Execute UPDATE!", priority = 1 }; FirebaseResponse response = await client.UpdateAsync("Todo/1", todo); Todo todo1 = response.ResultAs <Todo>(); //The response will contain the data written }
public async void UpdateAsync() { await _client.SetAsync("todos/set/setAsync", new Todo { name = "Execute SET", priority = 2 }); var todoToUpdate = new Todo { name = "Execute UPDATE!", priority = 1 }; var response = await _client.UpdateAsync("todos/set/setAsync", todoToUpdate); Assert.NotNull(response); var actual = response.ResultAs <Todo>(); Assert.AreEqual(todoToUpdate.name, actual.name); Assert.AreEqual(todoToUpdate.priority, actual.priority); }
static void Main(string[] args) { IFirebaseConfig config = new FirebaseConfig { AuthSecret = "YOUR_SECRET", BasePath = "YOUR_FIREBASE_URL" }; client = new FirebaseClient(config); Console.Write("Insert door name: "); door = Console.ReadLine(); Console.WriteLine("***************************************"); Console.WriteLine("MENU:"); Console.WriteLine("1. Simulate Arduino"); Console.WriteLine("2. Clean Log data"); Console.Write("Insert your choose (1/2): "); string izbor = Console.ReadLine(); Console.WriteLine(); if (izbor == "1") { Console.WriteLine("Simulating ....."); Console.WriteLine("Press any key to finish"); Dictionary <string, int> data = new Dictionary <string, int>(); data.Add("unlock", 0); client.UpdateAsync(door + "/State/", data); Task <EventStreamResponse> task = client.OnAsync(door + "/State", null, FirebaseChanged); System.Timers.Timer timer = new System.Timers.Timer(); timer.Elapsed += Timer_Elapsed; timer.Interval = new Random().Next(10000, 50000); timer.Enabled = true; Console.Read(); task.Result.Dispose(); } else if (izbor == "2") { cleanFirebase(); } Console.WriteLine("Program finished"); }
private async void button3_Click(object sender, EventArgs e) { var data = new Data() { Id = textBox1.Text, Adress = textBox2.Text, Name = textBox3.Text, Age = textBox4.Text, }; FirebaseResponse response = await client.UpdateAsync("Information/" + textBox1.Text, data); Data obj = response.ResultAs <Data>(); MessageBox.Show("Data Update..."); }
private async void update_btn_Click(object sender, EventArgs e) { var car = new car { carID = Int32.Parse(textBox1.Text), plateName = textBox2.Text, brand = textBox3.Text, model = textBox4.Text, ownerName = textBox5.Text }; FirebaseResponse response = await client.UpdateAsync("Cars/" + textBox1.Text, car); car result = response.ResultAs <car>(); MessageBox.Show("Record Updated:" + result.carID); }
public async Task <bool> SendToken(string token) { try { var response = await client.UpdateAsync(CollectionEnum.tokens.ToString() + '/' + User.UserId, new UserToken() { Token = token }); } catch (Exception ex) { return(false); } return(true); }
private async void ListUpdation(string key, Dictionary <string, string> updatedValue) { FirebaseResponse response; response = await client.UpdateAsync("FireSharp/Name/" + key, updatedValue); if (listView.SelectedIndex == 0 || listView.SelectedIndex == keyHolder.Count - 1) { keyHolder[keyHolder.Keys.ElementAt(listView.SelectedIndex)] = textBox.Text; listView.Items.Insert(listView.SelectedIndex, textBox.Text); listView.Items.RemoveAt(listView.SelectedIndex); send.Content = "Send"; } textBox.Text = ""; }
public async void ChangeTilesStatus(AccountModel account, TilesModel data, string FromState) { try { if (Convert.ToInt32(SelectedTilesIndex) > 0) { string username = account.Email.Substring(0, account.Email.IndexOf("@")); data = data ?? new TilesModel(); data.Status = FromState.Equals("ON") ? "OFF" : "ON"; int index = Convert.ToInt32(SelectedTilesIndex); Tiles[index].Status = data.Status; FirebaseResponse response = await client.UpdateAsync <TilesModel>("/Account/" + username + "/Tiles/" + SelectedTilesIndex + "/", data); TilesModel result = response.ResultAs <TilesModel>() ?? new TilesModel(); OnPropertyChanged(nameof(Tiles)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private async void BtnEdit_Click(object sender, RoutedEventArgs e) { client = new FireSharp.FirebaseClient(config); var data = new Data { Firstname = txt_firstname.Text, Lastname = txt_lastname.Text, Username = txt_username.Text, Password = txt_Password.Password }; FirebaseResponse response = await client.UpdateAsync("Information/" + txt_username.Text, data); //MessageBox.Show(txt_username.Text); MainWindow mainWindow = new MainWindow(); this.Close(); mainWindow.Show(); }
private async void buttonUpdate_Click(object sender, EventArgs e) { var data = new Data { Id = textBoxID.Text, Name = textBoxName.Text, Address = textBoxAddress.Text, Age = textBoxAge.Text }; FirebaseResponse response = await client.UpdateAsync("Datanya/" + textBoxID.Text, data); Data result = response.ResultAs <Data>(); MessageBox.Show("Data Updated at ID : " + result.Id); clearTextBox(); buttonUpdate.Enabled = false; buttonDelete.Enabled = false; button_insert.Enabled = true; }
private async void NotificationUpdate() { await client.UpdateAsync("Paskyros/" + keySaved, vartotojasSaved); }
private async void PervestiButton(object sender, RoutedEventArgs e) { if (gavejoTextBox.Text == "" || sumaTextBox.Text == "") { generalEventText.Content = "Prašome užpildyti visus privalomus langelius!"; return; } if (sumaTextBox.Text == "0") { generalEventText.Content = "Prašome įvesti sumą didesnę nei 0 !"; return; } if (!IsDigitsOnly(sumaTextBox.Text)) { generalEventText.Content = "Sumą turi sudaryti tik skaičiai, kurie gali būti atskirti tašku!"; return; } Loading(); // nuskaitom paskyras is duomenu bazes string gavejoKey = String.Join("", Encoding.ASCII.GetBytes(gavejoTextBox.Text)); var responseSiuntejas = await client.GetAsync("Paskyros/" + keySaved); Vartotojas siuntejas = responseSiuntejas.ResultAs <Vartotojas>(); var responseGavejas = await client.GetAsync("Paskyros/" + gavejoKey); Vartotojas gavejas = responseGavejas.ResultAs <Vartotojas>(); // ieškome ar egzistuoja tokia paskyra duomenų bazėje if (gavejas != null) { Unloading(); } else { Unloading(); generalEventText.Content = "Nėra tokio gavėjo!"; return; } // Tikrinama ar gavėjas yra lygus siuntejui if (gavejas.Epastas == siuntejas.Epastas) { Unloading(); generalEventText.Content = "Negalite siųsti mokėjimo prašymo sau!"; return; } IsEnabled = false; Loading(); if (siuntejas.Epastas == gavejas.Epastas) { //await client.UpdateAsync("Paskyros/" + keySaved, siuntejas); if (siuntejas.Notification_Prasymas == true) { Pranesimas pranesimas_siuntejui = new Pranesimas(siuntejas.Vardas + " " + siuntejas.Pavarde, siuntejas.Vardas + " " + siuntejas.Pavarde, "Prašymas", double.Parse(sumaTextBox.Text, CultureInfo.InvariantCulture), DateTime.Now, siuntejas.Epastas, siuntejas.Saskaitos[pagrindinesSaskNr].Kodas, paskirtisText.Text); siuntejas.NaujiNotification = true; siuntejas.Pranesimai.Insert(0, pranesimas_siuntejui); } await client.UpdateAsync("Paskyros/" + keySaved, siuntejas); vartotojasSaved = siuntejas; var apzvalga = new Apzvalga(vartotojasSaved, keySaved); apzvalga.Show(); Close(); } else { if (gavejas.Notification_Prasymas == true) { Pranesimas pranesimas_gavejui = new Pranesimas(gavejas.Vardas + " " + gavejas.Pavarde, siuntejas.Vardas + " " + siuntejas.Pavarde, "Prašymas", double.Parse(sumaTextBox.Text, CultureInfo.InvariantCulture), DateTime.Now, siuntejas.Epastas, siuntejas.Saskaitos[pagrindinesSaskNr].Kodas, paskirtisText.Text); gavejas.NaujiNotification = true; gavejas.Pranesimai.Insert(0, pranesimas_gavejui); } await client.UpdateAsync("Paskyros/" + gavejoKey, gavejas); vartotojasSaved = siuntejas; var apzvalga = new Apzvalga(vartotojasSaved, keySaved); apzvalga.Show(); Close(); } }
public virtual async Task <T> UpdateAsync(T data) { var response = await _client.UpdateAsync(_path, data); return(response.ResultAs <T>()); }