protected void ddlCity_SelectedIndexChanged(object sender, EventArgs e) { DataTable dtCity = objAdmin.GetParticipatingCityInfo(Convert.ToInt32(ddlCity.SelectedValue)); if (dtCity.Rows.Count > 0) { txtLatitude.Text = dtCity.Rows[0]["lat"].ToString(); txtLongitude.Text = dtCity.Rows[0]["long"].ToString(); } }
protected void btnEdit_Click(object sender, EventArgs e) { if (Page.IsValid) { try { hdn_CityId.Value = ((Button)sender).CommandArgument.ToString(); DataTable dtCity = objAdmin.GetParticipatingCityInfo(Convert.ToInt32(hdn_CityId.Value)); if (dtCity.Rows.Count > 0) { txt_City.Visible = true; ddlCity.Visible = false; txt_City.Text = dtCity.Rows[0]["CityName"].ToString(); txtLatitude.Text = dtCity.Rows[0]["lat"].ToString(); hdnLatitude.Value = dtCity.Rows[0]["lat"].ToString(); txtLongitude.Text = dtCity.Rows[0]["long"].ToString(); hdnLongitude.Value = dtCity.Rows[0]["long"].ToString(); txtMapText.Text = dtCity.Rows[0]["MapText"].ToString(); txt_CityGer.Text = dtCity.Rows[0]["CityNameGerman"].ToString(); hdnImageName.Value = dtCity.Rows[0]["CityImage"].ToString(); if (dtCity.Rows[0]["IsParticipatingCity"].ToString() == "True") { chkIsParticipating.Checked = true; } else { chkIsParticipating.Checked = false; } btn_Save.Text = (string)GetLocalResourceObject("Update"); //"Update"; pnl_AddCity.Visible = true; pnl_CityList.Visible = false; lblCurrentImage.Visible = true; imgImage.Visible = true; imgImage.ImageUrl = "../CityImages/" + hdnImageName.Value; ClientScript.RegisterStartupScript(Page.GetType(), "script", "GetLocations();", true); } } catch (Exception ex) { //Helper.errorLog(ex, Server.MapPath(@"~/ImpTemp/Log.txt")); } } }
private void _BindCityContents(int cityId) { try { DataSet ds = objAdmin.GetCityContents(cityId); DataTable CityInfo = objAdmin.GetParticipatingCityInfo(cityId); if (CityInfo.Rows.Count > 0) { float FromCitylat = float.Parse(CityInfo.Rows[0]["lat"].ToString()); float FromCitylon = float.Parse(CityInfo.Rows[0]["long"].ToString()); BindMap(FromCitylat, FromCitylon, CityInfo.Rows[0]["CityName"].ToString()); } string targetPath = Request.MapPath(@"~\\Pictures"); if (ds != null && ds.Tables.Count > 0) { if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { txtCityInfo.Text = ds.Tables[0].Rows[0]["CityInfo"].ToString(); txtVideoUrl.Text = ds.Tables[0].Rows[0]["VideoURL"].ToString(); if (txtVideoUrl.Text != "") { string code = txtVideoUrl.Text.Split('=')[1]; string url = "https://www.youtube.com/embed/" + code;// +"?autoplay=1"; ifrm.Attributes["src"] = url; div_Video.Visible = true; } } if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0) { dtImages = ds.Tables[1]; dlPictures.DataSource = dtImages; dlPictures.DataBind(); if (Directory.Exists(Request.MapPath("~\\Pictures\\City\\" + cityId))) { DirectoryInfo di = new DirectoryInfo(Request.MapPath("~\\Pictures\\City\\" + cityId)); FileInfo[] files = null; string searchPattern = "*.*"; files = di.GetFiles(searchPattern, SearchOption.TopDirectoryOnly); if (files != null) { foreach (FileInfo f in files) { if ((dtImages.Select("ImageName='" + f.Name + "'")).Length == 0) { //f.Delete(); } } } } } else { if (Directory.Exists(Request.MapPath("~\\Pictures\\City\\" + cityId))) { DirectoryInfo di = new DirectoryInfo(Request.MapPath("~\\Pictures\\City\\" + cityId)); di.Delete(true); } } } } catch (Exception ex) {} }