Exemplo n.º 1
0
        /// <summary>
        /// 초기조회
        /// </summary>
        private void InitModel()
        {
            Hashtable param = new Hashtable();

            param.Add("sqlId", "SelectFaqDtl");
            param.Add("SEQ", this.SEQ);

            FaqDtl result = new FaqDtl();

            result = BizUtil.SelectObject(param) as FaqDtl;



            //결과를 뷰모델멤버로 매칭
            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));
            }


            // 다큐먼트는 따로 조회
            Paragraph p = new Paragraph();

            try
            {
                p.Inlines.Add(this.QUESTION ?? "");
                faqDocView.richQUESTION.Document.Blocks.Clear();
                faqDocView.richQUESTION.Document.Blocks.Add(p);
            }
            catch (Exception) { }

            p = new Paragraph();
            try
            {
                p.Inlines.Add(this.REPL ?? "");
                faqDocView.richREPL.Document.Blocks.Clear();
                faqDocView.richREPL.Document.Blocks.Add(p);
            }
            catch (Exception) { }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 초기조회
        /// </summary>
        private void InitModel()
        {
            Hashtable param = new Hashtable();

            param.Add("sqlId", "SelectFaqDtl");
            param.Add("SEQ", this.SEQ);

            FaqDtl result = new FaqDtl();

            result = BizUtil.SelectObject(param) as FaqDtl;



            //결과를 뷰모델멤버로 매칭
            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));
            }


            // CLOB 데이터는 OleDbConnection으로 따로 조회
            try
            {
                string sql = "";
                sql += " SELECT QUESTION, REPL FROM FAQ  WHERE SEQ = :SEQ ;";

                param = new Hashtable();
                param.Add("sql", sql);
                param.Add("SEQ", this.SEQ);

                DataTable dt = DBUtil.Select(param);

                this.QUESTION = dt.Rows[0]["QUESTION"].ToString();
                this.REPL     = dt.Rows[0]["REPL"].ToString();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }