/// 생성자 public WtrSourDtlViewMdl(string FTR_CDE, int FTR_IDN) { try { // 1.상세마스터 Hashtable param = new Hashtable(); param.Add("sqlId", "SelectWtrSourDtl"); param.Add("FTR_CDE", FTR_CDE); param.Add("FTR_IDN", FTR_IDN); WtrSourDtl result = new WtrSourDtl(); result = BizUtil.SelectObject(param) as WtrSourDtl; //결과를 뷰모델멤버로 매칭 Type dbmodel = result.GetType(); Type model = this.GetType(); //모델프로퍼티 순회 foreach (PropertyInfo prop in model.GetProperties()) { string propName = prop.Name; //db프로퍼티 순회 foreach (PropertyInfo dbprop in dbmodel.GetProperties()) { string colName = dbprop.Name; var colValue = dbprop.GetValue(result, null); if (colName.Equals(propName)) { try { prop.SetValue(this, colValue); } catch (Exception) { } } } Console.WriteLine(propName + " - " + prop.GetValue(this, null)); } //2. Tab 정보 //유지보수 param = new Hashtable(); param.Add("sqlId", "selectChscResSubList"); param.Add("FTR_CDE", FTR_CDE); param.Add("FTR_IDN", FTR_IDN); this.Tab01List = (List <LinkFmsChscFtrRes>)BizUtil.SelectListObj <LinkFmsChscFtrRes>(param); //부속시설 세부현황 param = new Hashtable(); param.Add("sqlId", "SelectCmmWttAttaDt"); param.Add("FTR_CDE", FTR_CDE); param.Add("FTR_IDN", FTR_IDN); Tab02List = (List <WttAttaDt>)BizUtil.SelectListObj <WttAttaDt>(param); } catch (Exception) {} }
/// <summary> /// 로딩작업 /// </summary> /// <param name="obj"></param> private void OnLoaded(object obj) { try { // 0.화면객체인스턴스화 if (obj == null) { return; } var values = (object[])obj; wtrSourDtlView = values[0] as WtrSourDtlView; //cbFTR_CDE = wtrSourDtlView.cbFTR_CDE; //지형지물 cbHJD_CDE = wtrSourDtlView.cbHJD_CDE; //행정동 cbMNG_CDE = wtrSourDtlView.cbMNG_CDE; //관리기관 cbWSR_CDE = wtrSourDtlView.cbWSR_CDE; //수원구분 btnBack = wtrSourDtlView.btnBack; btnDelete = wtrSourDtlView.btnDelete; btnSave = wtrSourDtlView.btnSave; //2.화면데이터객체 초기화 InitDataBinding(); //3.권한처리 permissionApply(); // 4.초기조회 //DataTable dt = new DataTable(); Hashtable param = new Hashtable(); param.Add("sqlId", "SelectWtrSourDtl"); param.Add("FTR_CDE", this.FTR_CDE); param.Add("FTR_IDN", this.FTR_IDN); WtrSourDtl result = new WtrSourDtl(); result = BizUtil.SelectObject(param) as WtrSourDtl; //결과를 뷰모델멤버로 매칭 Type dbmodel = result.GetType(); Type model = this.GetType(); //모델프로퍼티 순회 foreach (PropertyInfo prop in model.GetProperties()) { string propName = prop.Name; //db프로퍼티 순회 foreach (PropertyInfo dbprop in dbmodel.GetProperties()) { string colName = dbprop.Name; var colValue = dbprop.GetValue(result, null); if (colName.Equals(propName)) { try { prop.SetValue(this, colValue); } catch (Exception) { } } } Console.WriteLine(propName + " - " + prop.GetValue(this, null)); } } catch (Exception e) { Console.WriteLine(e); } }