예제 #1
0
        /// <summary>
        /// 读取DataRow数据到Model中
        /// </summary>
        private void RelationsDataRowToModel(XYTeacher model, DataRow dr)
        {
            model.strTeacherGUID   = ObjectConvertClass.static_ext_string(dr["strTeacherGUID"]);
            model.strTeacherNumber = ObjectConvertClass.static_ext_string(dr["strTeacherNumber"]);
            model.strTeacherName   = ObjectConvertClass.static_ext_string(dr["strTeacherName"]);
            //学员数组
            XYStudentArray listStudent = new XYStudentArray();
            XYStudent      _XYStudent  = new XYStudent();

            _XYStudent.strTeacherGUID   = ObjectConvertClass.static_ext_string(dr["strTeacherGUID"]);
            _XYStudent.strStudentGUID   = ObjectConvertClass.static_ext_string(dr["strStudentGUID"]);
            _XYStudent.strStudentNumber = ObjectConvertClass.static_ext_string(dr["strStudentNumber"]);
            _XYStudent.strStudentName   = ObjectConvertClass.static_ext_string(dr["strStudentName"]);
            listStudent.Add(_XYStudent);
            model.StudentArray = listStudent;
        }
예제 #2
0
        /// <summary>
        /// 获得数据List
        /// </summary>
        public XYTeacherArray GetRelationsDataList(XyQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * ");
            strSql.Append(" FROM VIEW_Base_XYRelation_Student where 1=1 " + strSqlOption.ToString() + " order by strTeacherGUID,dtCreateTime");
            DataTable      dt   = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            XYTeacherArray list = new XYTeacherArray();

            foreach (DataRow dr in dt.Rows)
            {
                XYTeacher _Base_XYRelation_Teacher = new XYTeacher();
                RelationsDataRowToModel(_Base_XYRelation_Teacher, dr);
                list.Add(_Base_XYRelation_Teacher);
            }
            return(list);
        }