protected void btnAntenKaydet_Click(object sender, EventArgs e) { string aciStr = txtAci.Value; string ad = txtAntenAdi.Value; string A = labelPozisyonA.Value; string B = labelPozisyonB.Value; string C = labelPozisyonC.Value; if (!String.IsNullOrEmpty(ad) || !String.IsNullOrWhiteSpace(ad) || !String.IsNullOrEmpty(aciStr) || !String.IsNullOrEmpty(A) || !String.IsNullOrEmpty(B) || !String.IsNullOrEmpty(C)) { List <string> listeA = A.Split((new char[] { ')', '(', ',' }), StringSplitOptions.RemoveEmptyEntries).ToList(); List <string> listeB = B.Split((new char[] { ')', '(', ',' }), StringSplitOptions.RemoveEmptyEntries).ToList(); List <string> listeC = C.Split((new char[] { ')', '(', ',' }), StringSplitOptions.RemoveEmptyEntries).ToList(); string idd = Request.QueryString["id"]; if (!String.IsNullOrEmpty(idd)) { //anten update int id = Int32.Parse(idd); using (radiusEntities dc = MyContext.Context(KullaniciIslem.firma())) { anten aranan = dc.antens.Where(a => a.anten_id == id).FirstOrDefault(); if (aranan != null) { aranan.anten_adi = ad; aranan.center_Lat = listeA[0]; aranan.center_Long = listeA[1]; aranan.start_Lat = listeB[0]; aranan.start_Long = listeB[1]; aranan.end_Lat = listeC[0]; aranan.end_Long = listeC[1]; dc.SaveChanges(); Response.Redirect("/TeknikHarita/Antenler.aspx"); } } } else { //yeniantenkaydı using (radiusEntities dc = MyContext.Context(KullaniciIslem.firma())) { anten yeni = new anten(); yeni.anten_adi = ad; yeni.center_Lat = listeA[0]; yeni.center_Long = listeA[1]; yeni.start_Lat = listeB[0]; yeni.start_Long = listeB[1]; yeni.end_Long = listeC[0]; yeni.end_Lat = listeC[1]; dc.antens.Add(yeni); dc.SaveChanges(); Response.Redirect("/TeknikHarita/Antenler.aspx"); } } } // }
protected void btnAntenKaydet_Click(object sender, EventArgs e) { string aciStr = txtAci.Value; string ad = txtAntenAdi.Value; string koordinatlar = info.Value; if (!String.IsNullOrEmpty(ad) && !String.IsNullOrEmpty(koordinatlar)) { //koordinat sırası B/C/A(Merkez) List <string> koorList = koordinatlar.Split((new char[] { '-' }), StringSplitOptions.RemoveEmptyEntries).ToList(); List <string> listeA = koorList[2].Split((new char[] { ',' }), StringSplitOptions.RemoveEmptyEntries).ToList(); List <string> listeC = koorList[1].Split((new char[] { ',' }), StringSplitOptions.RemoveEmptyEntries).ToList(); List <string> listeB = koorList[0].Split((new char[] { ',' }), StringSplitOptions.RemoveEmptyEntries).ToList(); string idd = Request.QueryString["id"]; if (!String.IsNullOrEmpty(idd)) { //anten update int id = Int32.Parse(idd); using (radiusEntities dc = MyContext.Context(KullaniciIslem.firma())) { anten aranan = dc.antens.Where(a => a.anten_id == id).FirstOrDefault(); if (aranan != null) { aranan.anten_adi = ad; aranan.center_Lat = listeA[0]; aranan.center_Long = listeA[1]; aranan.start_Lat = listeB[0]; aranan.start_Long = listeB[1]; aranan.end_Lat = listeC[0]; aranan.end_Long = listeC[1]; dc.SaveChanges(); Response.Redirect("/TeknikHarita/Antenler.aspx"); } } } else { //yeniantenkaydı using (radiusEntities dc = MyContext.Context(KullaniciIslem.firma())) { anten yeni = new anten(); yeni.anten_adi = ad; yeni.center_Lat = listeA[0]; yeni.center_Long = listeA[1]; yeni.start_Lat = listeB[0]; yeni.start_Long = listeB[1]; yeni.end_Lat = listeC[0]; yeni.end_Long = listeC[1]; dc.antens.Add(yeni); dc.SaveChanges(); Response.Redirect("/TeknikHarita/Antenler.aspx"); } } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("updatim")) { int code = Convert.ToInt32(e.CommandArgument); Response.Redirect("/TeknikHarita/HaritaAntenKaydet.aspx?id=" + code.ToString()); } else if (e.CommandName.Equals("del")) { string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { int id = Convert.ToInt32(e.CommandArgument); using (radiusEntities db = MyContext.Context(KullaniciIslem.firma())) { anten ant = db.antens.Where(x => x.anten_id == id).FirstOrDefault(); if (ant != null) { db.antens.Remove(ant); db.SaveChanges(); gosterR(db, txtAra.Value); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script type='text/javascript'>"); sb.Append(" alertify.success('Kayıt silindi!');"); sb.Append(@"</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript3", sb.ToString(), false); } else { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script type='text/javascript'>"); sb.Append(" alertify.error('Anten bulunamadı!');"); sb.Append(@"</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript4", sb.ToString(), false); } } } } }