private void lbxCacVungGia_Click(object sender, EventArgs e) { _tgdName = string.Format("{0}_{1}", _landpriceName, _conf.NamApDung); _thuaName = string.Format("{0}_{1}", DataNameTemplate.Thua, _conf.NamApDung); _fcName.FC_THUA_GIADAT.NAME = _tgdName; _fcName.FC_THUA_GIADAT.InitIndex(); _fcName.FC_THUA.NAME = _thuaName; _fcName.FC_THUA.InitIndex(); //MessageBox.Show(string.Format("line 241 GLandpriceView {0}", _thuaGiaDatInfo.Count)); foreach (ThuaGiaDatInfo thua in _thuaGiaDatInfo) { if (thua.Oid.ToString() == ((ListBoxControl)sender).Text) { //MessageBox.Show(string.Format("line 254 GLandPriceView")); _currentThuaGiaDatInfo = thua; txtGiaDat.EditValue = thua.Giadat; txtDonGia.EditValue = thua.Dongia; txtDienTich.EditValue = thua.Dientichpl; if ((int)thua.KhoagiaTay == 0) { chkKhoaTay.CheckState = CheckState.Unchecked; mniKhoaGiaTay.CheckState = CheckState.Unchecked; } else { chkKhoaTuDong.CheckState=CheckState.Checked; mniKhoaGiaTuDong.CheckState = CheckState.Checked; } if ((int)thua.KhoagiaTudong == 0) { chkKhoaTuDong.CheckState = CheckState.Unchecked; mniKhoaGiaTuDong.CheckState = CheckState.Unchecked; } else { chkKhoaTuDong.CheckState = CheckState.Checked; mniKhoaGiaTuDong.CheckState = CheckState.Checked; } if ((int)thua.KhoaVitri == 0) { chkKhoaViTri.CheckState = CheckState.Unchecked; } else { chkKhoaViTri.CheckState = CheckState.Checked; } //_mapView.Oid = thua.Oid.ToString() ; _mapView.ZoomToSelectId(_tgdName, thua.Oid); #region ghi vao cac chi tiet txtMaThua.EditValue = thua.Mathua; txtHeSoViTri.EditValue = thua.Hesovitri; rtbCachTinh.Text = thua.Cachtinh.ToString(); if (chkTruyTim.CheckState == CheckState.Checked) { findDetail(thua); } #endregion break; } } }
private void findDetail(ThuaGiaDatInfo thuaInfo) { //MessageBox.Show(string.Format("line 307 GLandPriceView mathua={0}", thuaInfo.Mathua)); _tgdName = string.Format("{0}_{1}", _landpriceName, _conf.NamApDung); _thuaName = string.Format("{0}_{1}", DataNameTemplate.Thua, _conf.NamApDung); _fcName.FC_THUA_GIADAT.NAME = _tgdName; _fcName.FC_THUA_GIADAT.InitIndex(); _fcName.FC_THUA.NAME = _thuaName; _fcName.FC_THUA.InitIndex(); object maxa=0; object diachi = ""; object tenchu = ""; IQueryFilter qrf = new QueryFilterClass(); //MessageBox.Show(string.Format("line 330 GLandPriceView thua={0}", _thuaName)); qrf.WhereClause=string.Format("{0}='{1}'",_fcName.FC_THUA.MA_THUA,thuaInfo.Mathua); #region tim trong bang thua IFeatureClass thuaFc = _fw.OpenFeatureClass(_thuaName); IFeatureCursor thuaFcur = thuaFc.Search(qrf, false); IFeature thuaFt = null; try { if ((thuaFt = thuaFcur.NextFeature()) != null) { maxa=thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.MA_XA)); txtLoaiDat.EditValue = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.LOAI_DAT)); txtDiaChi.EditValue = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.DIA_CHI)); txtChuSoHuu.EditValue=thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.TEN_CHU)); //MessageBox.Show("line 344 GLandPriceView tenchu="+tenchu.ToString()); //MessageBox.Show(string.Format("line 344 GLandPriceView maxa={0},loaidatindex={1}", maxa, thuaFt.Fields.FindField(_fcName.FC_THUA.LOAI_DAT))); } } catch (Exception e1) { MessageBox.Show(string.Format("line 324 GLandPriceView, e={0}", e1)); } //finally { Marshal.ReleaseComObject(thuaFcur); } #endregion qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_RANH_XA_POLY.MA_XA, maxa); #region tim trong bang xa IFeatureClass xaFc = _fw.OpenFeatureClass(DataNameTemplate.Ranh_Xa_Poly); IFeatureCursor xaFcur = xaFc.Search(qrf, false); IFeature xaFt = null; try { if ((xaFt = xaFcur.NextFeature()) != null) { //MessageBox.Show(string.Format("line 338 GLandPriceView, maxa={0}", maxa)); txtXa.Text = xaFt.get_Value(xaFt.Fields.FindField(_fcName.FC_RANH_XA_POLY.TEN_XA)).ToString(); } } catch (Exception e1) { MessageBox.Show(string.Format("line 340 GLandPriceView, e={0}", e1)); } finally { Marshal.ReleaseComObject(xaFcur); } #endregion qrf.WhereClause = string.Format("{0}='{1}'", _tblName.TEN_DUONG.MA_DUONG, thuaInfo.Maduong); //MessageBox.Show(string.Format("line 347 GLandPriceView, maxa={0}", thuaInfo.Maduong)); #region tim trong bang ten duong ITable duongTb = _fw.OpenTable(DataNameTemplate.Ten_Duong); ICursor duongCur = duongTb.Search(qrf, false); IRow duongRow = null; //object tenduong = ""; try { if ((duongRow = duongCur.NextRow()) != null) { txtTenDuong.Text = duongRow.get_Value(duongRow.Fields.FindField(_tblName.TEN_DUONG.TEN_DUONG)).ToString(); //MessageBox.Show(string.Format("line 347 GLandPriceView, tenduong={0}", tenduong)); } } catch (Exception e1) { MessageBox.Show(string.Format("line 356 GLandPriceView, e={0}", e1)); } finally { Marshal.ReleaseComObject(duongCur); } #endregion qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_HEM.MA_HEM, thuaInfo.Mahem); //MessageBox.Show(string.Format("line 364 GLandPriceView, maxa={0}", thuaInfo.Mahem)); #region tim trong bang hem IFeatureClass hemFc = _fw.OpenFeatureClass(DataNameTemplate.Hem); IFeatureCursor hemFcur = hemFc.Search(qrf, false); IFeature hemFt = null; try { if ((hemFt = hemFcur.NextFeature()) != null) { txtTenHem.EditValue = hemFt.get_Value(hemFt.Fields.FindField(_fcName.FC_HEM.TEN_HEM)); } } catch { } finally { Marshal.ReleaseComObject(hemFcur); } #endregion //qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_KTVHXH.MA_KTVHXH, thuaInfo.Mattx); //#region tim trong bang trung tam xa //IFeatureClass ttxaFc = _fw.OpenFeatureClass(DataNameTemplate.Trung_Tam_Xa); //IFeatureCursor ttxaFcur = ttxaFc.Search(qrf, false); //IFeature ttxaFt = null; //try //{ // while ((ttxaFt = ttxaFcur.NextFeature()) != null) // { // } //} //catch { } //finally { Marshal.ReleaseComObject(ttxaFcur); } //#endregion _inputParams.MA_XA = maxa.ToString() ; _inputParams.MA_DUONG = thuaInfo.Maduong.ToString(); _inputParams.OVER_WRITE_ATT = true; _inputParams.He_SO_VI_TRI = thuaInfo.Hesovitri; _inputParams.MA_THUA_RIENG_LE = thuaInfo.Mathua; _inputParams.OID_THUA_RIENG_LE = this.lbxCacVungGia.SelectedItem; }