コード例 #1
28
        public WebListener()
        {
            FirebaseConfig config = new FirebaseConfig {
                BasePath = "https://splatmap.firebase.com/clouds"
            }
            cloudsClient = new FirebaseClient(config);

            // start listening
            await cloudsClient.OnAsync("push", (sender, args) => {
                   System.Console.WriteLine(args.Data);
            });
        }
コード例 #2
0
        // Delete Student From FireBase DataBase ...
        //

        public async void FireBase_Delete(string Student_Id)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            if (Client == null)
            {
                MessageBox.Show("تأكد من انك متصل بالانترنت FireBase يوجد خطأ في الاتصال بقاعدة البيانات من نوع", "خطأ في الاتصال", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            FirebaseResponse Respose = await Client.DeleteTaskAsync("Student/" + Student_Id);
        }
コード例 #3
0
        private async void guardarUsuario()
        {
            try
            {
                FirebaseConfig config = new FirebaseConfig(GLOBAL.apiKey);

                FirebaseAuthProvider authProvider = new FirebaseAuthProvider(config);

                FirebaseAuthLink auth = await authProvider.CreateUserWithEmailAndPasswordAsync(txtCorreo.Text, txtContraseña.Text);

                MessageBox.Show("Usuario registrado correctamente!", "Registro usuarios", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (FirebaseAuthException e)
            {
                MessageBox.Show("Ocurrio un error: " + e.InnerException.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: AndyTertzakian/Current-C
        private async void label1_Click(object sender, EventArgs e)
        {
            label1.Text = (InternetUtility.InternetConnected()) ? "Connected" : "Not Connected";

            IFirebaseConfig config = new FirebaseConfig()
            {
                AuthSecret = "hzTI7r7vll3gXZyQg78GKTgKGEo32aQ8sSK1zImB",
                BasePath   = "https://current-c.firebaseio.com/"
            };

            IFirebaseClient client = new FirebaseClient(config);

            var todo = new Models.User("Andy", new DateTime(1996, 2, 16));

            PushResponse response = await client.PushAsync("todos/set", todo);

            string tes1t = response.Result.name;
        }
コード例 #5
0
        public async Task SendData(string name_, string age_)
        {
            IFirebaseConfig config = new FirebaseConfig {
                AuthSecret = "AchfUEuAOVILqYAz3nOw2NB0QLvW3qVbUfrxloot",
                BasePath   = "https://fir-xamarinforms.firebaseio.com/"
            };
            IFirebaseClient client = new FirebaseClient(config);

            List <Chat> myclass_list = new List <Chat> ();

            myclass_list.Add(new Chat()
            {
                Llave      = "",
                NombreChat = DateTime.Now.Month.ToString()
            });

            //await client.SetAsync ("MyClass", myclass_list);
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: epeshk/testing
 private static void PostResults(IList <ImplementationStatus> statuses)
 {
     try
     {
         var config = new FirebaseConfig
         {
             BasePath = "https://testing-challenge.firebaseio.com/word-statistics/"
         };
         using (var client = new FirebaseClient(config))
         {
             client.Set(names + "/implementations", statuses.Select(s => s.FailsCount).ToArray());
         }
         Console.WriteLine("");
     }
     catch
     {
         Console.WriteLine("...");
     }
 }
コード例 #7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseSwagger();
            app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Restaurante_DEV"); });
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            FirebaseConfig.SetEnviromentVariables(Configuration);
            app.UseHttpsRedirection();
            app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
            app.UseMvc();
            Kernel = RegisterApplicationComponents(app);
        }
コード例 #8
0
        public ItensEventoDetalheViewModel(Usuario usuarioLogado, long eventoID)
        {
            var teste = new EventoItem();
            List <EventoItem> items = new List <EventoItem>();

            //Deixa o usuário logado em memória
            _usuarioLogado  = usuarioLogado;
            _firebaseClient = new FirebaseConfig <EventoItem>();
            _eventoID       = eventoID;
            //AcessEventoCommand = new Command(async (object obj) => await AccessEventoDetalheCommand(obj));
            //Task.Run(async () =>
            //{
            //    items = await _firebaseClient.GetEventoItemAsync(_eventoID);
            //}).Wait();
            //foreach(var i in items)
            //{
            //    nome = i.Nome;
            //}
        }
コード例 #9
0
        public async void Update_Counter(string Value)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Number_Process_Data = new FireBase_Counter
            {
                Counter = Value
            };

            SetResponse Respose = await Client.SetTaskAsync("Number_Process/" + "Now", Number_Process_Data);

            Update_Process_Number((int.Parse(Value) - 1).ToString());
        }
コード例 #10
0
        public async void Update_Counter(string Counter_Value)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Number_Account_Detail = new FireBase_Account_Detail_Counter
            {
                Counter = Counter_Value
            };

            SetResponse Respose = await Client.SetTaskAsync("Number_Account_Detail/" + "Now", Number_Account_Detail);

            return;
        }
コード例 #11
0
ファイル: FormRegister.cs プロジェクト: iwebwork/CPlanTrade
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtFullName.Text) &&
                string.IsNullOrWhiteSpace(tbLogin.Text) &&
                string.IsNullOrWhiteSpace(tbSenha.Text))
            {
                MessageBox.Show("Por favor preencha todos os campos!");
                return;
            }

            User user = new User()
            {
                Name     = txtFullName.Text,
                Login    = tbLogin.Text,
                Password = tbSenha.Text
            };

            IFirebaseClient client;

            IFirebaseConfig ifc = new FirebaseConfig()
            {
                AuthSecret = "iu89vBVEQLL9PvidW5ChOBeHbbKoCJCAHTqiNhRz",
                BasePath   = "https://control-plain-trade-default-rtdb.firebaseio.com/"
            };

            try
            {
                client = new FireSharp.FirebaseClient(ifc);
                SetResponse set = client.Set(@"Users/" + user.Login, user);
                MessageBox.Show("Sucesso, usuario cadastrado com sucesso!");
            }
            catch (Exception m)
            {
                MessageBox.Show(m.Message);
            }


            FormLogin lo = new FormLogin();

            this.Hide();
            lo.Show();
        }
コード例 #12
0
ファイル: FormLogin.cs プロジェクト: iwebwork/CPlanTrade
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbLogin.Text) &&
                string.IsNullOrWhiteSpace(tbSenha.Text))
            {
                MessageBox.Show("Por favor preencha todos os campos!");
                return;
            }

            User currentUser = new User()
            {
                Login    = tbLogin.Text,
                Password = tbSenha.Text
            };

            IFirebaseClient client;

            IFirebaseConfig ifc = new FirebaseConfig()
            {
                AuthSecret = "iu89vBVEQLL9PvidW5ChOBeHbbKoCJCAHTqiNhRz",
                BasePath   = "https://control-plain-trade-default-rtdb.firebaseio.com/"
            };

            try
            {
                client = new FireSharp.FirebaseClient(ifc);
                FirebaseResponse response     = client.Get(@"Users/" + tbLogin.Text);
                User             Responseuser = response.ResultAs <User>();
                if (User.IsEqual(Responseuser, currentUser))
                {
                    MessageBox.Show("Usuario logado com sucesso!");
                }
                else
                {
                    MessageBox.Show(User.printError());
                }
            }
            catch (Exception m)
            {
                MessageBox.Show(m.Message);
            }
        }
コード例 #13
0
            private async void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
            {
                IFirebaseConfig config = new FirebaseConfig()
                {
                    AuthSecret = "swZHTKc94vPvU61ENUWwthu1Bx1iRqqXiUzh3J7U",
                    BasePath = "https://ogrenci-topluluklari.firebaseio.com/"
                };
                IFirebaseClient client = new FirebaseClient(config);


                yetk = dataGridView1.Columns[dataGridView1.CurrentCell.ColumnIndex].HeaderText.ToString();
                kadi1 = userDataGridView.CurrentRow.Cells[0].Value.ToString();

                FirebaseResponse res = client.Get(@"USERS/" + userListkadi1 + "/" + UserListyetk);
                string data = res.ResultAs<string>();


                if (data == "true")
                {
                    st2 = "false";
                }
                else
                {
                    st2 = "true";
                }

                DialogResult dialog = new DialogResult();
                dialog = MessageBox.Show("Kişinin Yetkisini Değiştirmek İstiyor Musunuz?", "YETKİ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialog == DialogResult.Yes)
                {
                    var set2 = await client.SetAsync(@"USERS/" + userListkadi1 + "/" + UserListyetk, userListst2);

                    userDataGridView.Rows.Clear();
                    UserList_Load(sender, e);

                    MessageBox.Show("Yetki Değiştirildi!!!", "BİLGİLENDİRME", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Yetki Değiştirilmedi!!!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
コード例 #14
0
        static void Main()
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = Configuration.FirebaseBaseSecret,
                BasePath   = Configuration.FirebaseBasePath
            };

            var firebaseClient = new FireSharp.FirebaseClient(config);

            int count    = 0;
            var products = ScrapeWebshop();

            foreach (var product in products)
            {
                firebaseClient.Push(Configuration.FirebaseBaseSubpath, product);
                count++;
            }
            Console.WriteLine($"Uploaded {count} Products");
        }
コード例 #15
0
ファイル: BitacoraDAL.cs プロジェクト: pablomussanti/SAPFinal
        public List <Bitacora> Read()
        {
            IFirebaseClient BitacoraI;

            IFirebaseConfig config = new FirebaseConfig
            {
                BasePath = "https://saptecnologiauai.firebaseio.com/"
            };

            BitacoraI = new FireSharp.FirebaseClient(config);
            FirebaseResponse response  = BitacoraI.Get("Bitacora");
            dynamic          data      = JsonConvert.DeserializeObject <dynamic>((response.Body));
            List <Bitacora>  Bitacoras = new List <Bitacora>();

            foreach (var item in data)
            {
                Bitacoras.Add(JsonConvert.DeserializeObject <Bitacora>(((JProperty)item).Value.ToString()));
            }
            return(Bitacoras);
        }
コード例 #16
0
        public MainWindow()
        {
            InitializeComponent();

            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "27hUj3bDEkV4CccU0ugZdEM6QTJEzUpikO06ch4X",
                BasePath   = "https://my-school-8bb61.firebaseio.com/",
            };

            _config = config;

            this.Loaded    += MainWindow_Loaded;
            btSet.Click    += btSet_Click;
            btPush.Click   += btPush_Click;
            btGet.Click    += btGet_Click;
            btUpdate.Click += btUpdate_Click;
            btDelete.Click += btDelete_Click;
            btClose.Click  += btClose_Click;
        }
コード例 #17
0
ファイル: CFirebase.cs プロジェクト: nkhs/data-hook-csharp
        public static async void AddLogAsync(String log)
        {
            String key = macAddress();

            try
            {
                IFirebaseConfig config = new FirebaseConfig
                {
                    AuthSecret = FIREBASE_KEY,
                    BasePath   = FIREBASE_URL
                };
                IFirebaseClient client = new FirebaseClient(config);

                PushResponse response = await client.PushAsync("dota/" + key, log);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #18
0
        // Insert Data In FireBase DataBase ...
        //

        public async void FireBase_Insert(List <Account_Detail> Detail)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            int Number_Detail = Detail.Count;

            FirebaseResponse CounterRespose = await Client.GetTaskAsync("Number_Account_Detail/" + "Now");

            FireBase_Account_Detail_Counter Data = CounterRespose.ResultAs <FireBase_Account_Detail_Counter>();

            string Counter_Value = Data.Counter;

            for (int i = 0; i < Number_Detail; i++)
            {
                var Account_Detail = new FireBase_Account_Detail
                {
                    Account_Id        = Detail[i].Get_Account_Id(),
                    Student_Name      = Detail[i].Get_Student_Name(),
                    Class             = Detail[i].Get_Class(),
                    Study_Fee         = Detail[i].Get_Study_Fee(),
                    Registration_Fee  = Detail[i].Get_Registration_Fee(),
                    Transportaion_Fee = Detail[i].Get_Transportaion_Fee(),
                    Extra_Fee         = Detail[i].Get_Extra_Fee(),
                    Total             = Detail[i].Get_Total()
                };

                SetResponse Respose = await Client.SetTaskAsync("Account_Detail/" + Counter_Value, Account_Detail);

                Counter_Value = (int.Parse(Counter_Value) + 1).ToString();
            }

            Update_Counter(Counter_Value);

            return;
        }
コード例 #19
0
        public ActionResult createFence(fenceModel f)
        {
            tempFence tf = new tempFence();

            tf.Latitude      = f.latitude.ToString();
            tf.Longitude     = f.longitude.ToString();
            tf.Notification_ = f.notification;
            tf.TimeStamp     = DateTime.Now.AddHours(f.hr).ToString("MM/dd/yyyy HH:mm:ss");

            tf.Radius = f.radius.ToString();
            IFirebaseConfig mes = new FirebaseConfig
            {
                AuthSecret = "CwnE0VGXMqxNxcY5YSWVNcL7IAM3hfqRuSiNjWm5",
                BasePath   = "https://xdadeveloperes.firebaseio.com/"
            };

            IFirebaseClient mfc;

            mfc = new FireSharp.FirebaseClient(mes);
            var          data = tf;
            PushResponse r    = mfc.Push("Fences_" + "/", data);

            updateFencingHours(Convert.ToInt32(f.vendorId), f.hr);

            var   context = new promoLacDbEntities();
            fence fence_  = new fence();

            fence_.latitude     = f.latitude;
            fence_.longitude    = f.longitude;
            fence_.startTime    = DateTime.Now;
            fence_.endTime      = DateTime.Now.AddHours(f.hr);
            fence_.notification = f.notification;
            fence_.radius       = f.radius;
            fence_.vendorId     = f.vendorId;
            fence_.area         = f.AreaName;

            context.fences.Add(fence_);
            context.SaveChanges();

            return(Json(new { success = true, message = "dddd" }, JsonRequestBehavior.AllowGet));
        }
コード例 #20
0
ファイル: Form1.cs プロジェクト: hafizurfahim/FirebaseCrud
        public async void GetAllStudent()
        {
            IFirebaseConfig firebaseConfig = new FirebaseConfig()
            {
                AuthSecret = "0q034wxR0p8grjvFHJtPzXLmMhlTNH3yrgrqlAEf",
                BasePath   = "https://crudforms.firebaseio.com/"
            };
            IFirebaseClient client = new FirebaseClient(firebaseConfig);
            var             data   = await client.GetAsync("StudentList");

            if (data.Body != "null")
            {
                Dictionary <string, Student> studentList = data.ResultAs <Dictionary <string, Student> >();

                foreach (var students in studentList)
                {
                    StudentdataGridView.Rows.Add(students.Key, students.Value.name, students.Value.registrationNO, students.Value.mobileNo,
                                                 students.Value.address, students.Value.departmentName);
                }
            }
        }
コード例 #21
0
        // Insert Data In FireBase DataBase ...
        //

        public async void FireBase_Insert(Student Student)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Student_Data = new FireBase_Student
            {
                Id             = Student.Get_Id(),
                First_Name     = Student.Get_First_Name(),
                Last_Name      = Student.Get_Last_Name(),
                Father_Name    = Student.Get_Father_Name(),
                Connect1       = Student.Get_Connect1(),
                Connect2       = Student.Get_Connect2(),
                Birth          = Student.Get_Birth(),
                Class          = Student.Get_Class(),
                Type           = Student.Get_Type(),
                Registration   = Student.Get_Registration(),
                School_Name    = Student.Get_School_Name(),
                Transportation = Student.Get_Transportation(),
                City           = Student.Get_City(),
                Block          = Student.Get_Block(),
                Street         = Student.Get_Street(),
                Detail         = Student.Get_Detail(),
                Account_Number = Student.Get_Account_Number(),
                File_Number    = Student.Get_File_Number(),
                Note           = Student.Get_Note(),
                File_Stutus    = Student.Get_File_Stutus(),
                Picture        = Student.Get_Picture()
            };

            SetResponse Respose = await Client.SetTaskAsync("Student/" + Student.Get_Id(), Student_Data);

            return;
        }
コード例 #22
0
        public async void CadastrarEvento()
        {
            _eventoFirebase = new FirebaseConfig <Evento>();
            Evento evento = new Evento();

            evento.UsuarioCriadorID = _usuarioLogado.ID.Value;
            evento.Nome             = nome;
            evento.Descricao        = descricao;
            evento.ChaveEvento      = new Random().Next().ToString();
            evento.DataInicio       = dataInicio.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
            evento.HoraInicio       = horaInicio.ToString(@"hh\:mm");
            evento.DataTermino      = dataTermino.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
            evento.HoraTermino      = horaTermino.ToString(@"hh\:mm");
            evento.Descricao        = descricao == (null) ? "" : descricao;
            evento.Logradouro       = logradouro == (null) ? "" : logradouro;
            evento.Bairro           = bairro == (null) ? "" : bairro;
            evento.Estado           = estado == (null) ? "" : estado;
            evento.Cidade           = cidade == (null) ? "" : cidade;
            evento.CEP         = cep == (null) ? "" : cep;
            evento.Numero      = numero == (null) ? "" : numero;
            evento.Complemento = complemento == (null) ? "" : complemento;
            evento.Latitude    = "";
            evento.Longitude   = "";

            var cadEventoSucces = await _eventoFirebase.InsertEventoAsync(evento, _usuarioLogado);

            if (cadEventoSucces != null)
            {
                await App.Current.MainPage.DisplayAlert("Cadastro", "Sucesso no Cadastro!", "Ok");

                App.Current.MainPage = new NavigationPage(new View.Eventos(_usuarioLogado));

                await App.Current.MainPage.Navigation.PushModalAsync(new View.TabbedPageEventoDetalhe(_usuarioLogado, cadEventoSucces.ID.Value));
            }
            else
            {
                await App.Current.MainPage.DisplayAlert("Cadastro", "Houve um erro no cadastro. É possível que o este e-mail já exista.", "Voltar");
            }
        }
コード例 #23
0
        private void buttonKayıt_Click(object sender, EventArgs e)
        {
            User u = new User();

            u.KullanıcıAdı = kAdi.Text;
            u.Şifre        = Sifre.Text;


            IFirebaseConfig config = new FirebaseConfig()
            {
                AuthSecret = "Um2q5EJk0TzKlL8BJIEI8XfHrylv0Nx5JpewBOiN",
                BasePath   = "https://ogrenci-topluluklari.firebaseio.com/USERS"
            };
            IFirebaseClient client = new FirebaseClient(config);

            var set = client.Set(@"/" + kAdi.Text, u);

            Login lgn = new Login();

            lgn.Show();
            this.Close();
        }
コード例 #24
0
        public ActionResult createMessage(messageModel m)
        {
            var       context = new promoLacDbEntities();
            messages_ obj     = new messages_();

            foreach (var x in m.areaName)
            {
                obj.vendorID           = m.vendorID;
                obj.messageDescription = m.messageDescription;
                obj.messageTitle       = m.messageTitle;
                obj.areaId             = getAreaId(x);
                obj.messageStatus      = "s";

                context.messages_.Add(obj);
                context.SaveChanges();

                tempMessage objM = new tempMessage();


                objM.notificationStatus      = "s";
                objM.notificationAreaId      = obj.areaId.ToString();
                objM.notificationDescription = obj.messageDescription;
                objM.notificationTitle       = obj.messageTitle;
                objM.notificationTime        = DateTime.Now.ToString();
                objM.notificationId          = obj.messageId.ToString();
                IFirebaseConfig mes = new FirebaseConfig
                {
                    AuthSecret = "CwnE0VGXMqxNxcY5YSWVNcL7IAM3hfqRuSiNjWm5",
                    BasePath   = "https://xdadeveloperes.firebaseio.com/"
                };

                IFirebaseClient mfc;
                mfc = new FireSharp.FirebaseClient(mes);

                var set = mfc.Set(@"Messages/" + obj.messageId, objM);
            }

            return(Json(new { success = true, message = "dddd" }, JsonRequestBehavior.AllowGet));
        }
コード例 #25
0
        private void New_Item_Load(object sender, EventArgs e)
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "m6NNKfbxyufWFj9YzHObMf2LTPXB9caps9qNjCrs",
                BasePath   = "https://nms-pharmacy-e0da6.firebaseio.com/"
            };


            client = new FireSharp.FirebaseClient(config);


            featured_list.Items.Add("false");
            featured_list.Items.Add("true");
            featured_list.SelectedIndex = 0;

            prescription_list.Items.Add("false");
            prescription_list.Items.Add("true");
            prescription_list.SelectedIndex = 0;

            discount_editText.Text = "0";
        }
コード例 #26
0
ファイル: Form1.cs プロジェクト: hafizurfahim/FirebaseCrud
        private async void Deletebutton_Click(object sender, EventArgs e)
        {
            IFirebaseConfig firebaseConfig = new FirebaseConfig()
            {
                AuthSecret = "0q034wxR0p8grjvFHJtPzXLmMhlTNH3yrgrqlAEf",
                BasePath   = "https://crudforms.firebaseio.com/"
            };
            IFirebaseClient client = new FirebaseClient(firebaseConfig);

            Idlabel.Text = StudentdataGridView.SelectedCells[0].Value.ToString();
            string id = Idlabel.Text;

            var message = await client.DeleteAsync("StudentList/" + id);

            if (message.StatusCode.ToString() == "OK")
            {
                MessageBox.Show("Student Deleted Successfully.", caption: "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Reset();
                GetAllStudent();
                Save.Text = "Save";
            }
        }
コード例 #27
0
        private async void Autenticar(string email, string pass)
        {
            try
            {
                FirebaseConfig config = new FirebaseConfig(GLOBAL.apiKey);

                FirebaseAuthProvider authProvider = new FirebaseAuthProvider(config);

                FirebaseAuthLink auth = await authProvider.SignInWithEmailAndPasswordAsync(email, pass);

                this.Hide();
                Principal main = new Principal();
                main.localId = auth.User.LocalId;
                main.token   = auth.FirebaseToken;
                main.email   = email;
                main.Show();
            }
            catch (FirebaseAuthException e)
            {
                MessageBox.Show("Ocurrio un error: " + e.InnerException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #28
0
ファイル: Program.cs プロジェクト: brokep/code-challenge-7
        static async Task Test()
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "XUCrsUoS3lxsQlYMcsBuIhGI21OH1N5iYM3sJCUD",
                BasePath   = "https://mynotes-87fd2.firebaseio.com/"
            };

            IFirebaseClient client   = new FirebaseClient(config);
            var             testNote = new Note()
            {
                Id   = Guid.NewGuid().ToString(),
                Date = DateTime.Now,
                Tags = new List <string>()
                {
                    "gulp", "front", "sass", "minify"
                },
                Text = "Set up gulp task in javascript projects to improve quality in front end architechture"
            };

            await client.PushAsync <Note>($"notes/{testNote.Id}", testNote);
        }
コード例 #29
0
ファイル: Program.cs プロジェクト: m1c1b/WebApp
        static void Generate()
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "r0Dx9Gi0gj7g3kZ4EJQodtFgOIq80IuBfBuko8HS",
                BasePath   = "https://fir-2d407.firebaseio.com/"
            };
            IFirebaseClient client = new FirebaseClient(config);

            FirebaseResponse response = client.Get("Last/Sensor values/Id");
            int    displacement       = Convert.ToInt16(response.Body);
            int    i      = displacement;
            Random random = new Random();

            while (true)
            {
                i++;
                FirebaseValue sensval = new FirebaseValue(i, 92 + Math.Round(random.NextDouble(), 2), DateTime.Now);
                client.Set("Sensor values/" + sensval.Id, sensval);
                client.Set("Last/Sensor values", sensval);
            }
        }
コード例 #30
0
        //
        public async Task <JsonResult> Cha() // pega programação máquina
        {
            string pama = string.Empty;
            string pamb = string.Empty;

            IFirebaseClient client;
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "MCPZ3qTPh8YdCQxk8aFvM59tWGoLuZUQb3fakIqJ",
                BasePath   = "https://notificacaohahaha.firebaseio.com/"
            };
            //
            var data = new Data
            {
                Id       = "4",
                Medidor  = "efefefef",
                Potencia = "44"
            };

            client = new FireSharp.FirebaseClient(config);
            SetResponse response = await client.SetTaskAsync("Information/" + "1", data);

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

            if (!string.IsNullOrEmpty(result.Id))
            {
            }
            //object[] arrayObj = new object[] { pama, pamb };
            //FireConector fire_class = new FireConector();
            ////
            //new FireConector().GetType().GetMethod("InsertData").Invoke(fire_class, arrayObj);

            //if (arrayObj != null)
            //{

            //}

            return(Json(new { data = "", results = 0, success = true }, JsonRequestBehavior.AllowGet));
        }
コード例 #31
0
        //
        #endregion

        #region POST - Maquina dados
        //
        //public JsonResult mpd(string m, int p)
        //{
        //    string sret = string.Empty;
        //    string horala = string.Empty;
        //    List<string> lista = new List<string>();
        //    try
        //    {
        //        Medidor medidor = db.Medidor.Where(a => a.MAC == m).FirstOrDefault();
        //        //
        //        if (medidor != null)
        //        {
        //            MedidorHistorico medidor_hist = new MedidorHistorico();
        //            //
        //            //foreach (TimeZoneInfo z in TimeZoneInfo.GetSystemTimeZones())
        //            //{
        //            //    if (z != null)
        //            //    {
        //            //        lista.Add(z.Id);
        //            //    }
        //            //}
        //            //
        //            DateTime timeUtc = DateTime.UtcNow;
        //            var brasilia = TimeZoneInfo.FindSystemTimeZoneById("Central Brazilian Standard Time");
        //            horala = String.Format("Hora Brasilia: {0}", TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).ToString());
        //            //
        //            int ano = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Year;
        //            int mes = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Month;
        //            int dia = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Day;
        //            int hora = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Hour;
        //            int min = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Minute;
        //            int seg = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Second;
        //            //
        //            medidor_hist.Id_Mac = medidor.Id;
        //            medidor_hist.DataHora = new DateTime(ano, mes, dia, hora, min, seg).AddHours(1);
        //            //medidor_hist.DataHora = DateTime.Now;
        //            medidor_hist.Potencia = p.ToString();
        //            //
        //            db.MedidorHistorico.Add(medidor_hist);
        //            db.SaveChanges();
        //            //
        //            sret = "ok";
        //        }
        //        else
        //        {
        //            sret = "Medidor não encontrado!";
        //        }
        //    }
        //    catch (Exception exc)
        //    {
        //        sret = exc.Message;
        //    }
        //    //
        //    return Json(new { data = sret, results = 1, success = true }, JsonRequestBehavior.AllowGet);
        //}
        ////
        //public async Task<JsonResult> mpd_teste(string m, int p)
        //{
        //    string sret = string.Empty;
        //    string horala = string.Empty;
        //    List<string> lista = new List<string>();
        //    try
        //    {
        //        Medidor medidor = db.Medidor.Where(a => a.MAC == m).FirstOrDefault();
        //        //
        //        if (medidor != null)
        //        {
        //            MedidorHistorico medidor_hist = new MedidorHistorico();
        //            //
        //            DateTime timeUtc = DateTime.UtcNow;
        //            var brasilia = TimeZoneInfo.FindSystemTimeZoneById("Central Brazilian Standard Time");
        //            horala = String.Format("Hora Brasilia: {0}", TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).ToString());
        //            //
        //            int ano = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Year;
        //            int mes = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Month;
        //            int dia = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Day;
        //            int hora = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Hour;
        //            int min = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Minute;
        //            int seg = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Second;
        //            //
        //            medidor_hist.Id_Mac = medidor.Id;
        //            medidor_hist.DataHora = new DateTime(ano, mes, dia, hora, min, seg).AddHours(1);
        //            medidor_hist.Potencia = p.ToString();
        //            //
        //            db.MedidorHistorico.Add(medidor_hist);
        //            db.SaveChanges();
        //            db.Entry(medidor_hist).Reload();
        //            //
        //            sret = await teste_firebase(medidor_hist.Id.ToString(), medidor.Id.ToString(), m, medidor.Descricao, p.ToString(), medidor_hist.DataHora);
        //        }
        //        else
        //        {
        //            sret = "Medidor não encontrado!";
        //        }
        //    }
        //    catch (Exception exc)
        //    {
        //        sret = exc.Message;
        //    }
        //    //
        //    return Json(new { data = sret, results = 1, success = true }, JsonRequestBehavior.AllowGet);
        //}
        //
        public async Task <string> teste_firebase(string id, string id_medidor, string mac_radiobase, string desc_medidor, string potencia, Nullable <System.DateTime> DataHora) // pega programação máquina
        {
            string sret = string.Empty;
            string pamb = string.Empty;

            IFirebaseClient client;
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "MCPZ3qTPh8YdCQxk8aFvM59tWGoLuZUQb3fakIqJ",
                BasePath   = "https://notificacaohahaha.firebaseio.com/"
            };
            //
            var data = new Data
            {
                Id                = id,
                Medidor           = mac_radiobase,
                Descricao_Medidor = desc_medidor,
                Id_Medidor        = id_medidor,
                Potencia          = potencia,
                DataHora          = DataHora.Value.ToShortDateString() + " " + DataHora.Value.ToShortTimeString()
            };

            client = new FireSharp.FirebaseClient(config);
            SetResponse response = await client.SetTaskAsync("Alertas/" + id, data);

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

            //
            if (!string.IsNullOrEmpty(result.Id))
            {
                sret = "ok";
            }
            else
            {
                sret = "nok";
            }
            //
            return(sret);
        }