public static string[] GetCompletionListCountryName(string prefixText, int count, string contextKey) { CountryMaster objCountryMaster = new CountryMaster(); DataTable dt = new DataView(objCountryMaster.GetCountryMaster(), "Country_Name like '" + prefixText.ToString() + "%'", "", DataViewRowState.CurrentRows).ToTable(); string[] txt = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { txt[i] = dt.Rows[i]["Country_Name"].ToString(); } return(txt); }
private void FillCountry() { DataTable dsCountry = null; dsCountry = ObjCountry.GetCountryMaster(); if (dsCountry.Rows.Count > 0) { ddlCountry.DataSource = dsCountry; ddlCountry.DataTextField = "Country_Name"; ddlCountry.DataValueField = "Country_Id"; ddlCountry.DataBind(); ddlCountry.Items.Add("--Select--"); ddlCountry.SelectedValue = "--Select--"; } else { ddlCountry.Items.Add("--Select--"); ddlCountry.SelectedValue = "--Select--"; } }
private void FillCountry() { CountryMaster objCountry = new CountryMaster(); DataTable dsCountry = null; dsCountry = objCountry.GetCountryMaster(); if (dsCountry.Rows.Count > 0) { ddlCountry.DataSource = dsCountry; ddlCountry.DataTextField = "Country_Name"; ddlCountry.DataValueField = "Country_Id"; ddlCountry.DataBind(); ListItem li = new ListItem("--Select--", "0"); ddlCountry.Items.Insert(0, li); ddlCountry.SelectedIndex = 0; } else { ListItem li = new ListItem("--Select--", "0"); ddlCountry.Items.Insert(0, li); ddlCountry.SelectedIndex = 0; } }
protected void btnSave_Click(object sender, EventArgs e) { int b = 0; if (txtCountryCode.Text == "") { DisplayMessage("Enter Country Code"); txtCountryCode.Focus(); return; } if (txtCountryName.Text == "") { DisplayMessage("Enter Country Name"); txtCountryName.Focus(); return; } if (editid.Value == "") { DataTable dt = objCountry.GetCountryMaster(); dt = new DataView(dt, "Country_Code='" + txtCountryCode.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt.Rows.Count > 0) { DisplayMessage("Country Code Already Exists"); txtCountryCode.Focus(); return; } DataTable dt1 = objCountry.GetCountryMaster(); dt1 = new DataView(dt1, "Country_Name='" + txtCountryName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt1.Rows.Count > 0) { DisplayMessage("Country Name Already Exists"); txtCountryName.Focus(); return; } else { dt1 = objCountry.GetCountryMasterInactive(); dt1 = new DataView(dt1, "Country_Name='" + txtCountryName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt1.Rows.Count > 0) { DisplayMessage("Country Name Already Exists in Bin Section"); txtCountryName.Focus(); return; } } b = objCountry.InsertCountryMaster(txtCountryName.Text, txtCountryNameL.Text, txtCountryCode.Text, "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), Session["UserId"].ToString(), DateTime.Now.ToString(), Session["UserId"].ToString(), DateTime.Now.ToString()); if (b != 0) { DisplayMessage("Record Saved"); FillGrid(); Reset(); } else { DisplayMessage("Record Not Saved"); } } else { DataTable dt2 = objCountry.GetCountryMaster(); dt2 = new DataView(dt2, "Country_Name='" + txtCountryName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt2.Rows[0]["Country_Id"].ToString() != editid.Value && editid.Value != "") { DisplayMessage("Country Name Already Exists"); txtCountryName.Focus(); return; } DataTable dt3 = objCountry.GetCountryMaster(); dt3 = new DataView(dt3, "Country_Code='" + txtCountryCode.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); try { if (dt3.Rows[0]["Country_Id"].ToString() != editid.Value && editid.Value != "") { DisplayMessage("Country Code Already Exists"); txtCountryCode.Focus(); return; } } catch { } b = objCountry.UpdateCountryMaster(editid.Value, txtCountryName.Text, txtCountryNameL.Text, txtCountryCode.Text, "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), Session["UserId"].ToString(), DateTime.Now.ToString()); if (b != 0) { btnList_Click(null, null); DisplayMessage("Record Updated"); Reset(); FillGrid(); } else { DisplayMessage("Record Not Updated"); } } }