Ejemplo n.º 1
0
        private void InitModel()
        {
            //DataTable dt = new DataTable();
            Hashtable param = new Hashtable();

            param.Add("sqlId", "SelectWtlPipeDtl2");
            param.Add("FTR_CDE", this.FTR_CDE);
            param.Add("FTR_IDN", this.FTR_IDN);

            PipeDtl result = new PipeDtl();

            result = BizUtil.SelectObject(param) as PipeDtl;


            //결과를 뷰모델멤버로 매칭
            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));
            }
        }
Ejemplo n.º 2
0
        /// 생성자
        public WtlPipeDtlViewMdl(string FTR_CDE, int FTR_IDN)
        {
            try
            {
                // 1.상세마스터
                //DataTable dt = new DataTable();
                Hashtable param = new Hashtable();
                param.Add("sqlId", "SelectWtlPipeDtl2");
                param.Add("FTR_CDE", FTR_CDE);
                param.Add("FTR_IDN", FTR_IDN);

                PipeDtl result = new PipeDtl();
                result = BizUtil.SelectObject(param) as PipeDtl;
                //결과를 뷰모델멤버로 매칭
                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.유지보수(탭1)
                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);

                //3.누수지점(탭3)
                param = new Hashtable();
                param.Add("sqlId", "selectWtlLeakSubList");

                param.Add("FTR_CDE", FTR_CDE);
                param.Add("FTR_IDN", FTR_IDN);

                this.Tab03List = (List <LinkWtlLeakPs>)BizUtil.SelectListObj <LinkWtlLeakPs>(param);
            }
            catch (Exception) {}
        }