/// <summary> /// Select /// </summary> /// <param name="projId"></param> /// <returns></returns> public static List <AfsTarget> Select(int projId) { List <AfsTarget> l = new List <AfsTarget>(); string sql = @" select * from <mbs_owner>.afs_target where afs_current = 1 and proj_id = " + projId + " order by upper(target_name)"; sql = Lex.Replace(sql, "<mbs_owner>", AfsProject.AfsTableSchema); DbCommandMx dao = new DbCommandMx(); dao.Prepare(sql); dao.ExecuteReader(); while (dao.Read()) { AfsTarget t = new AfsTarget(); t.ProjId = dao.GetIntByName("PROJ_ID"); t.TargetName = dao.GetStringByName("TARGET_NAME"); t.TargetType = dao.GetStringByName("TARGET_TYPE"); l.Add(t); } dao.CloseReader(); return(l); }
/// <summary> /// GetProjectMetaDataWithCriteria /// </summary> /// <param name="criteria"></param> /// <returns></returns> public static AfsProject SelectMetaDataWithCriteria(string criteria) { string sql = @" select * from <mbs_owner>.afs_project where afs_current = 1 and <criteria>" ; sql = Lex.Replace(sql, "<mbs_owner>", AfsTableSchema); sql = Lex.Replace(sql, "<criteria>", criteria); DbCommandMx dao = new DbCommandMx(); dao.Prepare(sql); dao.ExecuteReader(); if (!dao.Read()) { dao.CloseReader(); return(null); } AfsProject p = new AfsProject(); p.ProjId = dao.GetIntByName("PROJ_ID"); p.ProjectLabel = dao.GetStringByName("PROJ_NAME"); p.PlatformName = dao.GetStringByName("PLATFORM_NAME"); p.Description = dao.GetStringByName("DESCRIPTION"); p.ProjectFlowScheme = dao.GetClobByName("PROJ_FLOW_SCHEME"); p.MbsDhtFolderName = dao.GetStringByName("MBS_DHT_FOLDER_CODE"); p.MbsProjectName = dao.GetStringByName("MBS_PROJECT_CODE"); dao.CloseReader(); p.ProjMeta = AfsProjMeta.Select(p.ProjId); p.Targets = AfsTarget.Select(p.ProjId); p.Assays = AfsAssay.Select(p.ProjId); p.Libraries = AfsLibrary.Select(p.ProjId); return(p); }