示例#1
0
        private async void Export()
        {
            FirebaseResponse res = await client.GetTaskAsync("Counter/node");

            CounterClass get = res.ResultAs <CounterClass>();

            try
            {
                for (int i = 1; i <= Convert.ToInt32(get.cnt); i++)
                {
                    FirebaseResponse getData = await client.GetTaskAsync("Information/" + i);

                    Data    getObject = getData.ResultAs <Data>();
                    DataRow dataRow   = dt.NewRow();
                    dataRow["Id"]         = getObject.id;
                    dataRow["Name"]       = getObject.name;
                    dataRow["Contact No"] = getObject.contactNo;
                    dataRow["Address"]    = getObject.address;
                    dt.Rows.Add(dataRow);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            MessageBox.Show("Done Derive to Data Grid View Box");
        }
示例#2
0
        private async void Save_Click(object sender, EventArgs e)
        {
            FirebaseResponse res = await client.GetTaskAsync("Counter/node");

            CounterClass get  = res.ResultAs <CounterClass>();
            var          data = new Data
            {
                id        = (Convert.ToInt32(get.cnt) + 1).ToString(),
                name      = nameTextBox.Text,
                contactNo = contactNoTextBox.Text,
                address   = addressRichTextBox.Text
            };
            SetResponse response = await client.SetTaskAsync("Information/" + idTextBox.Text, data);

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

            MessageBox.Show("Data Inserted into Firebase" + result.id);
            var obj = new CounterClass
            {
                cnt = data.id
            };
            FirebaseResponse resp = await client.SetTaskAsync("Counter/node", obj);
        }