コード例 #1
0
ファイル: Form1.cs プロジェクト: GenaroStefy/Dentista
        private async void Button2_Click(object sender, EventArgs e)
        {
            FirebaseResponse response = await client.GetTaskAsync("Cliente/" + textBoxId.Text);

            try
            {
                Data obj = response.ResultAs <Data>();

                if (obj != null)
                {
                    textBoxId.Text        = obj.Id;
                    textBoxEdad.Text      = obj.Name;
                    textBoxDireccion.Text = obj.Address;
                    textBoxNombre.Text    = obj.Age;

                    MessageBox.Show("Registro encontrado");
                }
            }
            catch (Exception w)
            {
                Console.WriteLine(w);
                MessageBox.Show("Registro no encontrado verifique su busqueda");
            }
        }
        private async void Read_button_Click(object sender, EventArgs e)
        {
            // Read Data from Firebase data base
            FirebaseResponse response = await client.GetTaskAsync("Information/" + Id_Text.Text);

            // Create object
            Data obj = response.ResultAs <Data>();

            Id_Text.Text      = obj.Id;
            Name_Text.Text    = obj.Name;
            Address_Text.Text = obj.Address;
            Age_Text.Text     = obj.Age;

            MessageBox.Show("Data Read Complete");
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: paulocabralficr/recuperacao
        private async void button2_Click(object sender, EventArgs e)
        {
            FirebaseResponse response = await client.GetTaskAsync("Information/" + textBox1.Text);

            Data obj = response.ResultAs <Data>();

            textBox1.Text = obj.Nome;
            textBox2.Text = obj.Categoria;
            textBox3.Text = obj.Rendimento;
            textBox4.Text = obj.TempoPreparo;
            textBox5.Text = obj.Ingredientes;
            textBox6.Text = obj.ModoPreparo;

            MessageBox.Show("Busca realizada!");
        }
コード例 #4
0
        protected async void btnLogin_Click(object sender, EventArgs e)
        {
            FirebaseResponse response = await client.GetTaskAsync("User Data/" + txtUsername.Text);

            Data users = response.ResultAs <Data>();

            if (Encryption.Decrypt(users.Password) == txtPassword.Text)
            {
                MessageBox.Show("Access granted");
            }
            else
            {
                MessageBox.Show("Access Denied");
            }
        }
コード例 #5
0
        private async void btnConsultaListo_Click(object sender, EventArgs e)
        {
            var idcon = new Cita
            {
                citaId = long.Parse(comboAño.Text + comboMes.Text + comboDia.Text + comboHora.Text + comboMin.Text)
            };

            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse recuperacion = await client.GetTaskAsync("PACIENTES/" + idcon.citaId);

            Cita obj = recuperacion.ResultAs <Cita>();

            MessageBox.Show("Paciente :" + obj.nombrePaciente + "\nFecha : " + obj.day + "/" + obj.mounth + "/" + obj.year + "\nHora" + obj.hora + ":" + obj.minuto, "BASE DE DATOS", MessageBoxButtons.OK);

            this.Close();
        }
コード例 #6
0
        internal async Task <List <Student> > List()
        {
            listStudent = new List <Student>();
            var response = await client.GetTaskAsync("students");

            var result = response.Body;
            var data   = JsonConvert.DeserializeObject <Dictionary <string, Student> >(result);

            foreach (var item in data)
            {
                Student student = item.Value;
                listStudent.Add(student);
            }

            return(listStudent);
        }
コード例 #7
0
        private async void Form2_Load(object sender, EventArgs e)
        {
            Client = new FireSharp.FirebaseClient(config);


            var dataStion = new Data
            {
                DataStation = 0
            };
            FirebaseResponse StationData = await Client.GetTaskAsync("Stationn/");

            Data dataCount = StationData.ResultAs <Data>();

            Console.WriteLine(" Station total : " + dataCount.DataStation);//เช็คจำนวนสถานีใน firebase
            ReDt();
        }
コード例 #8
0
        public async Task GetRegistrationFirebase(string License)
        {
            if (IsFirebaseConnected())
            {
                FirebaseResponse fbResponse = await fbClient.GetTaskAsync(Globals.FIREBASE_PATH_LICENSE + License);

                _user = null;

                try
                {
                    _user = fbResponse.ResultAs <_User>();
                }
                catch
                { }
            }
        }
コード例 #9
0
ファイル: MainWindow.xaml.cs プロジェクト: kruppatomi/Flatyfy
        private async void Export()
        {
            dataTable.Rows.Clear();
            for (int i = 1; i < counter; i++)
            {
                FirebaseResponse resp = await client.GetTaskAsync("DataRecords/" + i);

                Data responseObject = resp.ResultAs <Data>();

                DataRow dataRow = dataTable.NewRow();
                foreach (PropertyInfo prop in responseObject.GetType().GetProperties())
                {
                    dataRow[prop.Name] = prop.GetValue(responseObject);
                }
                dataTable.Rows.Add(dataRow);
            }
        }
コード例 #10
0
        private async void button1_Click(object sender, EventArgs e)
        {
            FirebaseResponse response = await client.GetTaskAsync("Data User/" + textBox1.Text + "/Akun/");

            data Obj = response.ResultAs <data>();

            if (textBox2.Text == Obj.passwords)
            {
                Dashboard dashboard = new Dashboard(textBox1.Text);
                dashboard.Show();
                textBox1.Text = " ";
                textBox2.Text = " ";
            }
            else
            {
                MessageBox.Show("Login gagal, Periksa Kembali Username atau Password!");
            }
        }
コード例 #11
0
        private async void SentBtn_ClickAsync(object sender, EventArgs e)
        {
            MemoryStream ms = new MemoryStream();

            pictureBox1.Image.Save(ms, ImageFormat.Jpeg);
            byte[]           a          = ms.GetBuffer();
            string           output     = Convert.ToBase64String(a);
            FirebaseResponse StationPic = await Client.GetTaskAsync("Stationn/" + TbIDstation.Text);

            Data PicCount = StationPic.ResultAs <Data>();
            int  i        = PicCount.CountPIC + 1;
            int  j        = PicCount.ImgHis + 1;
            var  Data     = new Image_Model
            {
                ImageID  = "Img" + j,
                Img      = output,
                TypeName = TypeTB.Text
            };

            Console.WriteLine("Station/" + TbIDstation.Text);
            Console.WriteLine(" Pic total : " + PicCount.CountPIC);

            var PicStation = new DataPic
            {
                CountPIC = i,
                ImgHis   = j
            };
            SetResponse response2 = await Client.SetTaskAsync("Stationn/" + TbIDstation.Text, PicStation);

            SetResponse response3 = await Client.SetTaskAsync("Stationn/" + TbIDstation.Text + "/Img" + i, Data);

            Image_Model result = response3.ResultAs <Image_Model>();

            var datashowref = new Image_Model
            {
                ImageID = "Img" + j
            };

            Client.Set("Stationn/" + TbIDstation.Text + "/Showref/" + i, datashowref);
            ReDt();
        }
コード例 #12
0
        private async void button1_ClickAsync(object sender, EventArgs e)
        {
            string           searchCH   = this.SearchID.Text.ToString();
            FirebaseResponse responseCH = await client.GetTaskAsync("CardHolder/" + searchCH);

            ApplicationEngine.UserTypes.Cardholder resultCH = responseCH.ResultAs <ApplicationEngine.UserTypes.Cardholder>();

            this.FirstName.Text = resultCH.FirstName;
            this.LastName.Text  = resultCH.LastName;
            this.Password.Text  = resultCH.Password;

            string y = "";

            foreach (string x in resultCH.Books)
            {
                y = y + x.ToString() + "\r\n";
            }
            this.Books.Text = y;
        }
コード例 #13
0
        public async Task <ActionResult> RetrieveOSBBData([FromBody] DataContact dataContact)
        {
            client = new FireSharp.FirebaseClient(iconfig);
            FirebaseResponse response = await client.GetTaskAsync("OSBB/" + dataContact.name + "/Members/" + dataContact.number);

            DataContact obj = response.ResultAs <DataContact>();

            return(StatusCode
                       (200,
                       new
            {
                name = obj.name,
                number = obj.number,
                address = obj.address,
                website = obj.website,
                //data
            }
                       ));
        }
コード例 #14
0
        private async void button_Login_Click(object sender, EventArgs e)
        {
            User             user     = new User();
            FirebaseResponse response = await client.GetTaskAsync("User/");

            User obj = response.ResultAs <User>();

            // User user = new User();
            var login = new User
            {
                Username = encryption(textBox_Password.Text),
                Password = txtBox_Pass_Login.Text
            };

            if (login.Username == obj.Username && login.Password == obj.Password)
            {
                MessageBox.Show("Login successfully!");
            }
        }
コード例 #15
0
        public async void exporttodatagridview(DataTable dt, List <string> booklist, string FilePath, IFirebaseClient client)
        {
            if (!CheckForInternetConnection())
            {
                MessageBox.Show("Please check internet connection before performing any task", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            dt.Rows.Clear();
            if (booklist.Count > 0)
            {
                booklist.Clear();
            }
            booklist = File.ReadAllLines(FilePath).ToList();

            if (booklist.Count > 0)
            {
                foreach (string book in booklist)
                {
                    try
                    {
                        FirebaseResponse response = await client.GetTaskAsync("Books lended/" + book);

                        Book obj = response.ResultAs <Book>();

                        DataRow row = dt.NewRow();
                        row["Name of book"] = obj.name;
                        row["Issue date"]   = obj.issuedate;
                        row["Return date"]  = obj.returndate;
                        dt.Rows.Add(row);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                MessageBox.Show("Book list retrieved");
            }
            else
            {
                MessageBox.Show("No books issued");
            }
        }
コード例 #16
0
        private async void BtnRegistration_Click(object sender, EventArgs e)
        {
            DisableButton();
            if (String.IsNullOrEmpty(txbUID.Text))
            {
                MessageBox.Show("Chưa chạm thẻ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                EnableButton();
                return;
            }
            FirebaseResponse response1;

            response1 = await client.GetTaskAsync(pathDanhSachNhanVien + txbUID.Text);

            if (response1.Body == "null")
            {
                var data = new Data
                {
                    UID        = txbUID.Text,
                    Name       = txtNameCard.Text,
                    BirthDay   = txbBirthOfDate.Text,
                    SDT        = txbSDT.Text,
                    CMND       = txbCMND.Text,
                    MST        = txbMST.Text,
                    BHXH       = txbBHXH.Text,
                    NBDLV      = txbNBDLV.Text,
                    statusWork = "ON"
                };
                SetResponse response = await client.SetTaskAsync(pathDanhSachNhanVien + txbUID.Text, data);

                Data result = response.ResultAs <Data>();
                if (result.UID.Trim().Equals(txbUID.Text.Trim()))
                {
                    MessageBox.Show("Đăng ký thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txbUID.Text         = "";
                    txtNameCard.Text    = "";
                    txbBirthOfDate.Text = "";
                    txbSDT.Text         = "";
                    txbCMND.Text        = "";
                    txbMST.Text         = "";
                    txbBHXH.Text        = "";
                    txbNBDLV.Text       = "";
                }
            }
            else
            {
                MessageBox.Show("Tài khoản đã tồn tài", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            EnableButton();
        }
コード例 #17
0
        public async Task <ActionResult> Index()
        {
            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = await client.GetTaskAsync("Information/");

            var data  = JsonConvert.DeserializeObject <List <TarefaModel> >(response.Body);
            var lista = new List <TarefaModel>();

            if (data != null)
            {
                foreach (var item in data)
                {
                    if (item != null)
                    {
                        lista.Add(item);
                    }
                }
            }
            return(View(lista));
        }
コード例 #18
0
        public async Task <ActionResult> RetrieveApartmentData([FromBody] ApartmentData apartment)
        {
            client = new FireSharp.FirebaseClient(iconfig);
            FirebaseResponse response = await client.GetTaskAsync("OSBB/" + apartment.osbb_id + "/Apartments/" + apartment.apartment_num);

            ApartmentData obj = response.ResultAs <ApartmentData>();

            return(StatusCode
                       (200,
                       new
            {
                osbb_id = obj.osbb_id,
                apartment_num = obj.apartment_num,
                apartment_owner_uid = obj.apartment_owner_uid,
                area_of_apartment = obj.area_of_apartment,
                floor_num = obj.floor_num,
                entrance_num = obj.entrance_num
                               //data
            }
                       ));
        }
コード例 #19
0
        private async void btnConnect_Click(object sender, EventArgs e)
        {
            //State bağlantı durumunu kontrol etmek için kullanılan bool yapısı
            state = true;
            //Client başlatma
            client = new FireSharp.FirebaseClient(Config);
            if (client != null)
            {
                MessageBox.Show("Bağlantı işlemi başarılı");
            }
            //state true olduğu sürece Firebaseden her an veri alımı yapılır
            //Veriler Data internal classı yardımıyla çekilir
            //Alınan veri charta yazılır
            while (state)
            {
                FirebaseResponse response = await client.GetTaskAsync("");

                Data obj = response.ResultAs <Data>();
                chart1.Series[0].Points.AddY(obj.number);
            }
        }
コード例 #20
0
        private async void getirButon_Click(object sender, EventArgs e)
        {
            FirebaseResponse response = await client.GetTaskAsync("Elemanlar/" + textBoxIDGetir.Text);

            try
            {
                Data obj = response.ResultAs <Data>();

                textBoxAdSoyadGetir.Text   = obj.adSoyad;
                textBoxDepartmanGetir.Text = obj.departman;
                textBoxGelirGetir.Text     = obj.aylıkGelir;
                textBoxTelefonGetir.Text   = obj.telefonNo;
                textBoxMailGetir.Text      = obj.mailAdres;

                MessageBox.Show("Eleman Getirildi", "Eleman Islemleri");
            }
            catch (Exception)
            {
                MessageBox.Show("Bu ID'ye sahip kullanici bulunmamaktadir!", "Eleman Islemleri");
            }
        }
コード例 #21
0
        private async void import()
        {
            dt.Rows.Clear();
            int i = 0;
            FirebaseResponse resp1 = await client.GetTaskAsync("Counter/node");

            Counter_class obj1 = resp1.ResultAs <Counter_class>();
            int           cnt  = Convert.ToInt32(obj1.cnt);

            while (true)
            {
                if (i == cnt)
                {
                    break;
                }

                i++;

                try
                {
                    FirebaseResponse resp2 = await client.GetTaskAsync("SensorA/" + i);

                    Data obj2 = resp2.ResultAs <Data>();

                    DataRow row = dt.NewRow();
                    row["ID"]        = obj2.Id;
                    row["Tiempo"]    = obj2.Time;
                    row["Condición"] = obj2.Condition;

                    dt.Rows.Add(row);
                }
                catch
                {
                    MessageBox.Show("Error al conectar a la base de datos");
                }
            }
            // MessageBox.Show("Actualizado");
        }
コード例 #22
0
        public async Task <ActionResult> RetrieveService([FromBody] Service service)
        {
            client = new FireSharp.FirebaseClient(iconfig);

            FirebaseResponse response = await client.GetTaskAsync("OSBB/" + service.osbb_id + "/Services/" + service.service_id);

            Service result = response.ResultAs <Service>();

            return(StatusCode(200,
                              new
            {
                osbb_id = result.osbb_id,
                service_id = result.service_id,
                service_name = result.service_name,
                service_cost = result.serivce_cost,
                service_description = result.serivce_description,
                service_date = result.serivce_date
                               //data
            }
                              ));
        }
コード例 #23
0
        private async void ButtonLoad_ClickAsync(object sender, EventArgs e)
        {
            try
            {
                FirebaseResponse response = await client.GetTaskAsync(
                    "Information/" + comboBoxName.Text);

                Data obj = response.ResultAs <Data>();

                comboBoxName.Text        = obj.Name;
                maskedTextBoxMobile.Text = obj.Mobile;
                maskedTextBoxSum.Text    = obj.Sum;
                maskedTextBoxCard.Text   = obj.Card;

                MessageBox.Show("Данные загружены!");
            }
            catch
            {
                MessageBox.Show("Ошибка!\nДаное имя отсутствует!");
            }
        }
コード例 #24
0
        private async void getDataFromFirebase()
        {
            var i = 0;

            while (true)
            {
                i++;

                FirebaseResponse response = await client.GetTaskAsync("Information/" + i.ToString());

                DataNotifications obj = null;
                try
                {
                    obj = response.ResultAs <DataNotifications>();
                }
                catch (Exception)
                {
                    break;
                }

                if (obj != null)
                {
                    SqlConnection conn          = GetDBConnection();
                    const string  SQL_LOGG_DATA =
                        @"IF NOT EXISTS (SELECT 1
			                     FROM clientdevicetable
			                     WHERE ClientDeviceToken = @Token)
                  INSERT INTO clientdevicetable (ClientDeviceToken , [Group], RoomID, Active)
                  VALUES (@Token, @Group, @RoomID, 1)";
                    using (SqlCommand cmd = new SqlCommand(SQL_LOGG_DATA, conn))
                    {
                        cmd.Parameters.Add("@Token", SqlDbType.NVarChar, 500).Value = obj.tokenID;
                        cmd.Parameters.Add("@Group", SqlDbType.Int).Value           = 3;
                        cmd.Parameters.Add("@RoomID", SqlDbType.Int).Value          = 21;
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                }
            }
        }
コード例 #25
0
        public async Task <ActionResult> RetrieveOSBBData([FromBody] OSBB dataOSBB)
        {
            client = new FireSharp.FirebaseClient(iconfig);
            FirebaseResponse response = await client.GetTaskAsync("OSBB/" + dataOSBB.osbb_id);

            OSBB obj = response.ResultAs <OSBB>();

            return(StatusCode(200, new
            {
                osbb_id = obj.osbb_id,
                osbb_name = obj.osbb_name,
                osbb_director_uid = obj.osbb_director_uid,
                osbb_director_name = obj.osbb_director_name,
                osbb_details = obj.osbb_details,
                osbb_living_area = obj.osbb_living_area,
                osbb_additional_area = obj.osbb_additional_area,
                osbb_non_living_area = obj.osbb_non_living_area,
                osbb_num_apartments = obj.osbb_num_apartments
                                      //data
            }
                              ));
        }
コード例 #26
0
        private async void searchClick_ClickAsync(object sender, EventArgs e)
        {
            string           search   = this.search.Text.ToString();
            FirebaseResponse response = await client.GetTaskAsync("Book/" + search);

            ApplicationEngine.Book.Book result = response.ResultAs <ApplicationEngine.Book.Book>();

            this.Title.Text     = result.Title;
            this.Date.Text      = result.Date;
            this.Author.Text    = result.Author;
            this.ISBN.Text      = result.ISBN.ToString();
            this.Genre.Text     = result.Genre.ToString();
            this.Available.Text = result.Available.ToString();

            string x = "";

            foreach (int i in result.Holder)
            {
                x = x + i.ToString() + "\r\n";
            }
            this.CardHolder.Text = x;
        }
コード例 #27
0
        private async void masukButton_Click_1(object sender, EventArgs e)
        {
            string nim      = nimTextBox.Text;
            string password = passwordTextBox.Text;


            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = await client.GetTaskAsync("DatabaseHME/" + nim);

            try
            {
                Data data = response.ResultAs <Data>();

                if (nim == data.NIM)
                {
                    if (password == data.Password)
                    {
                        nama = data.Nama;
                        pass = data.Password;
                        DialogKonfirmasiPemilih dialogKonfirmasiPemilih = new DialogKonfirmasiPemilih(nim, nama, pass);
                        dialogKonfirmasiPemilih.Show();
                        this.Close();

                        FormPilihPemimpin formPilihPemimpin = new FormPilihPemimpin(nim, nama, pass);
                    }
                    else
                    {
                        checkLabel.Text = "Mohon maaf NIM dan password Anda tidak cocok";
                    }
                }
                else
                {
                    checkLabel.Text = "Mohon maaf NIM Anda tidak terdaftar pada DPT";
                }
            }
            catch (NullReferenceException) {
                checkLabel.Text = "Mohon maaf NIM Anda tidak terdaftar pada DPT";
            }
        }
コード例 #28
0
        private async void FormAgenda_Load(object sender, EventArgs e)
        {
            client = new FireSharp.FirebaseClient(config);


            /*var cita = await client.GetTaskAsync("PACIENTES/");
             * List<long> citas = cita.ResultAs<List<long>>();
             * foreach (long citaid in citas)
             * {
             *  MessageBox.Show("Hay" + citas[0] + "Elementos", "PUTO");
             * }*/


            var data = await client.GetTaskAsync("PACIENTES");

            Dictionary <string, Cita> citas = data.ResultAs <Dictionary <string, Cita> >();

            foreach (var Cita in citas)
            {
                GridAgenda.Rows.Add(Cita.Value.day + "/" + Cita.Value.mounth + "/" + Cita.Value.year, Cita.Value.hora + ":" + Cita.Value.minuto, Cita.Value.nombrePaciente, Cita.Value.telefonoPciente);
            }
        }
コード例 #29
0
        public async Task <int> RetornaUltimoId()
        {
            client = new FireSharp.FirebaseClient(config);

            FirebaseResponse response = await client.GetTaskAsync("Information/");

            var retorno  = JsonConvert.DeserializeObject <List <TarefaModel> >(response.Body);
            var ultimoId = 0;

            if (retorno != null)
            {
                foreach (var item in retorno)
                {
                    if (item.Id > ultimoId)
                    {
                        ultimoId = item.Id;
                    }
                }
                ultimoId++;
            }
            return(ultimoId);
        }
コード例 #30
0
        public async Task <ActionResult> SignUp(ClienteModels oClienteModels)
        {
            //if (ModelState.IsValid)
            //{
            //    return RedirectToAction("Index");
            //}
            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse resp = await client.GetTaskAsync("Counter/node");

            Counter_class get = resp.ResultAs <Counter_class>();

            get.cnt = get.cnt + 1;
            var vClienteModels = new ClienteModels
            {
                Id          = (int)get.cnt,
                Nombre      = oClienteModels.Nombre,
                Apellido    = oClienteModels.Apellido,
                Edad        = oClienteModels.Edad,
                FNacimiento = oClienteModels.FNacimiento
            };

            SetResponse response = await client.SetTaskAsync("Cliente/" + vClienteModels.Id.ToString(), vClienteModels);

            ClienteModels result = response.ResultAs <ClienteModels>();



            var obj = new Counter_class
            {
                cnt = vClienteModels.Id
            };

            SetResponse response1 = await client.SetTaskAsync("Counter/node", obj);

            Response.Write(@"<script language='javascript'>alert('Message: \n" + "Datos Grabados." + " .');</script>");

            return(View(vClienteModels));
        }