private void btnSave_Click(object sender, EventArgs e) { p.Id = lbDocId.Text.Trim(); p.Name = txtName.Text.Trim(); p.PathImage = txtPath.Text.Trim(); p.Detail = txtDetail.Text.Trim(); p.Image = ImageBox.Image == null ? "" : FSBHelper.ConvertImageToBase64(ImageBox.Image); UploadImageToFireStore(); //FirebaseSave(); }
private void dgv_CellEnter(object sender, DataGridViewCellEventArgs e) { //pictureBox1.ImageLocation = dgv["PathImage", e.RowIndex].Value.ToString(); string _stringImage = dgv["Image", e.RowIndex].Value.ToString(); if (String.IsNullOrEmpty(_stringImage)) { pic.Image = null; } else { pic.Image = FSBHelper.ConvertBase64ToImage(_stringImage); //pic.BackColor = Color.Transparent; } _selectedDocumentId = dgv["Id", e.RowIndex].Value.ToString(); UpdateUI(); }
private async void GetDocument(string id) { StringBuilder s = new StringBuilder(); DocumentReference docRef = db.Collection("Product").Document(id); DocumentSnapshot snapshot = await docRef.GetSnapshotAsync(); if (snapshot.Exists) { p = snapshot.ConvertTo <ProductRecord>(); lbDocId.Text = p.Id; txtName.Text = p.Name; txtDetail.Text = p.Detail; txtPath.Text = p.PathImage; ImageBox.Image = String.IsNullOrEmpty(p.Image) ? null : FSBHelper.ConvertBase64ToImage(p.Image); } else { MessageBox.Show("Document not exits!"); } UpdateUI(); }