/// 생성자 public WtrSupDtlViewMdl(string FTR_CDE, int FTR_IDN) { try { // 1.상세마스터 Hashtable param = new Hashtable(); param.Add("sqlId", "SelectWtrSupDtl"); param.Add("FTR_CDE", FTR_CDE); param.Add("FTR_IDN", FTR_IDN); WtrSupDtl result = new WtrSupDtl(); result = BizUtil.SelectObject(param) as WtrSupDtl; //결과를 뷰모델멤버로 매칭 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) {} }
//신규 시설물 생성자 public UC_SERV_PS(string _FTR_CDE) : this() { txtFTR_CDE.Text = _FTR_CDE; //신규관리번호채번 Hashtable param = new Hashtable(); param.Add("sqlId", "SelectWtrSupFTR_IDN"); WtrSupDtl result = BizUtil.SelectObject(param) as WtrSupDtl; //채번결과 매칭 txtFTR_IDN.Text = result.FTR_IDN.ToString(); btnDel.Tag = "Y";//신규채번 플래그 }
/// <summary> /// 로딩작업 /// </summary> /// <param name="obj"></param> private void OnLoaded(object obj) { try { // 0.화면객체인스턴스화 if (obj == null) { return; } var values = (object[])obj; wtrSupAddView = values[0] as WtrSupAddView; // cbFTR_CDE = wtrSupAddView.cbFTR_CDE; //지형지물 cbHJD_CDE = wtrSupAddView.cbHJD_CDE; //행정동 cbMNG_CDE = wtrSupAddView.cbMNG_CDE; //관리기관 cbSAG_CDE = wtrSupAddView.cbSAG_CDE; //관리방법 cbSCW_CDE = wtrSupAddView.cbSCW_CDE; //배수지제어방법 btnBack = wtrSupAddView.btnBack; btnSave = wtrSupAddView.btnSave; //2.화면데이터객체 초기화 InitDataBinding(); //3.권한처리 permissionApply(); // 4.초기조회 - 신규관리번호 채번 Hashtable param = new Hashtable(); param.Add("sqlId", "SelectWtrSupFTR_IDN"); WtrSupDtl result = new WtrSupDtl(); result = BizUtil.SelectObject(param) as WtrSupDtl; //채번결과 매칭 this.FTR_IDN = result.FTR_IDN; this.FTR_CDE = "SA114"; //this.FNS_YMD = Convert.ToDateTime(DateTime.Today).ToString("yyyy-MM-dd"); //공통팝업창 사이즈 변경 3 FmsUtil.popWinView.Height = 360; } catch (Exception e) { Console.WriteLine(e); } }
// 초기조회 private void InitModel() { Hashtable param = new Hashtable(); param.Add("sqlId", "SelectWtrSupDtl"); param.Add("FTR_CDE", this.FTR_CDE); param.Add("FTR_IDN", this.FTR_IDN); WtrSupDtl result = BizUtil.SelectObject(param) as WtrSupDtl; if (result != null) { this.FctDtl = result; } else { //신규등록이면 상세화면표시 if ("Y".Equals(uC_SERV_PS.btnDel.Tag)) { uC_SERV_PS.grid.Visibility = Visibility.Visible; //DB데이터가 없으면 빈페이지표시 } } }
/// <summary> /// 로딩작업 /// </summary> /// <param name="obj"></param> private void OnLoaded(object obj) { try { // 0.화면객체인스턴스화 if (obj == null) { return; } var values = (object[])obj; wtrSupDtlView = values[0] as WtrSupDtlView; //cbFTR_CDE = wtrSupDtlView.cbFTR_CDE; //지형지물 cbHJD_CDE = wtrSupDtlView.cbHJD_CDE; //행정동 cbMNG_CDE = wtrSupDtlView.cbMNG_CDE; //관리기관 cbSAG_CDE = wtrSupDtlView.cbSAG_CDE; //관리방법 cbSCW_CDE = wtrSupDtlView.cbSCW_CDE; //배수지제어방법 btnBack = wtrSupDtlView.btnBack; btnDelete = wtrSupDtlView.btnDelete; btnSave = wtrSupDtlView.btnSave; //2.화면데이터객체 초기화 InitDataBinding(); //3.권한처리 permissionApply(); // 4.초기조회 //DataTable dt = new DataTable(); Hashtable param = new Hashtable(); param.Add("sqlId", "SelectWtrSupDtl"); param.Add("FTR_CDE", this.FTR_CDE); param.Add("FTR_IDN", this.FTR_IDN); WtrSupDtl result = new WtrSupDtl(); result = BizUtil.SelectObject(param) as WtrSupDtl; //결과를 뷰모델멤버로 매칭 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); } }