Exemplo n.º 1
0
        private void Ready()
        {
            Receive <ChatCreatedEvent>(@event =>
            {
                var chat = new ChatDto()
                {
                    ChatId = @event.Id
                };
                chat.Participants = @event.Participants
                                    .Select(x => new ChatParticipantDto()
                {
                    Id = x.Id, Login = x.Login
                }).ToList();

                string path           = "chats/" + @event.Id;
                PushResponse response = client.Push(path, chat);
            });

            Receive <ChatMessageAddedEvent>(@event =>
            {
                string path = String.Format("chats/{0}/{1}", @event.ChatId, "messages");
                ChatMessageDto messageDto = new ChatMessageDto()
                {
                    MessageId = @event.MessageId,
                    Date      = @event.Date,
                    Message   = @event.Message,
                    UserId    = @event.Author.Id,
                    UserName  = @event.Author.Login
                };
                PushResponse response = client.Push(path, messageDto);
            });
        }
Exemplo n.º 2
0
        public void Delete()
        {
            _client.Push("todos/push", new Todo
            {
                name     = "Execute PUSH4GET",
                priority = 2
            });

            var response = _client.Delete("todos/push");

            Assert.NotNull(response);
        }
        public void Delete()
        {
            _client.Push("todos/push", new Todo
            {
                name     = "Execute PUSH4GET",
                priority = 2
            });

            DeleteResponse response = _client.Delete("todos");

            Assert.NotNull(response);
            Assert.IsTrue(response.Success);
        }
 public bool AddCustomer(Customer c)
 {
     try
     {
         FirebaseResponse res = firebaseClient.Get($"Customer/{c.Id}");
         var res2             = res.ResultAs <Customer>();
     }
     catch (NullReferenceException n)
     {
         PushResponse response = firebaseClient.Push($"Customer/{c.Id}", c);
         Customer     result   = response.ResultAs <Customer>();
         return(true);
     }
     return(false);
 }
        // thêm dư liệu lên firebase
        public void AddToFireBase(DiscountDish discountDish)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = discountDish;
            PushResponse response = client.Push("DiscountDish/", data);

            data.DiscountDishID = response.Result.name;
            SetResponse setResponse = client.Set("DiscountDish/" + data.DiscountDishID, data);
            //kiem tra quan da co khuyen mai chua
            Discount quan           = new Discount();
            var      danhsachkmQuan = quan.getByidStore(discountDish.StoreID);
            int      dem            = 0;

            foreach (var item in danhsachkmQuan)
            {
                if (item.IDDiscountType == discountDish.DishcountTypeID)
                {
                    dem++;
                }
            }
            if (dem == 0)                                // nếu quán chưa có khuyến mãi này thêm khuyến mãi vào danh sách khuyến mãi quán
            {
                Discount a = new Discount();
                a.IDStore        = discountDish.StoreID;
                a.IDDiscountType = discountDish.DishcountTypeID;
                a.AddToFireBase(a);
            }
        }
Exemplo n.º 6
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtLink.Text == string.Empty)
     {
         MessageBox.Show("No link selected to Update."); return;
     }
     firebaseConfiqration();
     if (btnSave.Text == "Save")
     {
         UpdateItem mictco = new UpdateItem();
         mictco.UpdationLink = txtLink.Text;
         var          entdata   = mictco;
         PushResponse responses = client.Push(sTable, entdata);
         entdata.Id = responses.Result.name;
         SetResponse setResponse = client.Set(sTable + entdata.Id, entdata);
         MessageBox.Show("Link Saved");
     }
     else
     {
         item.UpdationLink = txtLink.Text;
         FirebaseResponse responses = client.Update(sTable + item.Id, item);
         MessageBox.Show("Link Updated");
     }
     FB_Management_Load(null, null);
     txtLink.Text = string.Empty;
     this.Close();
 }
Exemplo n.º 7
0
        private void addcategbtn_Click(object sender, EventArgs e)
        {
            Category category = new Category()
            {
                category = categoryTbox.Text,
                cid      = "0"
            };
            PushResponse catpush = client.Push("Categories/", category);
            string       cid     = catpush.Result.name;

            client.Set("Categories/" + cid + "/cid/", cid);
            loadcombobox();
            MessageBox.Show("Category " + categoryTbox.Text + " is Successfully Added...!");
            categoryTbox.Text          = "";
            SelCategCbox.SelectedIndex = -1;
        }
Exemplo n.º 8
0
        private void AddSubscriptionToFirebase(Subscription subscription)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = subscription;
            PushResponse response = client.Push("Subscriptions/", data);

            data.subscription_id = response.Result.name;
            SetResponse setResponse = client.Set("Subscriptions/" + data.subscription_id, data);
        }
        public void AddBloodDonationEventToFirebase(Event e)
        {
            firebaseClient = new FireSharp.FirebaseClient(firebaseConfig);
            var          data     = e;
            PushResponse response = firebaseClient.Push("BloodDonation/", data);

            data._id = response.Result.name;
            SetResponse setResponse = firebaseClient.Set("BloodDonation/" + data._id, data);
        }
Exemplo n.º 10
0
        // thêm dư liệu lên firebase
        public void AddToFireBase(District district)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = district;
            PushResponse response = client.Push("District/", data);

            data.DistrictID = response.Result.name;
            SetResponse setResponse = client.Set("District/" + data.DistrictID, data);
        }
Exemplo n.º 11
0
        private void AddUserToFirebase(User user)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = user;
            PushResponse response = client.Push("Users/", data);

            data.user_id = response.Result.name;
            SetResponse setResponse = client.Set("Users/" + data.user_id, data);
        }
Exemplo n.º 12
0
        // thêm dư liệu lên firebase
        public void AddToFireBase(BusinessType businessType)
        {
            client = new FireSharp.FirebaseClient(config);                           //kết nối với firebase
            var          data     = businessType;
            PushResponse response = client.Push("BusinessType/", data);              //gửi phản hồi lên bảng trên firebase

            data.BusinessTypeID = response.Result.name;
            SetResponse setResponse = client.Set("BusinessType/" + data.BusinessTypeID, data);
        }
Exemplo n.º 13
0
        // thêm dư liệu lên firebase
        public void AddToFireBase(UserType userType)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = userType;
            PushResponse response = client.Push("UserType/", data);

            data.UserTypeID = response.Result.name;
            SetResponse setResponse = client.Set("UserType/" + data.UserTypeID, data);
        }
Exemplo n.º 14
0
        private String AddToFirebase <T>(String path, T a)
        {
            client = new FirebaseClient(config);
            var data1 = a;

            PushResponse responses = client.Push(path, data1);

            return(responses.Result.name);
        }
Exemplo n.º 15
0
        public void AddFoodDonationToFirebase(FoodDonation food)
        {
            firebaseClient = new FireSharp.FirebaseClient(firebaseConfig);
            var          data     = food;
            PushResponse response = firebaseClient.Push("FoodDonation/", data);

            data._id = response.Result.name;
            SetResponse setResponse = firebaseClient.Set("FoodDonation/" + data._id, data);
        }
Exemplo n.º 16
0
        private void AddUsertodatabase(SignupUserModel registeruserinfo)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data         = registeruserinfo;
            PushResponse pushResponse = client.Push("User", data);

            data.Email = pushResponse.Result.name;
            SetResponse setResponse = client.Set("User" + data.Email, data);
        }
Exemplo n.º 17
0
        // thêm dư liệu lên firebase
        public void AddToFireBase(Province province)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = province;
            PushResponse response = client.Push("Provinces/", data);

            data.ProvinceID = response.Result.name;
            SetResponse setResponse = client.Set("Provinces/" + data.ProvinceID, data);
        }
Exemplo n.º 18
0
        private void AddPostToFirebase2(Post post)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = post;
            PushResponse response = client.Push("Posts/", data);

            data.post_id = response.Result.name;
            SetResponse setResponse = client.Set("Posts/" + data.post_id, data);
        }
Exemplo n.º 19
0
        // thêm dư liệu lên firebase
        public void AddToFireBase(Store store)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = store;
            PushResponse response = client.Push("Stores/", data);

            data.StoreID = response.Result.name;
            SetResponse setResponse = client.Set("Stores/" + data.StoreID, data);
        }
Exemplo n.º 20
0
        public void AddNew(Student student)
        {
            var          data     = student;
            PushResponse response = _firebaseClient.Push("Student/", data);

            data.Id = response.Result.name;

            SetResponse setResponse = _firebaseClient.Set("Student/" + data.Id, data);
        }
Exemplo n.º 21
0
        public void AddClothDonationToFirebase(ClothDonation cloth)
        {
            firebaseClient = new FireSharp.FirebaseClient(firebaseConfig);
            var          data     = cloth;
            PushResponse response = firebaseClient.Push("ClothDonation/", data);

            data._id = response.Result.name;
            SetResponse setResponse = firebaseClient.Set("ClothDonation/" + data._id, data);
        }
Exemplo n.º 22
0
        public void AddUserToFirebase(Models.Donator user)
        {
            firebaseClient = new FireSharp.FirebaseClient(firebaseConfig);
            var          data     = user;
            PushResponse response = firebaseClient.Push("Donator/", data);

            data._id = response.Result.name;
            SetResponse setResponse = firebaseClient.Set("Donator/" + data._id, data);
        }
        private void AddStudentToFirebase(Student student)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = student;
            PushResponse response = client.Push("Students/", data);

            data.student_id = response.Result.name;
            SetResponse setResponse = client.Set("Students/" + data.student_id, data);
        }
Exemplo n.º 24
0
        public void Create(Bitacora Bitacora)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = Bitacora;
            PushResponse response = client.Push("Bitacora/", data);

            data.Id = response.Result.Name;
            SetResponse setResponse = client.Set("Bitacora/" + data.Id, data);
        }
Exemplo n.º 25
0
        public void AddMoneyDonationToFirebase(MoneyDonation money)
        {
            firebaseClient = new FireSharp.FirebaseClient(firebaseConfig);
            var          data     = money;
            PushResponse response = firebaseClient.Push("MoneyDonation/", data);

            data._id = response.Result.name;
            SetResponse setResponse = firebaseClient.Set("MoneyDonation/" + data._id, data);
        }
Exemplo n.º 26
0
        private void AddCourseToFirebase2(Course course)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = course;
            PushResponse response = client.Push("Courses/", data);

            data.course_id = response.Result.name;
            SetResponse setResponse = client.Set("Courses/" + data.course_id, data);
        }
Exemplo n.º 27
0
        // thêm dư liệu lên firebase
        public void Add(View_Store view_Store)
        {
            client = new FireSharp.FirebaseClient(config);
            var          data     = view_Store;
            PushResponse response = client.Push("View_Store/", data);

            data.ViewID = response.Result.name;
            SetResponse setResponse = client.Set("View_Store/" + data.ViewID, data);
        }
Exemplo n.º 28
0
        public void AddVolunteerToFirebase(Models.Volunteer volunteer)
        {
            firebaseClient = new FireSharp.FirebaseClient(firebaseConfig);
            var          data     = volunteer;
            PushResponse response = firebaseClient.Push("Volunteer/", data);

            data._id = response.Result.name;
            SetResponse setResponse = firebaseClient.Set("Volunteer/" + data._id, data);
        }
Exemplo n.º 29
0
        public ActionResult CallFirebaseSync()
        {
            _client.Push("chat/", new
            {
                name = "someone",
                text = "Hello from backend :" + DateTime.Now.ToString("f")
            });

            return(Content("hello"));
        }
Exemplo n.º 30
0
        private void AddProductToFirebase(Models.Product product)
        {
            //throw new NotImplementedException();
            client = new FireSharp.FirebaseClient(config);
            var          data     = product;
            PushResponse response = client.Push("Products/", data);

            data.ID = response.Result.name;
            SetResponse setResponse = client.Set("Products/" + data.ID, data);
        }