示例#1
0
文件: OBSDAO.cs 项目: riyuexing/rms
        public static EntityData GetUnitSubjectSetByUnit(string UnitCode, string SubjectSetCode)
        {
            EntityData data2;

            try
            {
                UnitSubjectSetStrategyBuilder builder = new UnitSubjectSetStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitSubjectSetStrategyName.UnitCode, UnitCode));
                builder.AddStrategy(new Strategy(UnitSubjectSetStrategyName.SubjectSetCode, SubjectSetCode));
                string     queryString = builder.BuildMainQueryString();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("UnitSubjectSet", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
        private void LoadDataGrid()
        {
            try
            {
                UnitSubjectSetStrategyBuilder sb = new UnitSubjectSetStrategyBuilder();
                sb.AddStrategy(new Strategy(UnitSubjectSetStrategyName.SubjectSetCode, txtSubjectSetCode.Value));

                sb.AddOrder("FullCode", true);
                string sql = sb.BuildQueryViewString();

                QueryAgent qa = new QueryAgent();
                DataTable  tb = qa.ExecSqlForDataSet(sql).Tables[0];
                qa.Dispose();

                this.dgList.DataSource = tb;
                this.dgList.DataBind();
                tb.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "显示出错:" + ex.Message));
            }
        }