using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Reflection; using System.Net.Mail; using CMS.Util; public partial class croatiaopen_forma : System.Web.UI.Page { string bodyHtml = null; int godina1=0; int godina2=0; int godinaMain = 0; int godinaRazlika; protected void Page_Load(object sender, EventArgs e) { } protected void Posalji_OnClick(object sender, EventArgs e) { sendMailBrinkster(); } private void sendMailBrinkster() { //string mailTo = "tomislav@multi-design.biz"; //string maleFrom = "tomislav@multi-design.biz"; string mailTo = "info@harmony-dance.hr"; //string mailTo = "spk-harmony@zg.t-com.hr;harmony@vz.t-com.hr;info@harmony-dance.hr;tomislav@multi-design.biz"; string maleFrom = "info@harmony-dance.hr"; string subject = "Prijava za Croatia Open"; string body = null; string standardPrijava = null; string latinPrijava = null; int i; Boolean greska = false; DateTime UtcNow = DateTime.UtcNow; //DateTime offset = DateTime. //Response.Write(DateTime.UtcNow); foreach (ListItem lstItem in standard.Items) { if (lstItem.Selected) { standardPrijava += lstItem.Text + " , "; } } foreach (ListItem lstItem in latin.Items) { if (lstItem.Selected) { latinPrijava += lstItem.Text + " , "; } } // body += "

Prijava za Croatia Open

"; body += ""; body += ""; body += ""; //body += ""; body += ""; body += ""; body += ""; body += ""; body += ""; body += ""; body += ""; body += ""; body += "
ManLady
Ime i prezime:" + name1.Text + "" + name2.Text + "
Godina rođenja:" + year1.Text + "" + year2.Text + "
Godina rođenja:" + godine1.Text + "." + godine2.Text + ".
Telefon:" + phone1.Text + "" + phone2.Text + "
email:" + mail1.Text + "" + mail2.Text + "
Zemlja:" + country.Text + "
Standard:" + standardPrijava + "
Latin:" + latinPrijava + "
Komentar:" + Poruka.Text + "
Datum:" + UtcNow.AddHours(2) + "
"; body += "

"; body += "Ovo je automatski generirana poruka, nemojte odgovarati na nju."; body += "

"; // if (name1.Text == "" || name1.Text == "Please enter Name & Surname!") { greska = true; name1.Text = "Please enter Name & Surname!"; } if (name2.Text == "" || name2.Text == "Please enter Name & Surname!") { greska = true; name2.Text = "Please enter Name & Surname!"; } if (godine1.Text == "Choose Year") { greska = true; //godine1.Text = "Please Choose Year"; } if (godine2.Text == "Choose Year") { greska = true; //godine2.Text = "Please Choose Year"; } if (country.Text == "" || country.Text == "Please enter Country representing") { greska = true; country.Text = "Please enter Country representing"; } //Response.Write((standardPrijava.Length)); //Response.Write((latinPrijava.Length)); if (standardPrijava == null && latinPrijava == null) { greska = true; Poslano.Text = "Please choose your category! "; } if (test.Text != "test") { greska = true; } //Response.Write(body); // //email = Email.Text; //body = Poruka.Text; // //Response.Write(MailSender.isEmail(email)); //if (MailSender.isEmail(email)) //{greska if (greska==false) { // MailMessage m = new MailMessage(); { //spk-harmony@zg.t-com.hr;harmony@vz.t-com.hr;info@harmony-dance.hr;tomislav@multi-design.biz m.From = new MailAddress(mailTo); //m.To.Add(new MailAddress(maleFrom)); m.To.Add(new MailAddress("spk-harmony@zg.t-com.hr")); m.To.Add(new MailAddress("harmony@vz.t-com.hr")); //m.To.Add(new MailAddress("tomislav@multi-design.biz")); m.Body = body; m.IsBodyHtml = true; m.Subject = subject; m.Priority = MailPriority.Normal; //m.Bcc = "tomislav@multi-design.biz"; //m.CC = new MailAddress("info@harmony-dance.hr"); //Note you could add a lot more Options and also could add them to the Sub. } System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(); smtp.Credentials = new System.Net.NetworkCredential(Convert.ToString(maleFrom), "harmonydance"); //smtp.Credentials = new System.Net.NetworkCredential(Convert.ToString(maleFrom), "1234tomi"); smtp.Host = "sendmail.brinkster.com"; smtp.Send(m); // Poslano.Text = "Your registration has been send."; name1.Text = ""; name2.Text = ""; godine1.SelectedIndex=0; godine2.SelectedIndex=0; phone1.Text = ""; phone2.Text = ""; mail1.Text = ""; mail2.Text = ""; country.Text = ""; standardPrijava = null; latinPrijava = null; Poruka.Text = ""; foreach (ListItem lstItem in standard.Items) { lstItem.Selected = false; } foreach (ListItem lstItem in latin.Items) { lstItem.Selected = false; } } else { Poslano.Text += "You have wrong input!"; } } private void nadjiVecuGodinu() { //Response.Write("godina1= " + godina1 + " : godina2= " + godina2); if (godina1!=0 && godina2!=0) { if (godina1 <= godina2) { godinaMain = godina1; } else { godinaMain = godina2; } //Response.Write("godinaMain= " + godinaMain); int godinaSada; DateTime UtcNow = DateTime.UtcNow; godinaSada = Convert.ToInt16(UtcNow.Year); godinaRazlika = godinaSada-godinaMain; //Response.Write("godinaRazlika= " + godinaRazlika); } // } protected void name2_TextChanged(object sender, EventArgs e) { } protected void name1_TextChanged(object sender, EventArgs e) { } protected void Poruka_TextChanged(object sender, EventArgs e) { } protected void year1_TextChanged(object sender, EventArgs e) { } protected void year2_TextChanged(object sender, EventArgs e) { } protected void mail1_TextChanged(object sender, EventArgs e) { } protected void mail2_TextChanged(object sender, EventArgs e) { } protected void country_TextChanged(object sender, EventArgs e) { } private void htmlSadrzaj() { } protected void godine1_SelectedIndexChanged(object sender, EventArgs e) { //godina1 = Convert.ToInt16(godine1.Text); //if(godine2.Text != "Choose Year") //{ //godina2 = Convert.ToInt16(godine2.Text); //} //nadjiVecuGodinu(); //Response.Write("godina1= " + godina1); } protected void godine2_SelectedIndexChanged(object sender, EventArgs e) { //godina2 = Convert.ToInt16(godine2.Text); //nadjiVecuGodinu(); //Response.Write("godina2= " + godina2); } protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { int i = 0; if (godine1.Text != "Choose Year" && godine2.Text != "Choose Year") { godina1 = Convert.ToInt16(godine1.Text); godina2 = Convert.ToInt16(godine2.Text); nadjiVecuGodinu(); foreach (ListItem lstItem in standard.Items) { if (lstItem.Selected) { // Response.Write(godinaRazlika+" i= " + i + " "); //Adult if (godinaRazlika >= 18 && i > 0) { lstItem.Selected = false; } //Youth if (godinaRazlika >= 16 && i > 1) { lstItem.Selected = false; } //Junior II if (godinaRazlika >= 14 && godinaRazlika <= 15 && (i < 1 || i > 2)) { lstItem.Selected = false; } //Junior I if (godinaRazlika >= 12 && godinaRazlika <= 13 && (i < 2 || i > 3)) { lstItem.Selected = false; } //Juveniles II if (godinaRazlika >= 10 && godinaRazlika <= 11 && (i < 3 || i > 4)) { lstItem.Selected = false; } //Juveniles I if (godinaRazlika <= 9 && i < 4) { lstItem.Selected = false; } // } i++; } } } protected void CheckBoxList2_SelectedIndexChanged(object sender, EventArgs e) { int i = 0; if (godine1.Text != "Choose Year" && godine2.Text != "Choose Year") { godina1 = Convert.ToInt16(godine1.Text); godina2 = Convert.ToInt16(godine2.Text); nadjiVecuGodinu(); foreach (ListItem lstItem in latin.Items) { if (lstItem.Selected) { // Response.Write(godinaRazlika+" i= " + i + " "); //Adult if (godinaRazlika >= 18 && i > 0) { lstItem.Selected = false; } //Youth if (godinaRazlika >= 16 && i > 1) { lstItem.Selected = false; } //Junior II if (godinaRazlika >= 14 && godinaRazlika <= 15 && (i < 1 || i > 2)) { lstItem.Selected = false; } //Junior I if (godinaRazlika >= 12 && godinaRazlika <= 13 && (i < 2 || i > 3)) { lstItem.Selected = false; } //Juveniles II if (godinaRazlika >= 10 && godinaRazlika <= 11 && (i < 3 || i > 4)) { lstItem.Selected = false; } //Juveniles I if (godinaRazlika <= 9 && i < 4) { lstItem.Selected = false; } // } i++; } } } }