Example #1
0
        private void buttonCozumGonder_Click(object sender, EventArgs e)
        {
            byte[] DosyaBytes;
            if (DataGridViewSelectGlobalHata != null)
            {
                DataGridViewSelectGlobalHata.hataCozum   = textBoxCozumAciklama.Text;
                DataGridViewSelectGlobalHata.cozumVarmi  = true;
                DataGridViewSelectGlobalHata.cozumTarihi = DateTime.Now;

                if (dosya != null)
                {
                    System.IO.FileInfo ff = new System.IO.FileInfo(dosya.FileName);
                    DosyaBytes = System.IO.File.ReadAllBytes(dosya.FileName);
                    Dosya dfile = new Dosya();
                    dfile.dosyaAdi    = dosya.SafeFileName;
                    dfile.dosyaData   = DosyaBytes;
                    dfile.dosyaFormat = ff.Extension;
                    contextDb.Dosya.Add(dfile);
                    int durum = contextDb.SaveChanges();
                    if (durum > 0)
                    {
                        DataGridViewSelectGlobalHata.cozumDosyaID = dfile.dosyaID;
                    }
                }

                int    a         = contextDb.SaveChanges();
                byte[] resimByte = null;
                foreach (var item in Cozumpictureboxes)
                {
                    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();

                    CozumResimler cozumResimler = new CozumResimler();
                    cozumResimler.resimID = resim.resimID;
                    cozumResimler.hataID  = DataGridViewSelectGlobalHata.hataID;
                    contextDb.CozumResimler.Add(cozumResimler);
                    contextDb.SaveChanges();
                }

                if (a > 0)
                {
                    MessageBox.Show("Cözümünüz Sisteme eklenmiştir");
                    string konu  = "Hata Kodu: " + DataGridViewSelectGlobalHata.hataID + " olan " + textBoxCozumTanım.Text + " Adlı Arızanın Çözümü";
                    string govde = "Çözüm Açıklama :" + textBoxCozumAciklama.Text + "\n Daha detalı bilgiye, çözüm dosyası ve çözüm resimlerine Sanlab Arıza Tespit Sistemi Programının çözüm ara kısmından hata Kodunu Aratarak ulaşabilirsiniz.";
                    MailGonder(DataGridViewSelectGlobalHata.Kisiler.kisiID, konu, govde);
                    TumCozumleriListele();
                }
            }

            CozumBolumunuTemizle();
        }
Example #2
0
        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
        }