protected void Page_Load(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { } }
protected void Page_Init(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { id = Convert.ToInt32(Request.QueryString["oglasID"]); oglasi priv = new oglasi(); priv = temp.GetPostByID(id); ddlSporazumBroj.SelectedValue = Request.QueryString["SporazumBroj"]; txtNaslovOglasa.Text = priv.Naslov; ddlVrstaOglasa.SelectedIndex = priv.VrstaOglasa.VrstaID; ddlKategorija.SelectedIndex = (int)priv.KategorijaID; ddlPodKategorija.DataSource = temp.getSelectPodKat((int)priv.KategorijaID); ddlPodKategorija.DataValueField = "PodkatID"; ddlPodKategorija.DataTextField = "NazivPodkategorije"; ddlPodKategorija.DataBind(); int pk = temp.GetPKID(id); if (pk - 27 > 0) ddlPodKategorija.SelectedIndex = temp.GetPKID(id) - 27; else ddlPodKategorija.SelectedIndex = pk - 1; txtCalendar.Text = Convert.ToDateTime(priv.VrijediDo).ToString("dd.MM.yyyy"); //txtCalendar.Text = priv.VrijediDo.Value.ToString(); txtOglas.Text = priv.TextOglasa; if (priv.Realizovan.HasValue) cbxRealizovan.Checked = priv.Realizovan.Value; else cbxRealizovan.Checked = false; } }
protected void btnLogin_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { Users user = temp.AuthenticateUser(txtUsername.Text, txtPassword.Text); if (user != null) { Session.Add("LoggedUser", user); if (Request.QueryString != null) { if (Request.QueryString["ReturnUrl"] != null) { Response.Redirect(Request.QueryString["ReturnUrl"]); } else { Response.Redirect("/Public/Default.aspx"); } } else { Response.Redirect("/Public/Default.aspx"); } } else { ResetFields(); } } }
protected void btnSaveOglas_Click(object sender, EventArgs e) { using(PoslovniKlubBL temp = new PoslovniKlubBL()) { try { DateTime vrijedi = DateTime.ParseExact(txtCalendar.Text, "dd.MM.yyyy", CultureInfo.InvariantCulture); if (vrijedi > DateTime.Now) { int korID = Convert.ToInt32(ddlSporazumBroj.SelectedValue); int katID = Convert.ToInt32(ddlKategorija.SelectedValue); int podkatID = Convert.ToInt32(ddlPodKategorija.SelectedValue); int VrstaID = Convert.ToInt32(ddlVrstaOglasa.SelectedValue); //HttpUtility.HtmlEncode(txtOglas.Text).Replace("\r\n", "<br/>"); ovo sam stavio zbog exporta oglasa u 2 reda if (!string.IsNullOrWhiteSpace(txtNaslovOglasa.Text) && !string.IsNullOrWhiteSpace(txtOglas.Text) && korID > 0 && VrstaID > 0 && katID > 0 && podkatID > 0) { temp.SavePost(korID, txtNaslovOglasa.Text, VrstaID, katID, podkatID, vrijedi, txtOglas.Text); ResetFields(); } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Niste unijeli/izabrali sve podatke!');", true); } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Pogrešan datum!');", true); } catch (Exception) { ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Niste unijeli/izabrali sve podatke!');", true); } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.RowState & DataControlRowState.Edit) > 0) { DropDownList ddlKategorija = (DropDownList)e.Row.FindControl("ddlKategorija"); ddlKategorija.DataSource = temp.GetAllKats(); ddlKategorija.DataValueField = "KategorijaId"; ddlKategorija.DataTextField = "NazivKategorije"; ddlKategorija.DataBind(); ddlKategorija.SelectedIndex = temp.getKatID(Convert.ToInt32(GridView1.DataKeys[e.Row.RowIndex].Value.ToString()))-1; //ddlKategorija.SelectedItem.Text = temp.getKateg(ddlKategorija.SelectedIndex); int pk = ddlKategorija.SelectedIndex + 1; DropDownList ddlPodkategorija = (DropDownList)e.Row.FindControl("ddlPodkategorija"); ddlPodkategorija.DataSource = temp.getSelectPodKat(ddlKategorija.SelectedIndex + 1); ddlPodkategorija.DataValueField = "PodkatID"; ddlPodkategorija.DataTextField = "NazivPodkategorije"; ddlPodkategorija.DataBind(); ddlPodkategorija.SelectedValue = temp.getDefPK(Convert.ToInt32(GridView1.DataKeys[e.Row.RowIndex].Value)).FirstOrDefault().PodkategorijaID.ToString(); } } } }
//protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) //{ // using (PoslovniKlubBL temp = new PoslovniKlubBL()) // { // DropDownList ddlKategorija = (DropDownList)GridView1.Rows[e.NewEditIndex].FindControl("ddlKategorija"); // string kateg = ddlKategorija.SelectedItem.Text.ToString(); // Label kat = (Label)GridView1.Rows[e.NewEditIndex].FindControl("lblKategorija"); // System.Windows.Forms.MessageBox.Show("Kat " + kat.Text + " kateg " + kateg); // ddlKategorija.SelectedIndex = temp.GetKat(kat.Text); // //napraviti string u koji staviti trenutno stanje pa to onda ubaciti u edit ddlKategorija // } //} protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { oglasi priv = new oglasi(); Label Kod = (Label)GridView1.Rows[e.RowIndex].FindControl("lblSporazumBroj"); DropDownList ddlVrsta = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("ddlVrsta"); DropDownList ddlKategorija = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("ddlKategorija"); DropDownList ddlPodKategorija = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("ddlPodKategorija"); TextBox txtNaslov = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtNaslov"); TextBox txtTextOglasa = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTextOglasa"); Label rok = (Label)GridView1.Rows[e.RowIndex].FindControl("lblVrijediDo"); int kat = temp.GetKat(ddlKategorija.SelectedValue); int podkat = temp.GetPodKat(ddlPodKategorija.SelectedValue); System.Windows.Forms.MessageBox.Show(ddlKategorija.SelectedValue + " katID: " + kat + " podkat " + ddlPodKategorija.SelectedValue + " podkatId: " + podkat); priv.OglasId = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); priv.KorisnikID = temp.GetUserBySpBr(Kod.Text); priv.VrstaID = temp.GetVrsta(ddlVrsta.SelectedValue); priv.KategorijaID = temp.GetKat(ddlKategorija.SelectedValue); priv.PodkategorijaID = temp.GetPodKat(ddlPodKategorija.SelectedValue); priv.Naslov = txtNaslov.Text; priv.TextOglasa = txtTextOglasa.Text; priv.VrijediDo = Convert.ToDateTime(rok.Text); priv.Realizovan = false; temp.UpdateOglas(priv); } }
protected void btnSaveOglas_Click(object sender, EventArgs e) { using(PoslovniKlubBL temp = new PoslovniKlubBL()) { DateTime vrijedi = DateTime.ParseExact(txtCalendar.Text, "dd.MM.yyyy", CultureInfo.InvariantCulture); oglasi priv = new oglasi(); priv = temp.GetPostByID(id); int korID = Convert.ToInt32(ddlSporazumBroj.SelectedValue); int katID = Convert.ToInt32(ddlKategorija.SelectedValue); //int podkatID = ddlPodKategorija.SelectedIndex; int podkatID = Convert.ToInt32(ddlPodKategorija.SelectedValue); int VrstaID = Convert.ToInt32(ddlVrstaOglasa.SelectedValue); priv.OglasId = id; priv.KorisnikID = korID; priv.Naslov = txtNaslovOglasa.Text; priv.KategorijaID = katID; priv.PodkategorijaID = podkatID; priv.VrstaID = VrstaID; priv.VrijediDo = vrijedi; priv.TextOglasa = txtOglas.Text; priv.Realizovan = cbxRealizovan.Checked; temp.UpdatePost(priv); ResetFields(); } }
protected void Page_Load(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { //List<Tag> tagoviTop14 = SqlDatatagsSource.GetType(); } }
protected void ddlPodkategorija_SelectedIndexChanged(object sender, EventArgs e) { using(PoslovniKlubBL temp = new PoslovniKlubBL()) { DropDownList ddlPodkat = (DropDownList)sender; GridViewRow row = (GridViewRow)ddlPodkat.NamingContainer; } }
protected void PromjenaKategorije(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { ddlIzborPodKategorije.Items.Clear(); ddlIzborPodKategorije.Items.Add(new ListItem("Izaberite podkategoriju oglasa", "0", true)); } }
protected void btnDodaj_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { if(temp.SaveBranch(txtNazivFilijale.Text, txtPTTFil.Text, txtCode.Text)) ResetFields(); else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Ova filijala već postoji!');", true); } }
protected void btnPisma_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { //DateTime start = Convert.ToDateTime(txtOD.Text); DateTime start = DateTime.ParseExact(txtOD.Text, "dd.MM.yyyy", CultureInfo.InvariantCulture); DateTime end = DateTime.ParseExact(txtDO.Text, "dd.MM.yyyy", CultureInfo.InvariantCulture); txtbrPisama.Text = Convert.ToString(temp.getBrPisama(start, end)); } }
protected void btnSpremi_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { int a = temp.SpremiNaslovAnkete(txtNazivAnkete.Text); temp.SpremiPitanja(txtQ1.Text, txtQ2.Text, txtQ3.Text, txtQ4.Text, txtQ5.Text, txtQ6.Text, txtQ7.Text, txtQ8.Text, txtQ9.Text, txtQ10.Text, txtQ11.Text, txtQ12.Text, txtQ13.Text, txtQ14.Text, txtQ15.Text, txtQ16.Text, txtQ17.Text, txtQ18.Text, txtQ19.Text, txtQ20.Text, a); } ResetFields(); }
protected void btnSaveUser_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { int opstina = Convert.ToInt32(ddlOpstina.SelectedValue); int mz = Convert.ToInt32(ddlMZ.SelectedValue); string komunik = ""; // = "Pogrešan izbor za dostavu Oglasnika!"; if (rblKomunikacija.Items[0].Selected == true) { komunik = "Email"; } else if (rblKomunikacija.Items[1].Selected == true) { komunik = "Pošta"; } else if (rblKomunikacija.Items[2].Selected == true) { komunik = "Email i pošta"; } else if (rblKomunikacija.Items[3].Selected == true) { komunik = "Ne prima oglasnik"; } else komunik = ""; if (!string.IsNullOrWhiteSpace(txtSporazum.Text) && !string.IsNullOrWhiteSpace(txtJMBG.Text) && !string.IsNullOrWhiteSpace(txtPrezime.Text) && !string.IsNullOrWhiteSpace(txtIme.Text) && !string.IsNullOrWhiteSpace(txtAdresa.Text) && ddlOpstina.SelectedIndex > -1) { if (temp.checkJMBG(txtJMBG.Text) == true) { if (ddlFilijala.SelectedIndex > 0) { try { temp.SaveUser(txtSporazum.Text, txtJMBG.Text, txtPrezime.Text, txtIme.Text, txtAdresa.Text, opstina, mz, txtTelefon.Text, txtTelefon2.Text, txtMobitel.Text, txtEmail.Text, ddlFilijala.SelectedIndex, komunik); ResetFields(); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Ovaj broj Sporazuma već postoji!');", true); } } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Niste izabrali filijalu!');", true); } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Korisnik sa ovim JMBG već postoji!');", true); } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Niste unijeli sve podatke. Pokušajte ponovo!');", true); } }
protected void gvwKorAnketa_SelectedIndexChanged(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { GridViewRow row = gvwKorAnketa.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)); Response.Redirect("IspuniAnketu.aspx?" + "&korisnik=" + Server.UrlEncode(row.Cells[1].Text)); } }
protected void Page_Load(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { string jmbg = Request.QueryString["JMBG"]; korisnici user = new korisnici(); user = temp.GetKorisnik(jmbg); int id = user.gradID.Value; string mjesto = temp.GetGradByID(id); string adresa=user.Adresa + ", " + mjesto; string telefoni = user.Telefon + "; " + user.Telefon2 + "; " + user.Mobitel; txtKorisnik.Text = user.Prezime + " " + user.Ime + "; " + user.JMBG + "; " + adresa + "; " + telefoni + "; " + user.email + "; " + user.KomunikPutem; } }
protected void btnKomentar_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { user = (Data.EntityFramework.DAL.Users)Session["LoggedUser"]; int uid = temp.GetUserIDByName(user.UserName); if (!string.IsNullOrWhiteSpace(txtKomentar.Text)) { temp.SaveComment(txtKomentar.Text, uid, temp.GetUserBySpBr(txtSporazum.Text)); ResetFields(); } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Žao mi je, ali ne možete upisati prazan komentar!');", true); } }
protected void btnDodaj_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { if (txtPass.Text == txtConfirmPass.Text) { if(temp.SaveUser1(txtUsername.Text, txtPass.Text)) ResetFields(); else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Ovaj user već postoji!');", true); } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Lozinka nije ista!');", true); } }
protected void btnDeleteAdd_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { int userID = temp.GetKorisnik(txtJMBG.Text).KorisnikID; //temp.GetUserBySpBr(row.Cells[0].Text); string url = "BrisanjeOglasa.aspx?" + "&SporazumBroj=" + userID; StringBuilder sb = new StringBuilder(); sb.Append("<script type = 'text/javascript'>"); sb.Append("window.open('"); sb.Append(url); sb.Append("');"); sb.Append("</script>"); ClientScript.RegisterStartupScript(this.GetType(), "script", sb.ToString()); } }
protected void btnDodaj_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { if (rblDodaj.Items[0].Selected == true) temp.SaveCat(txtNova.Text); else if (rblDodaj.Items[1].Selected == true) { int cat = Convert.ToInt32(ddlKategorija.SelectedValue); temp.SavePodCat(txtNova.Text, cat); } else MessageBox.Show("Nešto ne valja!"); ResetFields(); } }
protected void btnDodaj_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { if (rblDodaj.Items[0].Selected == true) temp.SaveCat(txtNova.Text); else if (rblDodaj.Items[1].Selected == true) { int cat = Convert.ToInt32(ddlKategorija.SelectedValue); temp.SavePodCat(txtNova.Text, cat); } else //MessageBox.Show("Nešto ne valja!"); ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Nešto ne valja!');", true); ResetFields(); } }
protected void grvKlijenti_SelectedIndexChanged(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { GridViewRow row = grvKlijenti.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[6].Text); Response.Redirect("Registracija.aspx?" + "&JMBG=" + Server.UrlEncode(row.Cells[2].Text) + "&Prezime=" + Server.UrlEncode(row.Cells[3].Text) + "&Ime=" + Server.UrlEncode(row.Cells[4].Text) + "&Adresa=" + Server.UrlEncode(row.Cells[5].Text) + "&Opstina=" + grad + "&Telefon=" + Server.UrlEncode(row.Cells[7].Text) + "&Telefon2=" + Server.UrlEncode(row.Cells[8].Text) + "&Mobitel=" + Server.UrlEncode(row.Cells[9].Text) + "&EmailKS=" + row.Cells[10].Text + "&Filijala=" + Server.UrlEncode(ddlFilijale.SelectedValue)); } }
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()); } } }
protected void ddlKategorija_SelectedIndexChanged(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { DropDownList ddlKategorija = (DropDownList)sender; GridViewRow row = (GridViewRow)ddlKategorija.NamingContainer; if (row != null) { if ((row.RowState & DataControlRowState.Edit) > 0) { DropDownList ddlPodkat = (DropDownList)row.FindControl("ddlPodKategorija"); ddlPodkat.DataSource = temp.getSelectPodKat(Convert.ToInt32(ddlKategorija.SelectedValue)); ddlPodkat.DataValueField = "PodkatId"; ddlPodkat.DataTextField = "NazivPodkategorije"; ddlPodkat.DataBind(); } } } }
protected void gvwResult1_SelectedIndexChanged(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { GridViewRow row = gvwResult1.SelectedRow; int userID = temp.GetKorisnikID(row.Cells[1].Text); string user = row.Cells[2].Text + " " + row.Cells[3].Text + "; " + row.Cells[1].Text + "; " + row.Cells[6].Text + "; " + row.Cells[7].Text; //Response.Redirect("UnosOglasa.aspx?" + "&SporazumBroj=" + userID); ovo sam koristio prije uvođenja novog prozora za novi oglas string url = "UnosOglasa.aspx?" + "&SporazumBroj=" + userID +"&korisnik=" + Server.UrlEncode(user); StringBuilder sb = new StringBuilder(); sb.Append("<script type = 'text/javascript'>"); sb.Append("window.open('"); sb.Append(url); sb.Append("');"); sb.Append("</script>"); ClientScript.RegisterStartupScript(this.GetType(), "script", sb.ToString()); } }
protected void gvwAktivni_SelectedIndexChanged(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { string subPath = "c:/prenos/Pisma"; // your code goes here bool isExists = System.IO.Directory.Exists(subPath); if (!isExists) System.IO.Directory.CreateDirectory(subPath); using (DocX pismo = DocX.Load(Server.MapPath("~/Content/60dana.docx"))) { //DirectoryInfo di = new DirectoryInfo("c:/Pisma/"); GridViewRow row = gvwAktivni.SelectedRow; user = (Data.EntityFramework.DAL.Users)Session["LoggedUser"]; int uid = temp.GetUserIDByName(user.UserName); temp.SavePismo(row.Cells[0].Text, temp.GetKorisnikID(row.Cells[1].Text), uid); string imePrezime = row.Cells[2].Text + " " + row.Cells[3].Text; string adresKorisnika = row.Cells[4].Text; string mjestoPTT = row.Cells[5].Text + " " + row.Cells[6].Text; pismo.ReplaceText("imeKorisnika", imePrezime); pismo.ReplaceText("adresaKorisnika", adresKorisnika); pismo.ReplaceText("mjestoKorisnika", mjestoPTT); pismo.ReplaceText("clanDo", row.Cells[8].Text); DateTime date = DateTime.Now; pismo.ReplaceText("today", date.ToString("d")); MemoryStream ms = new MemoryStream(); pismo.SaveAs(ms); Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=\\60dana_" + imePrezime + ".docx"); Response.ContentType = "application/msword"; ms.WriteTo(Response.OutputStream); Response.End(); } } }
protected void btnNewAdd_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { int userID = temp.GetKorisnik(txtJMBG.Text).KorisnikID; //temp.GetUserBySpBr(row.Cells[0].Text); string user = txtPrezime.Text + " " + txtIme.Text + "; " + txtJMBG.Text + "; " + txtTelefon.Text + "; " + txtMobitel.Text; //Response.Redirect("UnosOglasa.aspx?" + "&SporazumBroj=" + userID + "&korisnik=" + Server.UrlEncode(user)); ovo sam koristio prije uvođenja novog prozora za novi oglas string url = "UnosOglasa.aspx?" + "&SporazumBroj=" + userID + "&korisnik=" + Server.UrlEncode(user); StringBuilder sb = new StringBuilder(); sb.Append("<script type = 'text/javascript'>"); sb.Append("window.open('"); sb.Append(url); sb.Append("');"); sb.Append("</script>"); ClientScript.RegisterStartupScript(this.GetType(), "script", sb.ToString()); //string url = "&SporazumBroj=" + userID + "&korisnik=" + Server.UrlEncode(user); //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('UnosOglasa.aspx? + url',null, 'height=800,width=600,status=yes,toolbar=yes,menubar=yes,location=yes');",true); } }
protected void gvwOglasi_SelectedIndexChanged(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { GridViewRow row = gvwOglasi.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 ogl = temp.GetPostID(row.Cells[0].Text); //int vrsta = temp.GetVrsta(row.Cells[1].Text); //int kat = temp.GetKat(row.Cells[2].Text); ////int podKat = temp.GetPodKat(row.Cells[3].Text); Response.Redirect("EditOglasa.aspx?" + "&oglasID=" + Server.UrlEncode(row.Cells[0].Text) + "&SporazumBroj=" + Server.UrlEncode(ddlKorisnici.SelectedValue)); //+ "&Vrsta=" + vrsta + //"&Kategorija=" + kat + "&Podkategorija=" + Server.UrlEncode(row.Cells[3].Text) + "&Naslov=" + Server.UrlEncode(row.Cells[4].Text) + "&Text=" + //Server.UrlEncode(row.Cells[5].Text) + "&Datum=" + Server.UrlEncode(row.Cells[6].Text)); } }
protected void ddlKategorija_SelectedIndexChanged(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { DropDownList ddlKat = (DropDownList)sender; GridViewRow row = (GridViewRow)ddlKat.NamingContainer; System.Windows.Forms.MessageBox.Show(ddlKat.SelectedItem.Text); if (row != null) { if ((row.RowState & DataControlRowState.Edit) > 0) { DropDownList ddlPodkat = (DropDownList)row.FindControl("ddlPodkategorija"); ////ddlPodkat.DataSource= temp.getSelectPodKat(ddlKat.SelectedIndex); //System.Windows.Forms.MessageBox.Show(ddlKat.SelectedIndex + " value " + ddlKat.SelectedValue); //System.Windows.Forms.MessageBox.Show(ddlPodkat.Text); //ddlPodkat.DataValueField = "PodKatId"; //ddlPodkat.DataTextField = "NazivPodkategorije"; //ddlPodkat.DataBind(); } } } }
protected void btnIzmjena_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { string jmbg = Request.QueryString["JMBG"]; korisnici user = new korisnici(); user = temp.GetKorisnik(jmbg); string prezime = user.Prezime; string ime = user.Ime; string adresa = user.Adresa; int mjesto = user.gradID.Value; string tel = user.Telefon; string tel2 = user.Telefon2; string mob = user.Mobitel; string email = user.email; string kom = user.KomunikPutem; string sporBr = user.SporazumBroj; //string fili = user.filijala; nema polje filijala u bazi. treba dodati Response.Redirect("../Public/Registracija.aspx?" + "&JMBG=" + Server.UrlEncode(jmbg) + "&Prezime=" + Server.UrlEncode(prezime) + "&Ime=" + Server.UrlEncode(ime) + "&Adresa=" + Server.UrlEncode(adresa) + "&Opstina=" + mjesto + "&Telefon=" + Server.UrlEncode(tel) + "&Telefon2=" + Server.UrlEncode(tel2) + "&Mobitel=" + Server.UrlEncode(mob) + "&Email=" + Server.UrlEncode(email) + "&Komunikacija=" + Server.UrlEncode(kom) + "&Sporazum=" + Server.UrlEncode(sporBr)); } }