private void FormGlavna_Load(object sender, EventArgs e) { if (PersistanceManager.GetKorisnik() != null) { lblKorisnik.Text = "Prijavljeni korisnik: " + PersistanceManager.GetKorisnik().Ime + " " + PersistanceManager.GetKorisnik().Prezime + (PersistanceManager.GetKorisnik().Admin == true ? " (Sve privilegije)" : ""); } }
private void SendMail() { if (MessageBox.Show("Poslati e-mail klijentu? ", "Potvrda", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { string dir = System.IO.Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments), "ServisDB\\temp"); if (Directory.Exists(dir) == false) { Directory.CreateDirectory(dir); } string rednibroj = ((DataRowView)dgvPrijave.SelectedRows[0].DataBoundItem).Row["broj"].ToString(); string email = ((DataRowView)dgvPrijave.SelectedRows[0].DataBoundItem).Row["kupac_email"].ToString(); string fileName = dir + "\\Servisna prijava_" + rednibroj.Replace("/", "-"); var mailMessage = new MailMessage(); mailMessage.From = new MailAddress(PersistanceManager.GetKorisnik().Email); mailMessage.To.Add(email); mailMessage.Subject = "Obavještenje o završenom servisu"; mailMessage.IsBodyHtml = true; mailMessage.Body = "<span style='font-size: 12pt; color: black;'>Poštovani ,<br/> servis je završen (Nalog br." + rednibroj + "). Molimo Vas da vašu robu preuzmete u roku od 15 dana. <br/><br/> Pozdrav</span>"; var eml = fileName + ".eml"; //save the MailMessage to the filesystem mailMessage.Save(eml); //Open the file with the default associated application registered on the local machine Process.Start(eml); } }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl1.SelectedIndex == 1) { tbKupac.Focus(); if (tbRedniBroj.Text == "AUTO") { tbRadnik.Text = PersistanceManager.GetKorisnik().KorisnickoIme; } } else { textBox1.Focus(); textBox1.Select(); } }