private void button1_Click(object sender, EventArgs e)
 {
     if (tbPassword.Text == "" || tbUsername.Text == "")
     {
         MessageBox.Show("Kullanıcı Adı veya Şifre Boş olamaz", "Hata Kod:1", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         string a;
         string b;
         a = tbUsername.Text;
         b = tbPassword.Text;
         int c;
         c = sorgu.FindPid(tbPassword.Text);
         string[] d = sorgu.sp_FindBU(b);
         if (d[1] == "Bölüm Yöneticisi")
         {
             BolumYoneticiPaneli frm3 = new BolumYoneticiPaneli();
             frm3.Bname.Text = d[0];
             frm3.Show();
             this.Hide();
         }
         else if (d[1] == "Fabrika Yöneticisi")
         {
             YoneticiPaneli frm2 = new YoneticiPaneli();
             frm2.Tb_Pid.Text = c.ToString();
             frm2.Show();
             this.Hide();
         }
         else if (d[1] == "Fabrika Sekreteri")
         {
             SekreterPaneli frm4 = new SekreterPaneli();
             frm4.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Buraya Giriş Hakkınız Yok", "Hata Kod:2", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (formadi_Tb.Text == "Form3")
            {
                string mailgonderen = mailfrom.Text;
                string sifre        = password.Text;

                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("Smtp.gmail.com");

                mail.From = new MailAddress(mailfrom.Text);
                mail.To.Add(mailto.Text);
                mail.Subject = konu.Text;
                mail.Body    = Message.Text.ToString();

                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential(mailgonderen, sifre);
                SmtpServer.EnableSsl   = true;
                try
                {
                    SmtpServer.Send(mail);
                    MessageBox.Show("Gönderildi");
                    BolumYoneticiPaneli frm3 = new BolumYoneticiPaneli();
                    frm3.Show();
                    this.Close();
                }
                catch (Exception esr)
                {
                    MessageBox.Show(esr.ToString());
                }
            }
            if (formadi_Tb.Text == "Form2")
            {
                string mailgonderen = mailfrom.Text;
                string sifre        = password.Text;

                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("Smtp.gmail.com");

                mail.From = new MailAddress(mailfrom.Text);
                mail.To.Add(mailto.Text);
                mail.Subject = konu.Text;
                mail.Body    = Message.Text.ToString();

                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential(mailgonderen, sifre);
                SmtpServer.EnableSsl   = true;
                try
                {
                    SmtpServer.Send(mail);
                    MessageBox.Show("Gonderildi");
                    YoneticiPaneli frm2 = new YoneticiPaneli();
                    frm2.Show();
                    this.Close();
                }
                catch (Exception esr)
                {
                    MessageBox.Show(esr.ToString());
                }
            }
        }