private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (cmbDistrictName.SelectedValue == null)
            {
                DISTRICT district = new DISTRICT();
                district.DISTRICT_NAME = cmbDistrictName.Text;
                data.Insert<DISTRICT>(district);
            }
            if (cmbTalukName.SelectedValue == null)
            {
                TALUK taluk = new TALUK();
                taluk.TALUK_NAME = cmbTalukName.Text;
                taluk.DISTRICT_ID = selectedDistrict = cmbDistrictName.SelectedValue == null ? data.GetAll<DISTRICT>().Max(s => s.DISTRICT_ID) : Convert.ToInt32(cmbDistrictName.SelectedValue);
                data.Insert<TALUK>(taluk);
            }
            if (null != txtVillageName.Text && txtVillageName.Text != string.Empty)
            {
                VILLAGE village = new VILLAGE();
                village.VILLAGE_NAME = txtVillageName.Text;
                village.TALUK_ID = selectedTaluk = cmbTalukName.SelectedValue == null ? data.GetAll<TALUK>().Max(s => s.TALUK_ID) : Convert.ToInt32(cmbTalukName.SelectedValue);
                data.Insert(village);
                MessageBox.Show("New Village Added Succesfully.");
            }

            txtVillageName.Text = string.Empty;

            BindGrid();
            cmbDistrictName.ItemsSource = data.GetAll<DISTRICT>().Select(s => new { Id = s.DISTRICT_ID, Name = s.DISTRICT_NAME });
            cmbDistrictName.SelectedValue = cmbDistrictName.SelectedValue == null ? selectedDistrict : Convert.ToInt32(cmbDistrictName.SelectedValue); ;
            cmbTalukName.ItemsSource = data.GetAll<TALUK>(s => s.DISTRICT_ID == Convert.ToInt32(cmbDistrictName.SelectedValue)).Select(s => new { Id = s.TALUK_ID, Name = s.TALUK_NAME });
            cmbTalukName.SelectedValue = cmbTalukName.SelectedValue == null ? selectedTaluk : Convert.ToInt32(cmbTalukName.SelectedValue);
        }
		private void detach_VILLAGEs(VILLAGE entity)
		{
			this.SendPropertyChanging();
			entity.TALUK = null;
		}
		private void attach_VILLAGEs(VILLAGE entity)
		{
			this.SendPropertyChanging();
			entity.TALUK = this;
		}
 partial void DeleteVILLAGE(VILLAGE instance);
 partial void UpdateVILLAGE(VILLAGE instance);
 partial void InsertVILLAGE(VILLAGE instance);