private void dataGridViewCozumEkle_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { tableLayoutPanel4.Controls.Clear(); string id = dataGridViewCozumEkle.Rows[dataGridViewCozumEkle.CurrentRow.Index].Cells["Hata_Id"].Value.ToString(); DataGridViewSelectGlobalHata = contextDb.Hata.FirstOrDefault(h => h.hataID.ToString() == id); textBoxCozumAciklama.Text = DataGridViewSelectGlobalHata.hataCozum; textBoxCozumTanım.Text = DataGridViewSelectGlobalHata.hataAd; textBoxHataAciklama.Text = DataGridViewSelectGlobalHata.hataAciklama; if (DataGridViewSelectGlobalHata != null) { var HataResimler = contextDb.HataResimler.Where(r => r.hataID == DataGridViewSelectGlobalHata.hataID).ToList(); if (HataResimler != null) { foreach (var item in HataResimler) { byte[] a = item.Resimler.resimData; MemoryStream ms = new MemoryStream(a); Image img = Image.FromStream(ms); PictureBox picture = new PictureBox(); picture.MouseClick += Picture_MouseClick; picture.SizeMode = PictureBoxSizeMode.StretchImage; picture.Image = img; tableLayoutPanel4.Controls.Add(picture); } } } }
private void buttonKaydet_Click(object sender, EventArgs e) { byte[] resimByte = null; Hata hata = new Hata(); hata.hataAd = textBoxHataTanim.Text; hata.hataAciklama = textBoxAciklama.Text; hata.kategoriID = (int)comboBoxKategori.SelectedValue; hata.hataCozum = null; hata.hataTarih = DateTime.Now; hata.kisiID = (int)comboBoxGonderenKisiler.SelectedValue; hata.cozumVarmi = false; hata.musteriID = (int)comboBoxMusteri.SelectedValue; contextDb.Hata.Add(hata); contextDb.SaveChanges(); if (Hatapictureboxes != null) { foreach (var item in Hatapictureboxes) { // pictureBoxHata.ImageLocation = item; Image img = item.Image; //hataImage.Add(item); using (MemoryStream ms = new MemoryStream()) { img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); resimByte = ms.ToArray(); } Resimler resim = new Resimler(); resim.resimData = resimByte; contextDb.Resimler.Add(resim); contextDb.SaveChanges(); HataResimler hataResimler = new HataResimler(); hataResimler.resimID = resim.resimID; hataResimler.hataID = hata.hataID; contextDb.HataResimler.Add(hataResimler); contextDb.SaveChanges(); } //veritabanına yeni hata oluşturuyoruz. } if (comboBoxMailGonder.SelectedItem != null) { string subject = "Hatanın Tanımı : " + textBoxHataTanim.Text; string HatayıRaporlayan = hata.Kisiler.fullName; string NOT = "NOT : HATA KODU İLE ARAMA YAPINIZ !"; string body = "Hatanın Tanımı : " + textBoxHataTanim.Text + "\n" + "\n" + "Hata Açıklama : " + textBoxAciklama.Text + "\n" + "\n" + "Arıza Hata Kodu : " + hata.hataID + "\n" + "\n" + NOT + "\n" + "\n" + "\n" + "Saygılarımla," + "\n" + HatayıRaporlayan; MailGonder((int)comboBoxMailGonder.SelectedValue, subject, body); } MessageBox.Show("Hata Mesajınız Sisteme İletilmiştir"); Hatapictureboxes.Clear(); tableLayoutPanel1.Controls.Clear(); //Mail işlemleri }
private void textBoxSearch_TextChanged(object sender, EventArgs e) { string sorgu = textBoxSearch.Text; searchHata = contextDb.Hata.FirstOrDefault(a => a.hataID.ToString() == sorgu || a.hataAd == sorgu); if (searchHata != null) { var dosyaBilgisi = contextDb.Dosya.FirstOrDefault(a => a.dosyaID == searchHata.cozumDosyaID); if (dosyaBilgisi != null) { buttonDosyaIndir.Enabled = true; labelCozumDosyaAdi.Text = dosyaBilgisi.dosyaAdi; } else { buttonDosyaIndir.Enabled = false; labelCozumDosyaAdi.Text = "Çözüm Dosyası Yok"; } textBoxCozum.Text = searchHata.hataCozum; textBoxCozumHataTanım.Text = searchHata.hataAd; var cozumResimler = contextDb.CozumResimler.Where(r => r.hataID == searchHata.hataID).ToList(); if (cozumResimler != null) { string deneme = ""; foreach (var item in cozumResimler) { deneme += item.Resimler.resimID + " "; byte[] a = item.Resimler.resimData; MemoryStream ms = new MemoryStream(a); Image img = Image.FromStream(ms); PictureBox picture = new PictureBox(); picture.MouseClick += Picture_MouseClick; picture.SizeMode = PictureBoxSizeMode.StretchImage; picture.Image = img; tableLayoutPanel2.Controls.Add(picture); } } } else { textBoxCozum.Text = ""; textBoxCozumHataTanım.Text = ""; labelCozumDosyaAdi.Text = "Çözüm Dosyası Yok"; tableLayoutPanel2.Controls.Clear(); } }
private void textBoxCozumHataAra_TextChanged(object sender, EventArgs e) { string sorgu = textBoxCozumHataAra.Text; searchHata = contextDb.Hata.FirstOrDefault(a => a.hataID.ToString() == sorgu || a.hataAd == sorgu); }