private static async Task <bool> ValidateConnectionToFirestore(ServerProperties properties)
        {
            string         collectionName = "Test_firestore_collection";
            string         docName        = "Test_firestore_document";
            CredentialList credentialList = FindCredentialsAsset();

            FirestoreDb db = FirestoreDb.Create(GetProjectId(properties, credentialList));

            // Create a document with a random ID in the "Test_firestore_collection" collection.
            CollectionReference collection = db.Collection(collectionName);

            DocumentReference document =
                await collection.AddAsync(new { Name = docName });

            // A DocumentReference doesn't contain the data - it's just a path.
            // Let's fetch the current document.
            DocumentSnapshot snapshot = await document.GetSnapshotAsync();

            string receivedDocName = snapshot.GetValue <string>("Name");

            if (receivedDocName != docName)
            {
                await document.DeleteAsync();

                Debug.LogError($"Could not write a test document to firebase");
                return(false);
            }

            await document.DeleteAsync();

            return(true);
        }
예제 #2
0
        void Delete_An_Entire_Document()
        {
            DocumentReference docref = db.Collection("Testing2").Document("Doc1");

            docref.DeleteAsync();
            MessageBox.Show("Done");
        }
예제 #3
0
        public async void CloseClient()
        {
            string path = Path.GetFullPath(Path.Combine(System.AppContext.BaseDirectory, @"..\..\..\..\"));

            string clientNamePath    = path + "Jsons\\ClientName.json";
            string certificationPath = path + "Jsons\\Tor-Certificate.json";

            StreamReader reader = new StreamReader(clientNamePath);

            List <JsonClientName> data = JsonConvert.DeserializeObject <List <JsonClientName> >(reader.ReadToEnd());

            reader.Close();

            Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", certificationPath);

            FirestoreDb db = FirestoreDb.Create("tor-servers");

            try
            {
                DocumentReference delete = db.Collection("Clients").Document(data[0].Name);
                delete.DeleteAsync();
            }

            catch { }


            data[0].Name = "";
            File.WriteAllText(clientNamePath, JsonConvert.SerializeObject(data.ToArray()));
        }
예제 #4
0
 public async Task<bool> DeleteImageEntityFromDatabase(ImageEntity imageEntity)
 {
     FirestoreDb db = FirestoreDb.Create(GetConstant.FIRESTORE_ID);
     DocumentReference docRef = db.Collection("Images").Document(imageEntity.id.ToString());
     await docRef.DeleteAsync();
     return true;
 }
        private async void removerToolStripMenuItem_Click(Object sender, EventArgs e)
        {
            if (MessageBox.Show("Tem certeza que deseja excluir o parceiro?", "Confirmar exclusão", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                string path = AppDomain.CurrentDomain.BaseDirectory + @"pro-vantagens-firebase-adminsdk-5cf5q-82ec44750b.json";
                Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);

                FirestoreDb       db = FirestoreDb.Create("pro-vantagens");
                DocumentReference documentReference = db.Collection("partners").Document(partnerID);

                await documentReference.DeleteAsync();

                cboSearch.Text = "";
                try
                {
                    await loadPartnersAsync();
                }
                catch
                {
                }
            }
            else
            {
            }
        }
예제 #6
0
        public async Task <String> DeleteUser(String Id)
        {
            DocumentReference userDelete = _db.Collection("Usuarios").Document(id);
            await userDelete.DeleteAsync();

            return("Usuario con Id" + id + "eliminado correctamente");
        }
예제 #7
0
        public async Task <String> DeleteUser(String id)
        {
            DocumentReference userDelete = _db.Collection("Usuarios").Document(id);
            await userDelete.DeleteAsync();

            return("Usuario Deleteado con id: " + id);
        }
예제 #8
0
        public async Task <HttpResponseMessage> Remove(MT_Incident IMD)
        {
            Db = con.SurgeryCenterDb(IMD.Slug);
            IncidentResponse Response = new IncidentResponse();

            try
            {
                DocumentReference docRef = Db.Collection("MT_Incident").Document(IMD.Inci_Unique_ID);
                WriteResult       Result = await docRef.DeleteAsync();

                if (Result != null)
                {
                    Response.Status  = con.StatusSuccess;
                    Response.Message = con.MessageSuccess;
                    Response.Data    = null;
                }
                else
                {
                    Response.Status  = con.StatusNotDeleted;
                    Response.Message = con.MessageNotDeleted;
                    Response.Data    = null;
                }
            }
            catch (Exception ex)
            {
                Response.Status  = con.StatusFailed;
                Response.Message = con.MessageFailed + ", Exception : " + ex.Message;
            }
            return(ConvertToJSON(Response));
        }
        public async Task <String> deleteUser(String id)
        {
            DocumentReference cityRef = _db.Collection("Usuarios").Document(id);
            await cityRef.DeleteAsync();

            return("Usuario con Id: " + id + " eliminado correctamente");
        }
예제 #10
0
        private async void altoButton2_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("Eliminar", "Eliminando",
                                         MessageBoxButtons.YesNo,
                                         MessageBoxIcon.Question);

            // If the no button was pressed ...
            if (result == DialogResult.Yes)
            {
                // cancel the closure of the form.


                if (tipopedido == "CO")
                {
                    DocumentReference cityRef = database.Collection("Cotizaciones").Document(orden);
                    await cityRef.DeleteAsync();
                }
                else if (tipopedido == "PE")
                {
                    DocumentReference cityRef = database.Collection("Pedidos").Document(orden);
                    await cityRef.DeleteAsync();
                }
                else if (tipopedido == "RE")
                {
                    DocumentReference cityRef = database.Collection("Revisiones").Document(orden);
                    await cityRef.DeleteAsync();
                }
                MessageBox.Show("Eliminado");
            }
        }
예제 #11
0
        public async Taks <String> DeleteUser([FromQuery] String id)
        {
            DocumentReference userDelete = _db.Collection("Usuarios").Document(id);
            await userDelete.DeleteAsync();

            return("Usuario con id" + id + "eliminado");
        }
        public IActionResult Delete(UserModel userModel)
        {
            DocumentReference usrRef = firestoreDb.Collection("fthTest-users").Document(userModel.Id);

            usrRef.DeleteAsync().GetAwaiter().GetResult();
            return(RedirectToAction("Index", "Storage"));
        }
예제 #13
0
        public bool Delete <T>(T record) where T : Base
        {
            DocumentReference recordRef = fireStoreDb.Collection(collectionName).Document(record.Id);

            recordRef.DeleteAsync().GetAwaiter().GetResult();
            return(true);
        }
예제 #14
0
        public async Task <String> DeleteUser(String id)
        {
            DocumentReference userDelete = _db.Collection("Usuarios").Document(id);
            await userDelete.DeleteAsync();

            return("User with id: " + id + " was succesfully deleted");
        }
예제 #15
0
        public void deleteSharedDocument(SharedDocumentData sharedDocumentData, string emailSharedTo)
        {
            Boolean           connectionResult = connectToFirebase();
            DocumentReference doc1             = db.Collection("SharedDocuments").Document(emailSharedTo).Collection(sharedDocumentData.sharedBy).Document(sharedDocumentData.fileName);

            doc1.DeleteAsync();
        }
예제 #16
0
        public async Task <HttpResponseMessage> DeleteAsync(MT_User UMD)
        {
            //Db = con.SurgeryCenterDb(UMD.Project_ID);
            UserResponse Response = new UserResponse();

            try
            {
                DocumentReference docRef = Db.Collection("MT_User").Document(UMD.UM_Unique_ID);
                WriteResult       Result = await docRef.DeleteAsync();

                if (Result != null)
                {
                    Response.Status  = con.StatusSuccess;
                    Response.Message = con.MessageSuccess;
                    Response.Data    = null;
                }
                else
                {
                    Response.Status  = con.StatusNotDeleted;
                    Response.Message = con.MessageNotDeleted;
                    Response.Data    = null;
                }
            }
            catch (Exception ex)
            {
                Response.Status  = con.StatusFailed;
                Response.Message = con.MessageFailed + ", Exception : " + ex.Message;
            }
            return(ConvertToJSON(Response));
        }
예제 #17
0
        public async Task <HttpResponseMessage> Remove(MT_SurgicalProcedureInformationTemplates SPIT)
        {
            Db = con.SurgeryCenterDb(SPIT.Slug);
            SPITemplateResponse Response = new SPITemplateResponse();

            try
            {
                DocumentReference docRef = Db.Collection("MT_SurgicalProcedureInformationTemplates").Document(SPIT.Temp_Unique_ID);
                WriteResult       Result = await docRef.DeleteAsync();

                if (Result != null)
                {
                    Response.Status  = con.StatusSuccess;
                    Response.Message = con.MessageSuccess;
                    Response.Data    = SPIT;
                }
                else
                {
                    Response.Status  = con.StatusNotInsert;
                    Response.Message = con.MessageNotInsert;
                    Response.Data    = null;
                }
            }
            catch (Exception ex)
            {
                Response.Status  = con.StatusFailed;
                Response.Message = con.MessageFailed + ", Exception : " + ex.Message;
            }
            return(ConvertToJSON(Response));
        }
예제 #18
0
        public async System.Threading.Tasks.Task <ActionResult> DeleteNote(string id, string hastaismi)
        {
            db = FirestoreDb.Create("alzheimertakip-e1d1e");
            DocumentReference cityRef = db.Collection("Notes").Document(id);
            await cityRef.DeleteAsync();

            return(Redirect("/Admin/SendNote?hastaismi=" + hastaismi));
        }
예제 #19
0
        public async void DeleteTodoTask(string id)
        {
            DocumentReference document = firestoreDb
                                         .Collection("tasks")
                                         .Document(id);

            await document.DeleteAsync();
        }
예제 #20
0
        public async System.Threading.Tasks.Task <ActionResult> DeleteComplaint(string id, string hastaismi)
        {
            db = FirestoreDb.Create("alzheimertakip-e1d1e");
            DocumentReference cityRef = db.Collection("Complaints").Document(id);
            await cityRef.DeleteAsync();

            return(Redirect("/Home/SikayetGonder?hastaismi=" + hastaismi));
        }
예제 #21
0
        public void deleteDocument(string email, string fileName)
        {
            Boolean connectionResult = connectToFirebase();

            DocumentReference doc1 = db.Collection("UserDocuments").Document(email).Collection("MyDocuments").Document(fileName);

            doc1.DeleteAsync();
        }
예제 #22
0
 /*
  * Firestore'dan doküman silme işlemini üstlenen metodumuz
  */
 public async void DeletePlayer(string documentId)
 {
     // documentId bilgisini kullanarak players koleksiyonda ilgili dokümanı bul
     DocumentReference document = db.Collection("players").Document(documentId);
     // bulunan dokümanı sil
     // TODO: Buraya bir null check konulmalı.
     await document.DeleteAsync();
 }
        async public void eliminar()
        {
            String buscado = txtDocumentoBuscar.Text;

            DocumentReference cityRef = db.Collection("Paciente").Document(buscado);
            await cityRef.DeleteAsync();

            MessageBox.Show("Paciente eiminado");
        }
        async public void eliminar()
        {
            String buscado = txtNumeroHistorialBuscar.Text;

            DocumentReference cityRef = db.Collection("Historial_Clinico").Document(buscado);
            await cityRef.DeleteAsync();

            MessageBox.Show("Historial eliminado");
        }
예제 #25
0
        private static async Task DeleteDoc(string project)
        {
            FirestoreDb db = FirestoreDb.Create(project);
            // [START fs_delete_doc]
            DocumentReference cityRef = db.Collection("cities").Document("DC");
            await cityRef.DeleteAsync();

            // [END fs_delete_doc]
            Console.WriteLine("Deleted the DC document in the cities collection.");
        }
예제 #26
0
        public async Task <bool> deleteEvent(long event_Id)
        {
            SetEnvironmentVariable.setFirestoreEnvironmentVariable();
            FirestoreDb db = FirestoreDb.Create(GetConstant.FIRESTORE_ID);

            DocumentReference docRef = db.Collection("Event").Document(event_Id.ToString());
            await docRef.DeleteAsync();

            return(true);
        }
예제 #27
0
        public async Task <bool> deleteMailTemplate(string mail_Template_Id)
        {
            SetEnvironmentVariable.setFirestoreEnvironmentVariable();
            FirestoreDb db = FirestoreDb.Create(GetConstant.FIRESTORE_ID);

            DocumentReference docRef = db.Collection("Mail_Template").Document(mail_Template_Id);
            await docRef.DeleteAsync();

            return(true);
        }
예제 #28
0
        public async Task <bool> deleteUser(string user_Id)
        {
            SetEnvironmentVariable.setFirestoreEnvironmentVariable();
            FirestoreDb db = FirestoreDb.Create(GetConstant.FIRESTORE_ID);

            DocumentReference docRef = db.Collection("System_User").Document(user_Id);
            await docRef.DeleteAsync();

            return(true);
        }
예제 #29
0
        private void deleteDb()
        {
            foreach (string id in del_coll_id)
            {
                DocumentReference docref = db.Collection("stock").Document(id);
                docref.DeleteAsync();
            }

            del_coll_id.Clear();
        }
        public async Task <bool> deleteParticipationFormat(string id)
        {
            SetEnvironmentVariable.setFirestoreEnvironmentVariable();
            FirestoreDb db = FirestoreDb.Create(GetConstant.FIRESTORE_ID);

            DocumentReference docRef = db.Collection("ParticipationFormat").Document(id);
            await docRef.DeleteAsync();

            return(true);
        }