/// <summary> /// 공통코드 콤보 데이터바인딩 /// </summary> /// <param name="cmb"></param> /// <param name="MST_CD"></param> /// <param name="ALL 전체항목추가"></param> public static void SetCmbCode(ComboBoxEdit cmb, string MST_CD, string ALL) { Hashtable conditions = new Hashtable(); DataTable dt = new DataTable(MST_CD); conditions.Add("MST_CD", MST_CD); dt = cmmDao.Select_CODE_LIST(conditions); /* 전체추가 */ if (!FmsUtil.IsNull(ALL)) { DataRow dr = dt.NewRow(); dr["DTL_CD"] = ""; dr["NM"] = ALL; dt.Rows.InsertAt(dr, 0); cmb.NullText = ALL;//널값은 NullText로 나옴 } // combo Cd/Nm 필드매핑 cmb.DisplayMember = "NM"; cmb.ValueMember = "DTL_CD"; cmb.ItemsSource = dt; }
/// <summary> /// 상세화면 필수체크 /// </summary> /// <param name="obj"></param> public static bool ValidReq(DependencyObject obj) { //필수값체크 foreach (TextEdit te in FmsUtil.FindVisualChildren <TextEdit>(obj)) { if (!FmsUtil.IsNull(te.Tag)) { if (FmsUtil.IsNull(te.EditValue)) { Messages.ShowInfoMsgBox(string.Format("{0}은 필수입력 항목입니다.", te.Tag.ToString())); return(false); } } } foreach (ComboBoxEdit cb in FmsUtil.FindVisualChildren <ComboBoxEdit>(obj)) { if (!FmsUtil.IsNull(cb.Tag)) { if (FmsUtil.IsNull(cb.EditValue)) { Messages.ShowInfoMsgBox(string.Format("{0}은 필수입력 항목입니다.", cb.Tag.ToString())); return(false); } } } return(true); }
//블럭관리번호 콤보생성 public static void SetFTR_IDN(string uPPER_FTR_CDE, ComboBoxEdit cmb) { if (FmsUtil.IsNull(uPPER_FTR_CDE)) { return; //상위코드없으면 콤보채우지 않는다 } Hashtable param = new Hashtable(); param.Add("sqlId", "SelectUpBlk"); param.Add("FTR_CDE", uPPER_FTR_CDE); List <BlkDtl> lst = (List <BlkDtl>)BizUtil.SelectListObj <BlkDtl>(param); cmb.DisplayMember = "BLK_NM"; cmb.ValueMember = "FTR_IDN"; cmb.ItemsSource = lst; }
/// <summary> /// 일반콤보 데이터바이딩 /// </summary> /// <param name="cmb"></param> /// <param name="sqlId"></param> /// <param name="ValueMember"></param> /// <param name="DisplayMember"></param> /// <param name="ALL 전체항목추가"></param> public static void SetCombo(ComboBoxEdit cmb, string sqlId, string ValueMember, string DisplayMember, string ALL, Func <DataRow, bool> filter) { Hashtable conditions = new Hashtable(); DataTable dt = new DataTable(); conditions.Add("sqlId", sqlId); DataTable _dt = new DataTable(); _dt = dao.SelectLIST(conditions); //필터식적용 //foreach (DataRow row in _dt.AsEnumerable().Where(filter)) //{ // dt.ImportRow(row); //} dt = _dt.AsEnumerable().Where(filter).CopyToDataTable(); /* 전체추가 */ if (!FmsUtil.IsNull(ALL)) { DataRow dr = dt.NewRow(); dr[ValueMember] = ""; dr[DisplayMember] = ALL; dt.Rows.InsertAt(dr, 0); cmb.NullText = ALL;//널값은 NullText로 나옴 } // combo객체 Cd/Nm 필드매핑 cmb.DisplayMember = DisplayMember; cmb.ValueMember = ValueMember; cmb.ItemsSource = dt; try { cmb.SelectedIndex = 0; } catch (Exception) {} }