protected void gvwResult2_SelectedIndexChanged(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { GridViewRow row = gvwResult2.SelectedRow; //Ova 2 reda ispod bi trebala da preetvaraju string u Title Case (using System.Globalization) //TextInfo myTI = new CultureInfo("en-US", false).TextInfo; //string opstina= myTI.ToTitleCase(myTI.ToLower(row.Cells[5].Text)); int grad = temp.GetGradByOpstina(row.Cells[5].Text); int filijala = temp.getFilijalaByKS(row.Cells[9].Text); Response.Redirect("Registracija.aspx?" + "&JMBG=" + Server.UrlEncode(row.Cells[1].Text) + "&Prezime=" + Server.UrlEncode(row.Cells[2].Text) + "&Ime=" + Server.UrlEncode(row.Cells[3].Text) + "&Adresa=" + Server.UrlEncode(row.Cells[4].Text) + "&Opstina=" + grad + "&Telefon=" + Server.UrlEncode(row.Cells[6].Text) + "&Telefon2=" + Server.UrlEncode(row.Cells[7].Text) + "&Mobitel=" + Server.UrlEncode(row.Cells[8].Text) + "&EmailKS=" + Server.UrlEncode(row.Cells[9].Text) + "&Filijala=" + filijala); } }
protected void btnEmailKS_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { string grad = temp.GetGradByID(ddlOpstina.SelectedIndex+1); int filijala = temp.getFilijalaByKS(Request.QueryString["emailKS"]); string bm = temp.getBM(filijala); //if (filijala == "1300") // bm = "*****@*****.**"; //else if (filijala == "1500") // bm = "*****@*****.**"; //else if (filijala == "1800") // bm = "*****@*****.**"; //else // ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Nešto nije u redu!');", true); string poruka = "Poštovani/Poštovana,<br/><br/>" + "Na sporazumu " + txtSporazum.Text + " su upisani sledeći podaci:<br/>" + "JMBG: " + txtJMBG.Text + ";<br/>Adresa: " + txtAdresa.Text + ";<br/>Opština: " + grad + ";<br/>Telefon: " + txtTelefon.Text + ";<br/>Telefon2: " + txtTelefon2.Text + ";<br/>Mobitel: " + txtMobitel.Text + "<br/><br/>Molim Vas da izvršite izmjenu u registru lica."; //MessageBox.Show(poruka); MailMessage msg = new MailMessage(); System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(); try { msg.Subject = "Izmijenjeni podaci klijenta " + txtPrezime.Text + " " + txtIme.Text; msg.Body = poruka; // "Add Email Body Part"; msg.From = new MailAddress("*****@*****.**"); msg.To.Add(Request.QueryString["EmailKS"]); msg.CC.Add(bm); msg.IsBodyHtml = true; client.Host = "smtp-relay.gmail.com"; //System.Net.NetworkCredential basicauthenticationinfo = new System.Net.NetworkCredential("*****@*****.**",""); client.Port = int.Parse("587"); client.EnableSsl = true; client.UseDefaultCredentials = false; //client.Credentials = basicauthenticationinfo; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.Send(msg); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Email nije otišao KS!' + ex.ToString());", true); //System.Windows.Forms.MessageBox.Show("Exception caught in CreateCopyMessage(): " + ex.ToString()); } } }