public static List<string> Getcityname(string prefixText) { MasterData edl = new MasterData(); List<string> CountryNames = edl.searchcity(prefixText, "Y"); return CountryNames; }
protected void txtmetrocityname_TextChanged(object sender, EventArgs e) { createtemptable(); MasterData objmst = new MasterData(); List<string> CountryNames = objmst.searchcity(txtmetrocityname.Text.Split('/').GetValue(0).ToString().Trim(), "Y"); if (CountryNames.Count == 0) { hdnmetrocityid.Value = "0"; } if (hdnmetrocityid.Value != "0" && hdnmetrocityid.Value != "") { loadmetrodetails(); } else { clearall(); } showhidefooter(false); ddltimezone.Focus(); }
public void SaveData() { char[] chDlr = { '$', ',', ' ', '%' }; if (hdnmetrocityid.Value == hdnnearbycityid.Value && hdnStateID.Value == hdnstateidnc.Value && hdncountry.Value == hdncountryidnc.Value) { lblerrmsg.Text = "Metro city and near by metro city should not be same!"; return; } MasterData edl = new MasterData(); List<string> CountryNames = edl.searchcity(txtmetrocityname.Text, "Y"); if (CountryNames.Count != 0 && hdnmetrocityid.Value == "0") { return; } if (CountryNames.Count == 0 || (hdncountry.Value != ddlcountry.SelectedItem.Value || hdnStateID.Value != ddlstate.SelectedItem.Value)) { SaveNewCity(); } Panel pnlfooter = Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("pnlfooter") as Panel; if (pnlfooter.Visible == true) { DropDownList ddlcitynearby = Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("ddlcitynearby") as DropDownList; if (ddlcitynearby.SelectedIndex > 0) { SaveTempnearbymetro(); } } MetroData objmet = new MetroData(); Int32 Metrocityid = 0, Nearbycityid = 0, countryid = 0, stateid = 0; Nullable<decimal> Metrotax = null; string statename = ""; DataTable dt = (DataTable)ViewState["temptable"]; Metrocityid = Convert.ToInt32(hdnmetrocityid.Value); countryid = Convert.ToInt32(ddlcountry.SelectedItem.Value); stateid = Convert.ToInt32(ddlstate.SelectedItem.Value); statename = txtstate.Text.Trim(); Nullable<int> timezoneid = null; timezoneid = (ddltimezone.SelectedIndex > 0) ? Convert.ToInt32(ddltimezone.SelectedItem.Value) : timezoneid; Metrotax = (txttax.Text == "") ? Metrotax : Convert.ToDecimal(txttax.Text.Trim(chDlr)); string type = "D"; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Nearbycityid = Convert.ToInt32(dt.Rows[i]["cityid"]); if (dt.Rows[i]["metro_id"].ToString() == "0") { objmet.Metro_Insert(Metrocityid, Nearbycityid, Metrotax, type, countryid, stateid, statename, timezoneid); type = "I"; } } } else { objmet.Metro_Insert(Metrocityid, Nearbycityid, Metrotax, type, countryid, stateid, statename, timezoneid); } if (string.IsNullOrEmpty(Request.QueryString["mertorcityid"])) { if (Convert.ToString(ViewState["status"]) == "") Response.Redirect("~/metro.aspx?mertorcityid=" + Metrocityid.ToString() + "&type=I"); } else { divmsg.InnerHtml = "Record updated successfully!"; } }
protected void txtcitynearby_TextChanged(object sender, EventArgs e) { TextBox txtcitynearby = (TextBox)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("txtcitynearby"); TextBox txtstatenc = (TextBox)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("txtstatenc"); TextBox txtZipCodenc = (TextBox)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("txtZipCodenc"); Label lblnearbystate = (Label)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("lblnearbystate"); Label lblcountrync = (Label)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("lblcountrync"); Label lblzipcodenc = (Label)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("lblzipcodenc"); DropDownList ddlstatenc = (DropDownList)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("ddlstatenc"); DropDownList ddlcountrync = (DropDownList)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("ddlcountrync"); MasterData edl = new MasterData(); List<string> CountryNames = edl.searchcity(txtcitynearby.Text.Trim(), "Y"); bool flg = false; if (CountryNames.Count == 0) { flg = true; hdnnearbycityid.Value = "0"; hdncountryidnc.Value = "0"; hdnstateidnc.Value = "0"; } else { MasterData mdl = new MasterData(); DataTable dt1 = mdl.Getcitydetails(Convert.ToInt32(hdnnearbycityid.Value)); lblnearbystate.Text = dt1.Rows[0]["STATE_NAME"].ToString(); lblcountrync.Text = dt1.Rows[0]["Country_NAME"].ToString(); txtcitynearby.Text = dt1.Rows[0]["City_name"].ToString(); lblzipcodenc.Text = dt1.Rows[0]["Zip"].ToString(); hdncountryidnc.Value = dt1.Rows[0]["Country_ID"].ToString(); hdnstateidnc.Value = dt1.Rows[0]["State_ID"].ToString(); txtstatenc.Visible = flg; ddlstatenc.ClearSelection(); ddlcountrync.ClearSelection(); } ddlcountrync.Visible = flg; ddlstatenc.Visible = flg; lblnearbystate.Visible = !flg; lblcountrync.Visible = !flg; lblzipcodenc.Visible = !flg; txtZipCodenc.Visible = flg; }
protected void txtcity_TextChanged(object sender, EventArgs e) { MasterData edl = new MasterData(); List<string> CityNames = edl.searchcity(txtcity.Text.Trim(), "Y"); if (CityNames.Count == 0) { hdncityid.Value = "0"; ddlcountry.ClearSelection(); ddlstate.ClearSelection(); } else if (!string.IsNullOrEmpty(hdncityid.Value)) { fillcitydetails(Convert.ToInt32(hdncityid.Value), txtaddress.Text.Trim(), "0"); } setstate(); ddlstate.Focus(); SetValidation(); }