Пример #1
0
        public async Task BackupDocumentChat()
        {
            try
            {
                _firebaseClient = _iDbService.GetFirebaseClient(CloudConfigurationManager.GetSetting("Firebasenode"));
                FirebaseResponse chatResponse = _firebaseClient.Get("ChatRoom");
                dynamic rooms = JsonConvert.DeserializeObject(chatResponse.Body);

                foreach (var room in rooms)
                {
                    dynamic r = room;
                    await Backup(r);
                }
            }
            catch (Exception e)
            {
                //wait and retry 5 times
                if (reTry > 0)
                {
                    reTry--;
                    Trace.TraceInformation("Restart BackupFirebaseChat... in 1 min " + reTry);
                    Thread.Sleep(60000);
                    BackupDocumentChat().Wait();
                }
                else
                {
                    Trace.TraceError("Error in BackupChat " + e.Message);
                }
            }
        }
Пример #2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FirebaseClient(ifc);

                FirebaseResponse res2    = client.Get("Users/" + usrPc);
                PcClass          ResUser = res2.ResultAs <PcClass>();
                var CurUser = new PcClass()
                {
                    pcname = usrPc
                };

                if (!PcClass.IsEqual(ResUser, CurUser))
                {
                    var std2 = new PcClass()
                    {
                        pcname = usrPc,
                    };
                    var updater = client.Set("Users/" + usrPc, std2);
                }


                var res = client.Get("Users/" + usrPc);
                var std = new UserClass();
                std = res.ResultAs <UserClass>();

                if (std.activated == "True")
                {
                    exportToolStripMenuItem.Enabled   = true;
                    activateToolStripMenuItem.Enabled = false;
                    this.Text = "Advanced QR - Premium";
                }
                else
                {
                    exportToolStripMenuItem.Enabled   = false;
                    activateToolStripMenuItem.Enabled = true;
                }
            }
            catch
            {
                MessageBox.Show("Failed connection to Server!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
        private void venAppen_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(config);
                if (client != null)
                {
                    this.CenterToScreen();
                    this.Size        = Screen.PrimaryScreen.WorkingArea.Size;
                    this.WindowState = FormWindowState.Normal;
                }
            }
            catch
            {
                MessageBox.Show("No Internet or Connection Problem");
            }



            string ids = "Pending";

            FirebaseResponse response = client.Get("Venue/VenueReservation/");

            Dictionary <string, VenueReservation> Dick = response.ResultAs <Dictionary <string, VenueReservation> >();

            foreach (var find in Dick)
            {
                string ids1 = find.Value.approver;

                string typo = find.Value.approver_name;


                if (typo.Equals(VenueApp.ortype))
                {
                    if (ids.Equals(ids1))
                    {
                        dataGridView1.Update();
                        dataGridView1.Refresh();

                        dataGridView1.Rows.Add(find.Key, find.Value.name_of_project,
                                               find.Value.beneficiaries,
                                               find.Value.nature_of_project,
                                               find.Value.venue,
                                               find.Value.date_of_event,
                                               find.Value.time_from,
                                               find.Value.time_to,
                                               find.Value.approver,
                                               find.Value.committee_in_charge,
                                               find.Value.org_adviser_status,
                                               find.Value.org_dean_status,
                                               find.Value.org_president_status,
                                               find.Value.status);
                    }
                }
            }
        }
Пример #4
0
 public void StatusUpdateReject()
 {
     vruid = SaoPen.e25;
     FirebaseResponse resp    = client.Get("Venue/VenueReservation/" + vruid);
     VenueReservation vr      = resp.ResultAs <VenueReservation>();
     string           status1 = "Rejected";
     VenueReservation nr      = new VenueReservation()
     {
         approver            = vr.approver,
         approver_name       = vr.approver_name,
         beneficiaries       = vr.beneficiaries,
         committee_in_charge = vr.committee_in_charge,
         date                 = vr.date,
         date_of_event        = vr.date_of_event,
         description          = vr.description,
         id                   = vr.id,
         incharge             = vr.incharge,
         name_approver        = vr.name_approver,
         name_incharge        = vr.name_incharge,
         name_of_project      = vr.name_of_project,
         nature_of_project    = vr.nature_of_project,
         general_objective    = vr.general_objective,
         specific_objective   = vr.specific_objective,
         planning_statge      = vr.planning_statge,
         implementation       = vr.implementation,
         resource_req         = vr.resource_req,
         evaluation           = vr.evaluation,
         org_adviser          = vr.org_adviser,
         org_adviser_status   = vr.org_adviser_status,
         org_dean             = vr.org_dean,
         org_dean_status      = vr.org_dean_status,
         org_name             = vr.org_name,
         org_president        = vr.org_president,
         org_president_status = vr.org_president_status,
         org_type             = vr.org_type,
         status               = status1,
         time_from            = vr.time_from,
         time_to              = vr.time_to,
         venue                = vr.venue,
         readap               = vr.readap
     };
     var setmeup = client.Set("Venue/VenueReservation/" + vruid, nr);
 }
        public void Get()
        {
            _firebaseRequestManagerMock.Setup(firebaseRequestManager => firebaseRequestManager.Get("todos"))
            .Returns(_expectedResponse);

            FirebaseResponse firebaseResponse = _firebaseClient.Get("todos");

            Assert.NotNull(firebaseResponse);
            Assert.AreEqual(firebaseResponse.Body, _expected.ToJson());
        }
Пример #6
0
        public ActionResult AddAnnouncement(Models.Announcement announcement)
        {
            client = new FirebaseClient(config);
            FirebaseResponse response = client.Get("Announcements/");
            var list = new List <Announcement>();

            announcement.user = CurrentUser.Instance.User;
            AddToFirebase("Announcements/", announcement);
            return(View());
        }
Пример #7
0
        private void btnretrive_Click(object sender, EventArgs e)
        {
            var  res  = client.Get(@"Information/" + emplyID.Text);
            Data data = res.ResultAs <Data>();

            emplyfname.Text = data.Fname;
            emplylname.Text = data.Lname;

            //  MessageBox.Show("Retrived Sucessfully");
        }
Пример #8
0
        private void FormVen_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(config);
                if (client != null)
                {
                    this.CenterToScreen();
                    this.Size        = Screen.PrimaryScreen.WorkingArea.Size;
                    this.WindowState = FormWindowState.Normal;
                }
            }
            catch
            {
                MessageBox.Show("No Internet or Connection Problem");
            }
            bunifuMaterialTextbox1.Text = VenuePen.i1;
            bunifuMaterialTextbox2.Text = VenuePen.i2;
            bunifuMaterialTextbox3.Text = VenuePen.i3;
            bunifuMaterialTextbox4.Text = VenuePen.i4;
            bunifuMaterialTextbox5.Text = VenuePen.i5;


            string keys = VenuePen.i0;
            string ven  = bunifuMaterialTextbox4.Text;
            string acc  = "Accepted";

            FirebaseResponse response = client.Get("Venue/VenueReservation/");

            Dictionary <string, VenueReservation> Dick
                = response.ResultAs <Dictionary <string, VenueReservation> >();

            foreach (var find in Dick)
            {
                string name0  = find.Value.name_of_project;
                string venuss = find.Value.venue;
                string insc   = find.Value.incharge;

                if (insc.Equals("Accepted"))
                {
                    if (find.Value.date_of_event.Equals(VenuePen.i6))
                    {
                        MessageBox.Show("The Date and Venue is Taken");
                        button1.Enabled = false;
                        break;
                    }

                    break;
                }
                else
                {
                    button1.Enabled = true;
                }
            }
        }
Пример #9
0
        public bool isuserexist(string user)
        {
            var      getter = client.Get("employee/" + user);
            EmpModel emp    = getter.ResultAs <EmpModel>();

            if (emp != null)
            {
                return(true);
            }
            return(false);
        }
Пример #10
0
        public ActionResult Delete(int code)
        {
            Client = new FirebaseClient(Config);
            var response     = Client.Get("subscription/" + code);
            var subscription = response.ResultAs <Subscription>();

            subscription.deleted = 1;
            var response2 = Client.Update("subscription/" + code, subscription);

            return(View("Index"));
        }
Пример #11
0
        public ActionResult Enter(int code)
        {
            Client = new FirebaseClient(Config);
            var response     = Client.Get("subscription/" + code);
            var subscription = response.ResultAs <Subscription>();

            subscription.numberofentrence++;
            var response2 = Client.Update("subscription/" + code, subscription);

            return(View("Index"));
        }
        public static List <AttendanceModel> RetrieveAbsence(string lessoncode)
        {
            client   = new FireSharp.FirebaseClient(config);
            response = client.Get($"/{lessoncode}");

            string responseBody         = response.Body;
            var    firebaseLookup       = JsonConvert.DeserializeObject <Dictionary <string, AttendanceModel> >(responseBody);
            List <AttendanceModel> data = firebaseLookup.Values.ToList();

            return(data);
        }
        public static List <StudentModel> RetrieveStudents()
        {
            client   = new FireSharp.FirebaseClient(config);
            response = client.Get("/Students");

            string responseBody   = response.Body;
            var    firebaseLookup = JsonConvert.DeserializeObject <Dictionary <string, StudentModel> >(responseBody);
            var    data           = firebaseLookup.Values.ToList();

            return(data);
        }
Пример #14
0
        private void btnObtener_Click(object sender, EventArgs e)
        {
            var        res = client.Get(@"Estudiantes/" + txtId.Text);
            Estudiante std = res.ResultAs <Estudiante>();

            txtNombre.Text  = std.Nombre;
            txtCurso.Text   = std.Curso;
            txtSeccion.Text = std.Seccion;

            MessageBox.Show("Los datos obtenidos son:");
        }
Пример #15
0
        public void Set()
        {
            var todo = new Todo
            {
                name     = "Execute SET",
                priority = 2
            };
            var response = _client.Set("todos/set", todo);
            var result   = response.ResultAs <Todo>();

            Assert.NotNull(response);
            Assert.AreEqual(todo.name, result.name);

            // overwrite the todo we just set
            response = _client.Set("todos", todo);
            var getResponse = _client.Get("/todos/set");

            result = getResponse.ResultAs <Todo>();
            Assert.Null(result);
        }
Пример #16
0
        private void StudentChangedHelperMethod()
        {
            FirebaseResponse responseStudent = client.Get(@"Students/" + this.student.StudentNumber);
            Student          updatedStudent  = responseStudent.ResultAs <Student>();

            // update the student in this.
            this.student = updatedStudent;

            // call the method to update the labels
            this.Invoke(this.updateStudentLabels);
        }
 private void btnTraceDevices_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         firebaseClient = new FireSharp.FirebaseClient(config);
         if (String.IsNullOrWhiteSpace(cmbIssueCountry.Text) || String.IsNullOrWhiteSpace(cmbIssueCity.Text) || String.IsNullOrWhiteSpace(txtDeviceID.Text))
         {
             MessageBox.Show("A required field was not filled", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             deviceCode = countryCode + cityCode + txtDeviceID.Text;                    //Generating device code using concatenation of countryCode, cityCode and deviceID.
             FirebaseResponse firebaseResponse = firebaseClient.Get(cmbIssueCountry.SelectedItem.ToString() + "/" + cmbIssueCity.SelectedItem.ToString() + "/" + deviceCode);
             LatLong          location         = firebaseResponse.ResultAs <LatLong>(); // DB Result
             PointLatLng      loc = new PointLatLng(location.Latitude, location.Longitude);
             System.Windows.Media.Imaging.BitmapImage bitmapImage = new System.Windows.Media.Imaging.BitmapImage();
             bitmapImage.BeginInit();
             if (cmbIssueCountry.SelectedItem.ToString() == "Turkey")
             {
                 bitmapImage.UriSource = new Uri(@"C:\Users\YasinEmir\source\repos\Forensic\Forensic\TurkishFlag.png");
             }
             else if (cmbIssueCountry.SelectedItem.ToString() == "United Kingdom")
             {
                 bitmapImage.UriSource = new Uri(@"C:\Users\YasinEmir\source\repos\Forensic\Forensic\BritishFlag.png");
             }
             else if (cmbIssueCountry.SelectedItem.ToString() == "Germany")
             {
                 bitmapImage.UriSource = new Uri(@"C:\Users\YasinEmir\source\repos\Forensic\Forensic\GermanFlag.png");
             }
             else if (cmbIssueCountry.SelectedItem.ToString() == "France")
             {
                 bitmapImage.UriSource = new Uri(@"C:\Users\YasinEmir\source\repos\Forensic\Forensic\FrenchFlag.png");
             }
             else if (cmbIssueCountry.SelectedItem.ToString() == "Spain")
             {
                 bitmapImage.UriSource = new Uri(@"C:\Users\YasinEmir\source\repos\Forensic\Forensic\SpanishFlag.png");
             }
             else if (cmbIssueCountry.SelectedItem.ToString() == "Italy")
             {
                 bitmapImage.UriSource = new Uri(@"C:\Users\YasinEmir\source\repos\Forensic\Forensic\ItalianFlag.png");
             }
             bitmapImage.EndInit();
             GMap.NET.WindowsPresentation.GMapMarker marker2 = new GMap.NET.WindowsPresentation.GMapMarker(loc);
             Image image = new Image();
             image.Source  = bitmapImage;
             marker2.Shape = image;
             Gmap.Markers.Add(marker2);
         }
     }
     catch
     {
         MessageBox.Show("Sorry, We could not find a device with this ID number", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Пример #18
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            #region Condition
            if (string.IsNullOrWhiteSpace(TextBox1.Text) ||
                string.IsNullOrWhiteSpace(TextBox2.Text))
            {
                Response.Write("<script>alert('Please Fill All The Field')</script>");
                return;
            }
            #endregion
            try
            {
                var           res1           = client.Get(@"Doctors/");
                MyAppointment ResAppointment = res1.ResultAs <MyAppointment>();
                if (ResAppointment != null)
                {
                    counter = ResAppointment.counter;
                }
                for (int i = 1; counter > i; i++)
                {
                    FirebaseResponse res     = client.Get(@"Doctors/" + i);
                    MyAppointment    ResUser = res.ResultAs <MyAppointment>(); //database result
                    MyAppointment    CurUser = new MyAppointment()             //USER GIVEN INFO
                    {
                        Username = TextBox1.Text,
                        Password = TextBox2.Text
                    };

                    if (MyAppointment.IsEqual(ResUser, CurUser))
                    {
                        Response.Write("<script>alert('Successfully login!')</script>");
                        Response.Redirect("WebForm7.aspx");
                    }
                }
                Response.Write("<script>alert('Username and Password does not match!')</script>");
            }
            catch
            {
                Response.Write("<script>alert('User does not exist!')</script>");
            }
        }
Пример #19
0
        public List <T> Get <T>()
        {
            var name     = typeof(T).Name;
            var response = _client.Get($"{name}s/");

            if (response.Body == null || response.Body.Equals("null"))
            {
                return(new List <T>());
            }

            return(response.ResultAs <List <T> >());
        }
Пример #20
0
        private void button_add_Click(object sender, EventArgs e)
        {
            FirebaseResponse response = client.Get("BlackList/" + textBox_identityId.Text);

            BlackList responsedBlackList = response.ResultAs <BlackList>();

            BlackList currentBlackList = new BlackList()
            {
                IdentityId = textBox_identityId.Text
            };

            if (customerValidation(responsedBlackList, currentBlackList))
            {
                MessageBox.Show("Đối tượng đã tồn tại, xin vui lòng nhập lại chính xác!", "Thông báo");
            }

            else
            {
                addNewBadCustomer();
            }
        }
Пример #21
0
        private void selectBtn_Click(object sender, EventArgs e)
        {
            var       result = client.Get("Warehouse/" + widTxt.Text);
            Warehouse wrh    = result.ResultAs <Warehouse>();

            nameTxt.Text     = wrh.Name;
            priceTxt.Text    = wrh.Price;
            amountTxt.Text   = wrh.Amount;
            quantityTxt.Text = wrh.Quantity;
            categoryTxt.Text = wrh.Category;
            MessageBox.Show("Data Retrieved successfully");
        }
Пример #22
0
        private void Ready()
        {
            Receive <ChatCreatedEvent>(@event =>
            {
                string path        = "user-chats/" + _userId;
                string lastMessage = String.Format("{0} created a chat with you", @event.Creator.Login);
                if (@event.Creator.Id == _userId)
                {
                    lastMessage = "You created a chat";
                }

                var userChat = new UserChatDto()
                {
                    ChatId            = @event.Id,
                    UserId            = _userId,
                    LastMessage       = lastMessage,
                    LastMessageAuthor = @event.Creator.Login,
                    LastMessageDate   = DateTime.UtcNow
                };

                userChat.Participants = @event.Participants
                                        .Select(x => new ChatParticipantDto()
                {
                    Id = x.Id, Login = x.Login
                }).ToList();
                string participantNames = string.Join(", ",
                                                      userChat.Participants.Where(x => x.Id != _userId).Select(x => x.Login));
                userChat.Name = participantNames;

                client.Push(path, userChat);
            });

            Receive <ChatMessageAddedEvent>(@event =>
            {
                string path = "user-chats/" + _userId;
                FirebaseResponse response = client.Get(path);
                Dictionary <string, UserChatDto> chats = response.ResultAs <Dictionary <string, UserChatDto> >();

                if (chats != null && chats.Any(x => x.Value.ChatId == @event.ChatId))
                {
                    var chat = chats.First(x => x.Value.ChatId == @event.ChatId);

                    string userChatPathLastMessage = String.Format("user-chats/{0}/{1}/LastMessage", _userId, chat.Key);
                    client.Set(userChatPathLastMessage, @event.Message);

                    string userChatPathLastMessageAuthor = String.Format("user-chats/{0}/{1}/LastMessageAuthor", _userId, chat.Key);
                    client.Set(userChatPathLastMessageAuthor, @event.Author.Login);

                    string userChatPathLastMessageDate = String.Format("user-chats/{0}/{1}/LastMessageDate", _userId, chat.Key);
                    client.Set(userChatPathLastMessageDate, @event.Date);
                }
            });
        }
        //Recuperar los estudiantes de la base de datos
        static void RecuperarEstudiantes()
        {
            //instancia de un firebaseresponse
            //almacena lo recuperado de la base pasado el path de
            //lo que se quiere recuperar de la base
            //contEs es una variable de la base de datos que nos indica
            //cuantos estudiantes hay en la base de datos
            FirebaseResponse resEs = clienteDB.Get(@"ContEs");
            //se hace el cast de lo recibido a un entero
            int counter = int.Parse(resEs.ResultAs <string>());


            //lazo que nos permitira recuperar los estudiantes
            for (int i = 1; i <= counter; i++)
            {
                //Se recupera un esudiante a la vez pasandole
                //al metodo get el path del la estructura que almacena
                //los estudiantes y el id del estudiante
                var resEst = clienteDB.Get(@"Estudiante/" + i);

                //Cast del objeto resultante a un estudiante
                Estudiante e = resEst.ResultAs <Estudiante>();

                //Se añade el estudiante a la lista
                estudiantes.Add(e);
            }
        }
Пример #24
0
        public ActionResult NewS(string name, DateTime exp, int numberofentrence, string email, string phone, string adres)
        {
            ViewBag.Name             = name;
            ViewBag.Exp              = exp;
            ViewBag.Numberofentrence = numberofentrence;
            if (name == "")
            {
                ViewBag.Message = "No name";
                return(View("New"));
            }

            var subscription = new Subscription();

            subscription.name   = name;
            subscription.email  = email;
            subscription.phone  = phone;
            subscription.addres = adres;
            if (exp != DateTime.Now)
            {
                subscription.exp = exp;
            }
            else
            {
                subscription.exp = DateTime.MinValue;
            }

            if (numberofentrence > 0)
            {
                subscription.numberofentrence = numberofentrence;
            }
            else
            {
                subscription.numberofentrence = -1;
            }

            subscription.deleted = 0;
            Client = new FirebaseClient(Config);
            var response = Client.Get("subscription");

            if (response.Body != "null")
            {
                var s = response.ResultAs <List <Subscription> >();
                subscription.code = s.Count;
                var response2 = Client.Set("subscription/" + s.Count, subscription);
            }
            else
            {
                var response2 = Client.Set("subscription/" + "0", subscription);
            }

            return(View("Index"));
        }
Пример #25
0
        private List <Course> RetrieveCoursesFromFirebase()
        {
            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = client.Get("Courses");
            dynamic          data     = JsonConvert.DeserializeObject <dynamic>(response.Body);
            var list = new List <Course>();

            foreach (var course in data)
            {
                list.Add(JsonConvert.DeserializeObject <Course>(((JProperty)course).Value.ToString()));
            }
            return(list);
        }
Пример #26
0
        public List <Post> RetrievePostsFromFirebase()
        {
            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = client.Get("Posts");
            dynamic          data     = JsonConvert.DeserializeObject <dynamic>(response.Body);
            var list2 = new List <Post>();

            foreach (var post in data)
            {
                list2.Add(JsonConvert.DeserializeObject <Post>(((JProperty)post).Value.ToString()));
            }
            return(list2);
        }
Пример #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string newAdmin = logInpage.deneme.ID;

            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse resp     = client.Get(@"Akademisyen/" + newAdmin);
            AdminUser        respUser = resp.ResultAs <AdminUser>();

            DersCheckBox1.Text = respUser.Dersler;
            String adminName = respUser.Isim;

            IsimLabel.Text = ("Hosgeldiniz " + adminName);
        }
Пример #28
0
        public int RoomCounter()
        {
            List <Room> roomList  = new List <Room>();
            var         data      = client.Get("/Rooms");
            var         dList     = JsonConvert.DeserializeObject <IDictionary <string, Room> >(data.Body);
            int         roomCount = 0;

            foreach (var item in dList)
            {
                roomCount += 1;
            }
            return(roomCount);
        }
Пример #29
0
        private string GetID()
        {
            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = client.Get("Store");
            dynamic          data     = JsonConvert.DeserializeObject <dynamic>(response.Body);
            var list = new List <Store>();

            foreach (var item in data)
            {
                list.Add(JsonConvert.DeserializeObject <Store>(((JProperty)item).Value.ToString()));
            }
            return((list.Count + 1).ToString());
        }
Пример #30
0
        public IActionResult Index()
        {
            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = client.Get("Store");
            dynamic          data     = JsonConvert.DeserializeObject <dynamic>(response.Body);
            var list = new List <Store>();

            foreach (var item in data)
            {
                list.Add(JsonConvert.DeserializeObject <Store>(((JProperty)item).Value.ToString()));
            }
            return(View(list));
        }
Пример #31
0
        protected void Page_Load(object sender, EventArgs e)
        {
            provider         = new FirebaseAuthProvider(con);
            txtusername.Text = MyUser.email;
            try
            {
                client = new FireSharp.FirebaseClient(config);

                if (client != null)
                {
                    //Response.Write("<script>alert('Connection is established')</script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

            if (MyUser.email == null)
            {
                Response.Redirect("WebForm1.aspx");
            }

            if (!IsPostBack)
            {
                var           res1           = client.Get(@"Doctors/");
                MyAppointment ResAppointment = res1.ResultAs <MyAppointment>();
                if (ResAppointment != null)
                {
                    counter = ResAppointment.counter;
                }
                for (int ii = 1; counter >= ii; ii++)
                {
                    var           res             = client.Get(@"Doctors/" + ii);
                    MyAppointment ResAppointment1 = res.ResultAs <MyAppointment>();
                    DropDownList1.Items.Add(new ListItem(ResAppointment1.Fullname));
                }
            }
        }