Пример #1
0
        public static EntityData GetProjectSubjectSetByProject(string ProjectCode, string SubjectSetCode)
        {
            EntityData data2;

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

                sb.AddOrder("ProjectName", 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));
            }
        }