public async void CheckMonth() { if (radi_myincome.Checked == true) { this.Hide(); for (int i = 0; i <= month.Length; i++) { if (dateTimePicker1.Value.Month == i) { form2.labelmonth.Text = month[i - 1]; month_in = month[i - 1]; } } form2.Show(); var node_in2 = new start_Monthin { Number = Convert.ToString(0) }; SetResponse node2 = await client.SetTaskAsync($"Start_in:{month_in}", node_in2); } else if (radi_myout.Checked == true) { this.Hide(); for (int i = 0; i <= month.Length; i++) { if (dateTimePicker1.Value.Month == i) { form3.labelmonth.Text = month[i - 1]; month_out = month[i - 1]; } } form3.Show(); var node_out1 = new start_MonthOutAll { Number = Convert.ToString(0), }; SetResponse node1 = await client.SetTaskAsync($"Start_OutAll:{month_out}", node_out1); var node_out2 = new start_MonthOutEat { Number = Convert.ToString(0), }; SetResponse node2 = await client.SetTaskAsync($"Start_OutEat:{month_out}", node_out2); var node_out3 = new start_MonthOutEdu { Number = Convert.ToString(0), }; SetResponse node3 = await client.SetTaskAsync($"Start_OutEdu:{month_out}", node_out3); var node_out4 = new start_MonthOutEtc { Number = Convert.ToString(0), }; SetResponse node4 = await client.SetTaskAsync($"Start_OutEtc:{month_out}", node_out4); } }
private async void btnagregar_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; //timer1.Start(); while (a == 1) if (txtnombre.Text == "") { Error.SetError(txtnombre, "Este campo no puede quedar vacío..."); } else if (txtdui.Text == "") { Error.SetError(txtdui, "Este campo no puede quedar vacío..."); } else if (txtcontraseña.Text == "") { Error.SetError(txtcontraseña, "Este campo no puede quedar vacío..."); } else if (txtusuario.Text == "") { Error.SetError(txtusuario, "Este campo no puede quedar vacío..."); } else if (cmbTipoUs.Text == "") { Error.SetError(cmbTipoUs, "Este campo no puede quedar vacío..."); } else { FirebaseResponse resp = await client.GetTaskAsync("ContadorUsuarios/nodo"); Contador get = resp.ResultAs <Contador>(); var datos = new admin_usuarios { Id = (Convert.ToInt32(get.cnt) + 1).ToString(), Nombre = txtnombre.Text, Dui = txtdui.Text, Usuario = txtusuario.Text, Contraseña = txtcontraseña.Text, Tipo_usuario = cmbTipoUs.Text }; SetResponse response = await client.SetTaskAsync("Usuarios/" + datos.Id, datos); citasE result = response.ResultAs <citasE>(); MessageBox.Show("Usuario creado exitosamente.!"); var obj = new Contador { cnt = datos.Id }; SetResponse response1 = await client.SetTaskAsync("ContadorUsuarios/nodo", obj); exportar(); txtusuario.Text = ""; txtnombre.Text = ""; txtdui.Text = ""; txtcontraseña.Text = ""; cmbTipoUs.Text = ""; } }
public async void AddNewUser(User user) { GLBusers.Add(user); var id = GLBusers.Count.ToString(); await client.SetTaskAsync("UserList/" + id, user); await client.SetTaskAsync("Counter/UserList", new Counter { Cnt = id }); }
public async void Registrar() { if (txtbName.Text == "") { MessageBox.Show("Debe ingresar el nombre del usuario", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtbUsuario.Text == "") { MessageBox.Show("Debe ingresar un nombre de usuario", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtbContra.Text == "" && txtbContra.Text != "Confirmación") { MessageBox.Show("Debe ingresar una contraseña válida", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtbContra.Text == txtbContra1.Text) { if (txtbContra1.Text != "" || txtbContra1.Text != "Confirmacion") { this.Enabled = false; client = new FireSharp.FirebaseClient(config); var usuario = new Usuario { //userID = (numerousuario + 1).ToString(), userID = userLimite + 1, username = txtbName.Text, user = txtbUsuario.Text, password = txtbContra1.Text }; SetResponse response = await client.SetTaskAsync("USUARIOS/" + usuario.userID, usuario); Usuario resultados = response.ResultAs <Usuario>(); numerousuario++; var contador = new Contador { cantidad = numerousuario, userlimite = userLimite + 1, }; SetResponse respuesta = await client.SetTaskAsync("CONTADOR/usuarios", contador); MessageBox.Show("Registro exitoso en la base de datos", "BASE DE DATOS", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); Form ventanaAdminMenu = new FormAdminMenu(rootName, rootMode); ventanaAdminMenu.Show(); } else { MessageBox.Show("Contraseñas inválidas", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Information); txtbContra.Text = ""; txtbContra1.Text = ""; } } else { MessageBox.Show("Las contraseñas no coinciden", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Information); txtbContra1.Text = ""; } }
async void AddTableFirebase(int idTable) { var data = new Table { IdTable = idTable, NameTable = nameTable.Text, StatusTable = comboBoxStatus.Text }; SetResponse response = await client.SetTaskAsync("Tables/L1/" + "B" + idTable, data); }
private async void button1_Click(object sender, EventArgs e) { var Messdbcs = new Messdbcs { companyId = comboBox1.Text, Message = richTextBox1.Text, Date = label3.Text, Time = label4.Text }; if (comboBox1.Enabled == true) { try { SetResponse response = await client.SetTaskAsync("Message/" + comboBox1.Text, Messdbcs); Messdbcs result = response.ResultAs <Messdbcs>(); MessageBox.Show("Message Send Successfully"); } catch { MessageBox.Show("Check your internet connection"); } } else if (comboBox1.Enabled == false) { int flag = 0; StreamReader sr = new StreamReader("CompanyIdfile.txt"); string line; while ((line = sr.ReadLine()) != null) { try { Messdbcs.companyId = line; SetResponse response = await client.SetTaskAsync("Message/" + line, Messdbcs); Messdbcs result = response.ResultAs <Messdbcs>(); } catch { flag = 1; MessageBox.Show("Check your internet connection"); break; } } sr.Close(); if (flag != 1) { MessageBox.Show("Message Send Successfully"); flag = 0; } } }
public async void giris(Kullanici kullanici) { response = await client.GetTaskAsync("sayac"); Sayac sayac = response.ResultAs <Sayac>(); kullanici.id = sayac.deger; sayac.deger++; response = await client.SetTaskAsync("sayac", sayac); // response = await client.SetTaskAsync("kullanıcılar/" + kullanici.id, kullanici); }
public async void SendFridgeData(String ItmTxt, String QtyTxt, String ExpirTxt) { var data = new FridgeData { ID = await GetCounter("Fridge"), Item = ItmTxt, Quantity = QtyTxt, Expiration = ExpirTxt }; SetResponse response = await client.SetTaskAsync("Fridge/" + data.ID, data); SetNewCounter(data.ID, "Fridge"); }
private async void Button3_Click(object sender, EventArgs e) { int x = 1; Button1end = Button1end + x; var data = new Data { Manual1 = Button1end }; MessageBox.Show("Your queue number is:" + Button1end); SetResponse response = await client.SetTaskAsync("", data); Data result = response.ResultAs <Data>(); }
private async void button1_Click(object sender, EventArgs e) { var data = new Data { id = textBox1.Text, name = textBox2.Text, adress = textBox3.Text, mobile = textBox4.Text }; SetResponse response = await client.SetTaskAsync("information/" + textBox1.Text, data); Data result = response.ResultAs <Data>(); MessageBox.Show("Data inserted of id no " + result.id); }
private async void button1_Click(object sender, EventArgs e) //// inserting records { if (!rf.CheckForInternetConnection()) { MessageBox.Show("Please check internet connection before performing any task", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (textBox1.Text == "") { MessageBox.Show("Please enter the name of the book"); return; } var bookdetails = new Book { name = textBox1.Text, issuedate = textBox2.Text, returndate = textBox3.Text }; SetResponse response = await client.SetTaskAsync("Books lended/" + bookdetails.name + "/", bookdetails); Book result = response.ResultAs <Book>(); File.AppendAllText(FilePath, bookdetails.name + Environment.NewLine); MessageBox.Show(result.name + " has been issued"); textBox1.Text = ""; dates(); rf.exporttodatagridview(dt, booklist, FilePath, client); }
public async void handleLogin() { string Email = loginFormView.Email; string Password = loginFormView.Password; try { User user = authen.Login(Email, Password); if (user == null) { loginFormView.showMessage("Email or password wrong!"); return; } // record login action to firebase client = new FireSharp.FirebaseClient(config); var record = new { UserID = user.UserID, RoleID = user.RoleID, Time = DateTime.Now.ToString() }; SetResponse response = await client.SetTaskAsync(DateTime.Now.ToFileTime().ToString(), record); // open dashboard loginFormView.openNewForm(user); } catch (Exception ex) { loginFormView.showMessage(ex.Message); } }
private async void btnAgendarCita_Click(object sender, EventArgs e) { if (txtbPaciente.Text == "Nombre" || txtbTel.Text == "Tel." || comboMin.Text == "Min") { MessageBox.Show("FALTAN DATOS POR LLENAR", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { this.Enabled = false; client = new FireSharp.FirebaseClient(config); var cita = new Cita { citaId = long.Parse(comboAño.Text + comboMes.Text + comboDia.Text + comboHora.Text + comboMin.Text), day = comboDia.Text, mounth = comboMes.Text, year = comboAño.Text, hora = comboHora.Text, minuto = comboMin.Text, edad = txtbEdad.Text, nombrePaciente = txtbPaciente.Text, telefonoPciente = txtbTel.Text, correoPaciente = txtbmail.Text }; SetResponse response = await client.SetTaskAsync("PACIENTES/" + cita.citaId, cita); Cita resultados = response.ResultAs <Cita>(); MessageBox.Show("Registro exitoso en la base de datos", "BASE DE DATOS", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
private async void button1_Click(object sender, EventArgs e) { client = new FireSharp.FirebaseClient(Config); MailMessage mesaj = new MailMessage(); SmtpClient istemci = new SmtpClient(); istemci.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Şifre"); //github da paylaşılacağı için şifre yeri yazılmamıştır istemci.Port = 587; istemci.Host = "smtp.gmail.com"; istemci.EnableSsl = true; mesaj.To.Add(label7.Text); mesaj.From = new MailAddress(textBox1.Text); mesaj.Subject = textBox2.Text; mesaj.Body = textBox3.Text; var geri = new GeriDonus { kullanıcıMail = textBox1.Text, kullanıcıBaslik = textBox2.Text, kullanıcıkonu = textBox3.Text }; SetResponse response = await client.SetTaskAsync("KullanıcıDonus/" + "Donus", geri); GeriDonus result = response.ResultAs <GeriDonus>(); istemci.Send(mesaj); }
public async Task <FireBaseDataModel> SaveMessage(EventMessage message) { client = new FireSharp.FirebaseClient(config); FireBaseDataModel result = new FireBaseDataModel(); if (client == null) { log.Info($"Firebase RealTime DB connection is not established "); } else { var data = new FireBaseDataModel { Id = message.Id, MessageUser = "******", MessageContent = message.PublishMessage, MessageDate = message.SendTime }; SetResponse response = await client.SetTaskAsync("Messages/" + data.Id, data); result = response.ResultAs <FireBaseDataModel>(); } return(result); }
private async void button1_Click(object sender, EventArgs e) { var data = new Data { Nome = textBox1.Text, Categoria = textBox2.Text, Rendimento = textBox3.Text, TempoPreparo = textBox4.Text, Ingredientes = textBox5.Text, ModoPreparo = textBox6.Text }; SetResponse response = await client.SetTaskAsync("Information/" + textBox1.Text, data); Data result = response.ResultAs <Data>(); MessageBox.Show("Receita Cadastrada!"); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); }
private async void registerButton_ClickAsync(object sender, EventArgs e) { // Check each field // Check passwords // Check database for Network ID // Check name is not already associated with a NetworkID // All of the stuff below should be done in the handlers else where. // Check Nothing is null // Check that the passwords match // Check Network ID is valid 8/9 digit ID number ApplicationEngine.UserTypes.Librarian daa = new ApplicationEngine.UserTypes.Librarian { FirstName = this.textBox1.Text, LastName = this.textBox2.Text, ID = Convert.ToUInt32(this.textBox3.Text), Password = this.textBox4.Text }; daa.Level = Convert.ToInt32(this.comboBox1.Text.ToString()); SetResponse response = await client.SetTaskAsync(daa.ID.ToString(), daa); ApplicationEngine.UserTypes.Librarian results = response.ResultAs <ApplicationEngine.UserTypes.Librarian>(); }
private async void btnEliminar_Click(object sender, EventArgs e) { client = new FireSharp.FirebaseClient(config); FirebaseResponse response = await client.DeleteTaskAsync("USUARIOS/" + candidatos[indiceActual]); MessageBox.Show("Eliminación exitosa de la base de datos", "BASE DE DATOS"); this.Close(); Form VentanaAdminMenu = new FormAdminMenu(rootName, rootMode); VentanaAdminMenu.Show(); var data = await client.GetTaskAsync("CONTADOR/usuarios"); if (data.Body != "null") { var contador = new Contador { cantidad = numerousuarios - 1, userlimite = limiteusuario }; SetResponse respuesta = await client.SetTaskAsync("CONTADOR/usuarios", contador); } else { MessageBox.Show("Error 1002, el programa se cerrará por cuestiones de seguridad", ""); Application.Exit(); } }
public async Task <ActionResult> AddApartment([FromBody] Apartment apartment) { client = new FireSharp.FirebaseClient(iconfig); var data = new Apartment { osbb_id = apartment.osbb_id, apartment_num = apartment.apartment_num, apartment_owner_uid = apartment.apartment_owner_uid, area_of_apartment = apartment.area_of_apartment, floor_num = apartment.floor_num, entrance_num = apartment.entrance_num }; SetResponse response = await client.SetTaskAsync("OSBB/" + apartment.osbb_id + "/Apartments/" + data.apartment_num, data); Apartment result = response.ResultAs <Apartment>(); return(StatusCode (200, new { new_apartment_num = apartment.apartment_num //data } )); }
private async void buttonLogin_ClickAsync(object sender, EventArgs e) { FirebaseResponse responseCH = await client.GetTaskAsync(Username.Text); User result = responseCH.ResultAs <User>(); if (Password.Text == result.Password) { tUser.UpCast(result); MainPage main = new MainPage(); this.Hide(); if (main.ShowDialog() != DialogResult.OK) { this.Show(); } tUser = main.RetUser; retuser.DownCast(main.RetUser); this.Close(); SetResponse response = await client.SetTaskAsync(retuser.UserName.ToString(), retuser); retuser = response.ResultAs <User>(); tUser = new FastUser(); } else { MessageBox.Show("incorrect password"); } }
private async void btnSignInWithGoogle_Click(object sender, EventArgs e) { await GoogleSignInModule.executeLoginModule(); Dictionary <string, string> dataUser = GoogleSignInModule.Hasil; string announcement = ""; foreach (KeyValuePair <string, string> entry in dataUser) { announcement += $"{entry.Key} : {entry.Value}\n"; } //MessageBox.Show(announcement); var user = new User { ID = dataUser["ID"], Name = dataUser["Name"], NickName = dataUser["NickName"], JenisKelamin = dataUser["JenisKelamin"], BirthDate = dataUser["BirthDate"], Picture = dataUser["Picture"] }; SetResponse responseSet = await client.SetTaskAsync("UserData/" + $"User-{user.ID}", user); penggunaGlobal = user; lbMainMenuTitle.Text = "Halo, " + user.NickName; bunifuPictureBox1.Load(user.Picture); panelUserProfile.BringToFront(); }
private async void pickBtn_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Title = "Chọn hình ảnh"; open.Filter = "Image Files(*.jpg) | *.jpg"; if (open.ShowDialog() == DialogResult.OK) { System.Drawing.Image img = new Bitmap(open.FileName); pictureBoxAccount.Image = img; } changeBtn.Enabled = false; MemoryStream ms = new MemoryStream(); pictureBoxAccount.Image.Save(ms, ImageFormat.Jpeg); byte[] byteConvert = ms.GetBuffer(); string output = Convert.ToBase64String(byteConvert); var data = new DTO.Image { Img = output }; SetResponse response = await client.SetTaskAsync("Image/", data); DTO.Image result = response.ResultAs <DTO.Image>(); img = result.Img; changeBtn.Enabled = true; }
private async void Button1_Click(object sender, EventArgs e) { try { var data = new Data { Id = textBoxId.Text, Name = textBoxNombre.Text, Address = textBoxDireccion.Text, Age = textBoxEdad.Text, Img = imagenes }; SetResponse response = await client.SetTaskAsync("Cliente/" + textBoxId.Text, data); if (data.Img != null) { } Data result = response.ResultAs <Data>(); MessageBox.Show("Insertado correctamente " + result.Name); } catch (Exception w) { MessageBox.Show("No insertado"); } }
private async void ekleButon_ClickAsync(object sender, EventArgs e) { var data = new Data { ID = textBoxID.Text, adSoyad = textBoxAdSoyad.Text, departman = textBoxDepartman.Text, aylıkGelir = textBoxGelir.Text, telefonNo = textBoxTelefon.Text, mailAdres = textBoxMail.Text, }; SetResponse response = await client.SetTaskAsync("Elemanlar/" + textBoxID.Text, data); Data result = response.ResultAs <Data>(); MessageBox.Show("Eleman Eklendi", "Eleman Islemleri"); textBoxID.Text = ""; textBoxAdSoyad.Text = ""; textBoxDepartman.Text = ""; textBoxGelir.Text = ""; textBoxTelefon.Text = ""; textBoxMail.Text = ""; }
/// <summary> /// Add new data to Firebase database /// </summary> public static async System.Threading.Tasks.Task AddDataToFirebase(GymRepetition newModel) { SetResponse response = await client.SetTaskAsync("gymrepetitionprediction/15", newModel); GymRepetition result = response.ResultAs <GymRepetition>(); Console.WriteLine(result); }
private async void btnAgendarCita_Click(object sender, EventArgs e) { if (txtbPaciente.Text == "Nombre" || txtbTel.Text == "Tel." || comboMin.Text == "Min") { MessageBox.Show("FALTAN DATOS POR LLENAR", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { this.Enabled = false; client = new FireSharp.FirebaseClient(config); try { var cita = new Cita { citaId = long.Parse(comboAño.Text + comboMes.Text + comboDia.Text + comboHora.Text + comboMin.Text), day = comboDia.Text, mounth = comboMes.Text, year = comboAño.Text, hora = comboHora.Text, minuto = comboMin.Text, edad = txtbEdad.Text, nombrePaciente = txtbPaciente.Text, telefonoPciente = txtbTel.Text, correoPaciente = txtbmail.Text }; for (int i = 0; i < pacientes.Count; i++) { if (cita.citaId.ToString() == pacientes[i]) { repetido = true; } } if (repetido != true) { SetResponse response = await client.SetTaskAsync("PACIENTES/" + cita.citaId, cita); Cita resultados = response.ResultAs <Cita>(); MessageBox.Show("Registro exitoso en la base de datos", "BASE DE DATOS", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("La fecha no está disponible, no se agregó a la base de datos.", "BASE DE DATOS", MessageBoxButtons.OK, MessageBoxIcon.Information); repetido = false; this.Close(); } } catch (Exception error) { MessageBox.Show("Favor de ingresar datos válidos", "Datos equivocados", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Enabled = true; } } }
private async void btThem_Click(object sender, EventArgs e) { // private async void btLogin_ClickAsync(object sender, EventArgs e) var data = new Data { MaSv = tbMasv.Text, Ten = tbTen.Text, Tuoi = tbTuoi.Text }; SetResponse setResponse = await client.SetTaskAsync("Information/" + tbMasv.Text, data); SetResponse response = setResponse; Data result = response.ResultAs <Data>(); MessageBox.Show("Đã Thêm " + result.MaSv); }
private async void kirimButton_Click_1(object sender, EventArgs e) { if ((pilihan1RadioButton.Checked == false && pilihan2RadioButton.Checked == false) || (yaRadioButton.Checked == false && tidakRadioButton.Checked == false)) { checkLabel.Text = "Mohon maaf, tidak boleh ada data yang kosong"; } else { if (pilihan1RadioButton.Checked == true) { pilihanCakahim = 1; } else if (pilihan2RadioButton.Checked == true) { pilihanCakahim = 2; } if (yaRadioButton.Checked == true) { pilihanSenator = 1; } else if (tidakRadioButton.Checked == true) { pilihanSenator = 2; } client = new FireSharp.FirebaseClient(config); FirebaseResponse responseRead = await client.GetTaskAsync("DatabaseHME/" + nim); try { var data = new Data { NIM = nim, Nama = nama, Password = pass, Cakahim = pilihanCakahim, Casenator = pilihanSenator }; SetResponse responseWrite = await client.SetTaskAsync("DatabaseHME/" + nim, data); try { Data result = responseWrite.ResultAs <Data>(); new DialogTerimaKasih().Show(); this.Close(); } catch (NullReferenceException) { checkLabel.Text = "Mohon maaf, silahkan coba lagi"; } } catch (NullReferenceException) { checkLabel.Text = "Mohon maaf, silahkan coba lagi"; } } }
private async void insertToFireBase(Data data) { SetResponse response = await client.SetTaskAsync(data.id + "/" + data.fb_time, data); Data result = response.ResultAs <Data>(); Console.Write("Firebase inserted: "); Console.WriteLine(result); }
//firebase part////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public async void uploadThreatLevel(String status1) { try { var threatstatus = new ThreatStatus { State = status1 }; SetResponse response = await firebaseclient.SetTaskAsync("DisasterStatus", threatstatus); ThreatStatus results = response.ResultAs <ThreatStatus>(); MessageBox.Show("Data Inserted" + results.State); }catch (Exception e) { Console.WriteLine("Error in Status :-" + e); } }