internal PILIDataSet(EduHubContext Context) : base(Context) { Index_LEAVE_CODE = new Lazy <NullDictionary <string, IReadOnlyList <PILI> > >(() => this.ToGroupedNullDictionary(i => i.LEAVE_CODE)); Index_LEAVE_GROUP = new Lazy <NullDictionary <string, IReadOnlyList <PILI> > >(() => this.ToGroupedNullDictionary(i => i.LEAVE_GROUP)); Index_PIKEY = new Lazy <Dictionary <short, IReadOnlyList <PILI> > >(() => this.ToGroupedDictionary(i => i.PIKEY)); Index_PLTKEY = new Lazy <NullDictionary <string, IReadOnlyList <PILI> > >(() => this.ToGroupedNullDictionary(i => i.PLTKEY)); Index_TID = new Lazy <Dictionary <int, PILI> >(() => this.ToDictionary(i => i.TID)); }
internal GLFBANKDataSet(EduHubContext Context) : base(Context) { Index_CODE = new Lazy <Dictionary <string, IReadOnlyList <GLFBANK> > >(() => this.ToGroupedDictionary(i => i.CODE)); Index_FUND_ID = new Lazy <NullDictionary <short?, IReadOnlyList <GLFBANK> > >(() => this.ToGroupedNullDictionary(i => i.FUND_ID)); Index_FUND_ID_SUBPROGRAM = new Lazy <Dictionary <Tuple <short?, string>, GLFBANK> >(() => this.ToDictionary(i => Tuple.Create(i.FUND_ID, i.SUBPROGRAM))); Index_SUBPROGRAM = new Lazy <NullDictionary <string, IReadOnlyList <GLFBANK> > >(() => this.ToGroupedNullDictionary(i => i.SUBPROGRAM)); Index_TID = new Lazy <Dictionary <int, GLFBANK> >(() => this.ToDictionary(i => i.TID)); }
internal TXASDataSet(EduHubContext Context) : base(Context) { Index_LOCATION = new Lazy <NullDictionary <string, IReadOnlyList <TXAS> > >(() => this.ToGroupedNullDictionary(i => i.LOCATION)); Index_LW_DATE = new Lazy <NullDictionary <DateTime?, IReadOnlyList <TXAS> > >(() => this.ToGroupedNullDictionary(i => i.LW_DATE)); Index_SCL_LINK = new Lazy <NullDictionary <string, IReadOnlyList <TXAS> > >(() => this.ToGroupedNullDictionary(i => i.SCL_LINK)); Index_SUBJECT = new Lazy <NullDictionary <string, IReadOnlyList <TXAS> > >(() => this.ToGroupedNullDictionary(i => i.SUBJECT)); Index_TEACHER = new Lazy <NullDictionary <string, IReadOnlyList <TXAS> > >(() => this.ToGroupedNullDictionary(i => i.TEACHER)); Index_TID = new Lazy <Dictionary <int, TXAS> >(() => this.ToDictionary(i => i.TID)); }
internal PDDataSet(EduHubContext Context) : base(Context) { Index_GLBANK = new Lazy <NullDictionary <string, IReadOnlyList <PD> > >(() => this.ToGroupedNullDictionary(i => i.GLBANK)); Index_GLCODE = new Lazy <NullDictionary <string, IReadOnlyList <PD> > >(() => this.ToGroupedNullDictionary(i => i.GLCODE)); Index_GLTAX = new Lazy <NullDictionary <string, IReadOnlyList <PD> > >(() => this.ToGroupedNullDictionary(i => i.GLTAX)); Index_INITIATIVE = new Lazy <NullDictionary <string, IReadOnlyList <PD> > >(() => this.ToGroupedNullDictionary(i => i.INITIATIVE)); Index_PDKEY = new Lazy <Dictionary <string, PD> >(() => this.ToDictionary(i => i.PDKEY)); Index_SUBPROGRAM = new Lazy <NullDictionary <string, IReadOnlyList <PD> > >(() => this.ToGroupedNullDictionary(i => i.SUBPROGRAM)); }
internal RQGLDataSet(EduHubContext Context) : base(Context) { Index_GLCODE = new Lazy <NullDictionary <string, IReadOnlyList <RQGL> > >(() => this.ToGroupedNullDictionary(i => i.GLCODE)); Index_GLCODE_SUBPROGRAM_INITIATIVE = new Lazy <Dictionary <Tuple <string, string, string>, RQGL> >(() => this.ToDictionary(i => Tuple.Create(i.GLCODE, i.SUBPROGRAM, i.INITIATIVE))); Index_INITIATIVE = new Lazy <NullDictionary <string, IReadOnlyList <RQGL> > >(() => this.ToGroupedNullDictionary(i => i.INITIATIVE)); Index_RQPGKEY = new Lazy <Dictionary <string, IReadOnlyList <RQGL> > >(() => this.ToGroupedDictionary(i => i.RQPGKEY)); Index_SUBPROGRAM = new Lazy <NullDictionary <string, IReadOnlyList <RQGL> > >(() => this.ToGroupedNullDictionary(i => i.SUBPROGRAM)); Index_TID = new Lazy <Dictionary <int, RQGL> >(() => this.ToDictionary(i => i.TID)); }
internal SABDataSet(EduHubContext Context) : base(Context) { Index_FEE_CODE_1ST = new Lazy <NullDictionary <string, IReadOnlyList <SAB> > >(() => this.ToGroupedNullDictionary(i => i.FEE_CODE_1ST)); Index_FEE_CODE_2ND = new Lazy <NullDictionary <string, IReadOnlyList <SAB> > >(() => this.ToGroupedNullDictionary(i => i.FEE_CODE_2ND)); Index_FEE_CODE_3RD = new Lazy <NullDictionary <string, IReadOnlyList <SAB> > >(() => this.ToGroupedNullDictionary(i => i.FEE_CODE_3RD)); Index_FEE_CODE_4TH = new Lazy <NullDictionary <string, IReadOnlyList <SAB> > >(() => this.ToGroupedNullDictionary(i => i.FEE_CODE_4TH)); Index_FEE_CODE_KG = new Lazy <NullDictionary <string, IReadOnlyList <SAB> > >(() => this.ToGroupedNullDictionary(i => i.FEE_CODE_KG)); Index_SABKEY = new Lazy <Dictionary <string, SAB> >(() => this.ToDictionary(i => i.SABKEY)); }
internal PEPUHDataSet(EduHubContext Context) : base(Context) { Index_CODE = new Lazy <Dictionary <string, IReadOnlyList <PEPUH> > >(() => this.ToGroupedDictionary(i => i.CODE)); Index_INITIATIVE = new Lazy <NullDictionary <string, IReadOnlyList <PEPUH> > >(() => this.ToGroupedNullDictionary(i => i.INITIATIVE)); Index_PAYITEM = new Lazy <NullDictionary <short?, IReadOnlyList <PEPUH> > >(() => this.ToGroupedNullDictionary(i => i.PAYITEM)); Index_SUBPROGRAM = new Lazy <NullDictionary <string, IReadOnlyList <PEPUH> > >(() => this.ToGroupedNullDictionary(i => i.SUBPROGRAM)); Index_SUPER_FUND = new Lazy <NullDictionary <string, IReadOnlyList <PEPUH> > >(() => this.ToGroupedNullDictionary(i => i.SUPER_FUND)); Index_TID = new Lazy <Dictionary <int, PEPUH> >(() => this.ToDictionary(i => i.TID)); }
internal TCTBDataSet(EduHubContext Context) : base(Context) { Index_ABSENCE_TYPE = new Lazy <NullDictionary <string, IReadOnlyList <TCTB> > >(() => this.ToGroupedNullDictionary(i => i.ABSENCE_TYPE)); Index_ROOM = new Lazy <NullDictionary <string, IReadOnlyList <TCTB> > >(() => this.ToGroupedNullDictionary(i => i.ROOM)); Index_SUBJ = new Lazy <NullDictionary <string, IReadOnlyList <TCTB> > >(() => this.ToGroupedNullDictionary(i => i.SUBJ)); Index_TCTBKEY = new Lazy <Dictionary <DateTime, IReadOnlyList <TCTB> > >(() => this.ToGroupedDictionary(i => i.TCTBKEY)); Index_TEACHER = new Lazy <NullDictionary <string, IReadOnlyList <TCTB> > >(() => this.ToGroupedNullDictionary(i => i.TEACHER)); Index_TID = new Lazy <Dictionary <int, TCTB> >(() => this.ToDictionary(i => i.TID)); }
internal SXABCONVDataSet(EduHubContext Context) : base(Context) { Index_AM_TYPE = new Lazy <NullDictionary <short?, IReadOnlyList <SXABCONV> > >(() => this.ToGroupedNullDictionary(i => i.AM_TYPE)); Index_LW_DATE = new Lazy <NullDictionary <DateTime?, IReadOnlyList <SXABCONV> > >(() => this.ToGroupedNullDictionary(i => i.LW_DATE)); Index_PM_TYPE = new Lazy <NullDictionary <short?, IReadOnlyList <SXABCONV> > >(() => this.ToGroupedNullDictionary(i => i.PM_TYPE)); Index_ST_YEAR_LEVEL = new Lazy <NullDictionary <string, IReadOnlyList <SXABCONV> > >(() => this.ToGroupedNullDictionary(i => i.ST_YEAR_LEVEL)); Index_STKEY = new Lazy <NullDictionary <string, IReadOnlyList <SXABCONV> > >(() => this.ToGroupedNullDictionary(i => i.STKEY)); Index_STKEY_ABSENCE_DATE = new Lazy <Dictionary <Tuple <string, DateTime?>, SXABCONV> >(() => this.ToDictionary(i => Tuple.Create(i.STKEY, i.ABSENCE_DATE))); Index_SXABCONV_ID = new Lazy <Dictionary <int, SXABCONV> >(() => this.ToDictionary(i => i.SXABCONV_ID)); }
internal STVDODataSet(EduHubContext Context) : base(Context) { Index_CAMPUS = new Lazy <NullDictionary <int?, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.CAMPUS)); Index_LW_DATE = new Lazy <NullDictionary <DateTime?, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.LW_DATE)); Index_ORIGINAL_SCHOOL = new Lazy <NullDictionary <string, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.ORIGINAL_SCHOOL)); Index_SKEY = new Lazy <Dictionary <string, IReadOnlyList <STVDO> > >(() => this.ToGroupedDictionary(i => i.SKEY)); Index_TID = new Lazy <Dictionary <int, STVDO> >(() => this.ToDictionary(i => i.TID)); Index_VDIMENSION = new Lazy <NullDictionary <string, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.VDIMENSION)); Index_VDOMAIN = new Lazy <NullDictionary <string, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.VDOMAIN)); }
public static void Run() { WriteLine(); ForegroundColor = ConsoleColor.Yellow; WriteLine("Simple Sample"); ForegroundColor = ConsoleColor.White; WriteLine("Selects all active students."); WriteLine(); // Create an EduHubContext var Context = new EduHubContext(); // Test for availability of data set Context.ST.EnsureAvailable(); // Data Updated ForegroundColor = ConsoleColor.Cyan; WriteLine("eduHub Students Updated: {0:G}", Context.ST.LastModified); // Build using Query Syntax var activeStudents = ( from st in Context.ST where st.STATUS == "ACTV" select new { StudentCode = st.STKEY, Name = $"{st.SURNAME}, {st.FIRST_NAME}", HomeGroup = st.HOME_GROUP, YearLevel = st.SCHOOL_YEAR }); // Build using Method Syntax // var activeStudents = Context.ST // .Where(st => st.STATUS == "ACTV") // .Select(st => new // { // StudentCode = st.STKEY, // Name = $"{st.SURNAME}, {st.FIRST_NAME}", // Surname = st.SURNAME, // HomeGroup = st.HOME_GROUP, // YearLevel = st.SCHOOL_YEAR // }); // Write Headers to Console ForegroundColor = ConsoleColor.Yellow; WriteLine($"{"Code",-7} {"Name",-52} {"HG",-4} {"YL",-4}"); // Write Data to Console ForegroundColor = ConsoleColor.Gray; foreach (var student in activeStudents) // Evaluate Query { WriteLine($"{student.StudentCode,-7} {student.Name,-52} {student.HomeGroup,-4} {student.YearLevel,-4}"); } }
internal SSHGDataSet(EduHubContext Context) : base(Context) { Index_HOMEGROUP = new Lazy <NullDictionary <string, IReadOnlyList <SSHG> > >(() => this.ToGroupedNullDictionary(i => i.HOMEGROUP)); Index_LW_DATE = new Lazy <NullDictionary <DateTime?, IReadOnlyList <SSHG> > >(() => this.ToGroupedNullDictionary(i => i.LW_DATE)); Index_STUDENT = new Lazy <NullDictionary <string, IReadOnlyList <SSHG> > >(() => this.ToGroupedNullDictionary(i => i.STUDENT)); Index_SUBJECT = new Lazy <Dictionary <string, IReadOnlyList <SSHG> > >(() => this.ToGroupedDictionary(i => i.SUBJECT)); Index_TEACHER = new Lazy <NullDictionary <string, IReadOnlyList <SSHG> > >(() => this.ToGroupedNullDictionary(i => i.TEACHER)); Index_TEACHING_HG = new Lazy <NullDictionary <string, IReadOnlyList <SSHG> > >(() => this.ToGroupedNullDictionary(i => i.TEACHING_HG)); Index_TID = new Lazy <Dictionary <int, SSHG> >(() => this.ToDictionary(i => i.TID)); }
internal CRPRDataSet(EduHubContext Context) : base(Context) { Index_APPROVED_BY = new Lazy <NullDictionary <string, IReadOnlyList <CRPR> > >(() => this.ToGroupedNullDictionary(i => i.APPROVED_BY)); Index_CODE = new Lazy <Dictionary <string, IReadOnlyList <CRPR> > >(() => this.ToGroupedDictionary(i => i.CODE)); Index_INITIATIVE = new Lazy <NullDictionary <string, IReadOnlyList <CRPR> > >(() => this.ToGroupedNullDictionary(i => i.INITIATIVE)); Index_STAFF_ORDER_BY = new Lazy <NullDictionary <string, IReadOnlyList <CRPR> > >(() => this.ToGroupedNullDictionary(i => i.STAFF_ORDER_BY)); Index_SUBPROGRAM = new Lazy <NullDictionary <string, IReadOnlyList <CRPR> > >(() => this.ToGroupedNullDictionary(i => i.SUBPROGRAM)); Index_TID = new Lazy <Dictionary <int, CRPR> >(() => this.ToDictionary(i => i.TID)); Index_TRREF = new Lazy <NullDictionary <string, IReadOnlyList <CRPR> > >(() => this.ToGroupedNullDictionary(i => i.TRREF)); }
internal SXASDataSet(EduHubContext Context) : base(Context) { Index_ACT_ABS_TYPE = new Lazy <NullDictionary <short?, IReadOnlyList <SXAS> > >(() => this.ToGroupedNullDictionary(i => i.ACT_ABS_TYPE)); Index_EXP_ABS_TYPE = new Lazy <NullDictionary <short?, IReadOnlyList <SXAS> > >(() => this.ToGroupedNullDictionary(i => i.EXP_ABS_TYPE)); Index_LW_DATE = new Lazy <NullDictionary <DateTime?, IReadOnlyList <SXAS> > >(() => this.ToGroupedNullDictionary(i => i.LW_DATE)); Index_ST_YEAR_LEVEL = new Lazy <NullDictionary <string, IReadOnlyList <SXAS> > >(() => this.ToGroupedNullDictionary(i => i.ST_YEAR_LEVEL)); Index_STKEY = new Lazy <NullDictionary <string, IReadOnlyList <SXAS> > >(() => this.ToGroupedNullDictionary(i => i.STKEY)); Index_TID = new Lazy <Dictionary <int, SXAS> >(() => this.ToDictionary(i => i.TID)); Index_TXAS_ID = new Lazy <NullDictionary <int?, IReadOnlyList <SXAS> > >(() => this.ToGroupedNullDictionary(i => i.TXAS_ID)); }
internal TTTGDataSet(EduHubContext Context) : base(Context) { Index_GKEY = new Lazy <Dictionary <string, IReadOnlyList <TTTG> > >(() => this.ToGroupedDictionary(i => i.GKEY)); Index_IDENT = new Lazy <NullDictionary <int?, IReadOnlyList <TTTG> > >(() => this.ToGroupedNullDictionary(i => i.IDENT)); Index_R1ROOM = new Lazy <NullDictionary <string, IReadOnlyList <TTTG> > >(() => this.ToGroupedNullDictionary(i => i.R1ROOM)); Index_R2ROOM = new Lazy <NullDictionary <string, IReadOnlyList <TTTG> > >(() => this.ToGroupedNullDictionary(i => i.R2ROOM)); Index_SUBJ = new Lazy <NullDictionary <string, IReadOnlyList <TTTG> > >(() => this.ToGroupedNullDictionary(i => i.SUBJ)); Index_T1TEACH = new Lazy <NullDictionary <string, IReadOnlyList <TTTG> > >(() => this.ToGroupedNullDictionary(i => i.T1TEACH)); Index_T2TEACH = new Lazy <NullDictionary <string, IReadOnlyList <TTTG> > >(() => this.ToGroupedNullDictionary(i => i.T2TEACH)); Index_TID = new Lazy <Dictionary <int, TTTG> >(() => this.ToDictionary(i => i.TID)); }
internal STVDODataSet(EduHubContext Context) : base(Context) { Index_CAMPUS = new Lazy <NullDictionary <int?, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.CAMPUS)); Index_LW_DATE = new Lazy <NullDictionary <DateTime?, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.LW_DATE)); Index_ORIGINAL_SCHOOL = new Lazy <NullDictionary <string, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.ORIGINAL_SCHOOL)); Index_SKEY = new Lazy <Dictionary <string, IReadOnlyList <STVDO> > >(() => this.ToGroupedDictionary(i => i.SKEY)); Index_SKEY_VDIMENSION_YEAR_SEMESTER_VDOMAIN_SCORE = new Lazy <Dictionary <Tuple <string, string, string, string, string>, IReadOnlyList <STVDO> > >(() => this.ToGroupedDictionary(i => Tuple.Create(i.SKEY, i.VDIMENSION, i.YEAR_SEMESTER, i.VDOMAIN, i.SCORE))); Index_TID = new Lazy <Dictionary <int, STVDO> >(() => this.ToDictionary(i => i.TID)); Index_VDIMENSION = new Lazy <NullDictionary <string, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.VDIMENSION)); Index_VDOMAIN = new Lazy <NullDictionary <string, IReadOnlyList <STVDO> > >(() => this.ToGroupedNullDictionary(i => i.VDOMAIN)); }
internal STMADataSet(EduHubContext Context) : base(Context) { Index_CKEY = new Lazy <NullDictionary <string, IReadOnlyList <STMA> > >(() => this.ToGroupedNullDictionary(i => i.CKEY)); Index_IDENT = new Lazy <NullDictionary <int?, IReadOnlyList <STMA> > >(() => this.ToGroupedNullDictionary(i => i.IDENT)); Index_LW_DATE = new Lazy <NullDictionary <DateTime?, IReadOnlyList <STMA> > >(() => this.ToGroupedNullDictionary(i => i.LW_DATE)); Index_MKEY = new Lazy <NullDictionary <string, IReadOnlyList <STMA> > >(() => this.ToGroupedNullDictionary(i => i.MKEY)); Index_SCHOOL_YEAR = new Lazy <NullDictionary <string, IReadOnlyList <STMA> > >(() => this.ToGroupedNullDictionary(i => i.SCHOOL_YEAR)); Index_SKEY = new Lazy <Dictionary <string, IReadOnlyList <STMA> > >(() => this.ToGroupedDictionary(i => i.SKEY)); Index_TID = new Lazy <Dictionary <int, STMA> >(() => this.ToDictionary(i => i.TID)); Index_TTPERIOD = new Lazy <NullDictionary <string, IReadOnlyList <STMA> > >(() => this.ToGroupedNullDictionary(i => i.TTPERIOD)); }
internal KGCDataSet(EduHubContext Context) : base(Context) { Index_CAMPUS = new Lazy <NullDictionary <int?, IReadOnlyList <KGC> > >(() => this.ToGroupedNullDictionary(i => i.CAMPUS)); Index_KGCKEY = new Lazy <Dictionary <string, KGC> >(() => this.ToDictionary(i => i.KGCKEY)); Index_MAX_AC_YR = new Lazy <NullDictionary <string, IReadOnlyList <KGC> > >(() => this.ToGroupedNullDictionary(i => i.MAX_AC_YR)); Index_MIN_AC_YR = new Lazy <NullDictionary <string, IReadOnlyList <KGC> > >(() => this.ToGroupedNullDictionary(i => i.MIN_AC_YR)); Index_NEXT_HG = new Lazy <NullDictionary <string, IReadOnlyList <KGC> > >(() => this.ToGroupedNullDictionary(i => i.NEXT_HG)); Index_ROOM = new Lazy <NullDictionary <string, IReadOnlyList <KGC> > >(() => this.ToGroupedNullDictionary(i => i.ROOM)); Index_TEACHER = new Lazy <NullDictionary <string, IReadOnlyList <KGC> > >(() => this.ToGroupedNullDictionary(i => i.TEACHER)); Index_TEACHER_B = new Lazy <NullDictionary <string, IReadOnlyList <KGC> > >(() => this.ToGroupedNullDictionary(i => i.TEACHER_B)); }
internal TEDataSet(EduHubContext Context) : base(Context) { Index_CAMPUS = new Lazy <NullDictionary <int?, IReadOnlyList <TE> > >(() => this.ToGroupedNullDictionary(i => i.CAMPUS)); Index_CATEGORY = new Lazy <NullDictionary <string, IReadOnlyList <TE> > >(() => this.ToGroupedNullDictionary(i => i.CATEGORY)); Index_END_FORM = new Lazy <NullDictionary <string, IReadOnlyList <TE> > >(() => this.ToGroupedNullDictionary(i => i.END_FORM)); Index_END_YEAR = new Lazy <NullDictionary <string, IReadOnlyList <TE> > >(() => this.ToGroupedNullDictionary(i => i.END_YEAR)); Index_LOCATION = new Lazy <NullDictionary <string, IReadOnlyList <TE> > >(() => this.ToGroupedNullDictionary(i => i.LOCATION)); Index_START_FORM = new Lazy <NullDictionary <string, IReadOnlyList <TE> > >(() => this.ToGroupedNullDictionary(i => i.START_FORM)); Index_START_YEAR = new Lazy <NullDictionary <string, IReadOnlyList <TE> > >(() => this.ToGroupedNullDictionary(i => i.START_YEAR)); Index_SUBJ = new Lazy <NullDictionary <string, IReadOnlyList <TE> > >(() => this.ToGroupedNullDictionary(i => i.SUBJ)); Index_TEKEY = new Lazy <Dictionary <int, TE> >(() => this.ToDictionary(i => i.TEKEY)); }
public static void Run() { WriteLine(); ForegroundColor = ConsoleColor.Yellow; WriteLine("Navigation Sample"); ForegroundColor = ConsoleColor.White; WriteLine("Selects all active students, then creates anonymous types which contain their home town and post code using the [FAMILY_DF] and [HOMEKEY_UM] navigation properties."); WriteLine(); // Create an EduHubContext var Context = new EduHubContext(); // Test for availability of data sets if (!Context.ST.IsAvailable || !Context.DF.IsAvailable || !Context.UM.IsAvailable) { ForegroundColor = ConsoleColor.Red; WriteLine("The ST, DF and UM Data Sets must be available to complete this query"); return; } // Data Updated ForegroundColor = ConsoleColor.Cyan; WriteLine("eduHub Updated: {0:G}", Context.Age); // Build Query var activeStudentTowns = ( from st in Context.ST let family = st.FAMILY_DF let home = family.HOMEKEY_UM where st.STATUS == "ACTV" orderby st.SCHOOL_YEAR, st.HOME_GROUP select new { StudentCode = st.STKEY, HomeGroup = st.HOME_GROUP, YearLevel = st.SCHOOL_YEAR, Town = home.ADDRESS03, PostCode = home.POSTCODE }); // Write Headers to Console ForegroundColor = ConsoleColor.Yellow; WriteLine($"{"Code",-7} {"HG",-4} {"YL",-4} {"Town",-30} {"PC",-4}"); // Write Data to Console ForegroundColor = ConsoleColor.Gray; foreach (var student in activeStudentTowns) // Evaluate Query { WriteLine($"{student.StudentCode,-7} {student.HomeGroup,-4} {student.YearLevel,-4} {student.Town,-30} {student.PostCode,-4}"); } }
internal SCLDataSet(EduHubContext Context) : base(Context) { Index_CAMPUS = new Lazy <NullDictionary <int?, IReadOnlyList <SCL> > >(() => this.ToGroupedNullDictionary(i => i.CAMPUS)); Index_LW_DATE = new Lazy <NullDictionary <DateTime?, IReadOnlyList <SCL> > >(() => this.ToGroupedNullDictionary(i => i.LW_DATE)); Index_QUILT = new Lazy <NullDictionary <string, IReadOnlyList <SCL> > >(() => this.ToGroupedNullDictionary(i => i.QUILT)); Index_QUILT_SUBJECT_CLASS = new Lazy <Dictionary <Tuple <string, string, short?>, SCL> >(() => this.ToDictionary(i => Tuple.Create(i.QUILT, i.SUBJECT, i.CLASS))); Index_ROOM01 = new Lazy <NullDictionary <string, IReadOnlyList <SCL> > >(() => this.ToGroupedNullDictionary(i => i.ROOM01)); Index_ROOM02 = new Lazy <NullDictionary <string, IReadOnlyList <SCL> > >(() => this.ToGroupedNullDictionary(i => i.ROOM02)); Index_SCLKEY = new Lazy <Dictionary <string, SCL> >(() => this.ToDictionary(i => i.SCLKEY)); Index_SUBJECT = new Lazy <NullDictionary <string, IReadOnlyList <SCL> > >(() => this.ToGroupedNullDictionary(i => i.SUBJECT)); Index_TEACHER01 = new Lazy <NullDictionary <string, IReadOnlyList <SCL> > >(() => this.ToGroupedNullDictionary(i => i.TEACHER01)); Index_TEACHER02 = new Lazy <NullDictionary <string, IReadOnlyList <SCL> > >(() => this.ToGroupedNullDictionary(i => i.TEACHER02)); }
internal EduHubDataSetLoadedReader(EduHubDataSet <T> DataSet, List <T> Items) { if (DataSet == null) { throw new ArgumentNullException(nameof(DataSet)); } dataSet = DataSet; context = DataSet.Context; items = Items; index = -1; entityLastModifiedMax = new Lazy <DateTime?>(CalculateEntityLastModifiedMax); }
internal SeamlessViewsContext(EduHubContext EduHubContext) { eduHubContext = EduHubContext; _V_AIM = new V_AIMDataSet(this); _V_FAMILY_CONTACT = new V_FAMILY_CONTACTDataSet(this); _V_KGC = new V_KGCDataSet(this); _V_KGH = new V_KGHDataSet(this); _V_KGL = new V_KGLDataSet(this); _V_KSF = new V_KSFDataSet(this); _V_RISK = new V_RISKDataSet(this); _V_SCI = new V_SCIDataSet(this); _V_SCL = new V_SCLDataSet(this); _V_SF = new V_SFDataSet(this); _V_SG = new V_SGDataSet(this); _V_SM = new V_SMDataSet(this); _V_ST = new V_STDataSet(this); _V_ST_ATTEND = new V_ST_ATTENDDataSet(this); _V_STMA = new V_STMADataSet(this); _V_STPO = new V_STPODataSet(this); _V_SU = new V_SUDataSet(this); _V_SXAB = new V_SXABDataSet(this); _V_TXAS = new V_TXASDataSet(this); }
internal KSQDataSet(EduHubContext Context) : base(Context) { Index_KSQKEY = new Lazy <Dictionary <string, KSQ> >(() => this.ToDictionary(i => i.KSQKEY)); }
internal AKTDataSet(EduHubContext Context) : base(Context) { Index_AKTKEY = new Lazy <Dictionary <string, AKT> >(() => this.ToDictionary(i => i.AKTKEY)); }
internal KGWDataSet(EduHubContext Context) : base(Context) { Index_AWARD = new Lazy <Dictionary <string, KGW> >(() => this.ToDictionary(i => i.AWARD)); }
internal KCCDataSet(EduHubContext Context) : base(Context) { Index_CURRENT_QUILT = new Lazy <NullDictionary <string, IReadOnlyList <KCC> > >(() => this.ToGroupedNullDictionary(i => i.CURRENT_QUILT)); Index_KCCKEY = new Lazy <Dictionary <DateTime, KCC> >(() => this.ToDictionary(i => i.KCCKEY)); }
internal SCADataSet(EduHubContext Context) : base(Context) { Index_SCAKEY = new Lazy <Dictionary <string, SCA> >(() => this.ToDictionary(i => i.SCAKEY)); }
internal SEC_MSGDataSet(EduHubContext Context) : base(Context) { Index_SCHOOLMSGID = new Lazy <Dictionary <int, SEC_MSG> >(() => this.ToDictionary(i => i.SCHOOLMSGID)); }
internal A_DECRYPDataSet(EduHubContext Context) : base(Context) { Index_TID = new Lazy <Dictionary <int, A_DECRYP> >(() => this.ToDictionary(i => i.TID)); }
public static void Run() { WriteLine(); ForegroundColor = ConsoleColor.Yellow; WriteLine("Complex Sample"); ForegroundColor = ConsoleColor.White; WriteLine("Determines program general ledger budgets."); WriteLine(); // Create an EduHubContext var Context = new EduHubContext(); // Ensure availability of data sets Context.CRF.EnsureAvailable(); Context.GLF.EnsureAvailable(); Context.GLBUDG.EnsureAvailable(); Context.KGLSUB.EnsureAvailable(); if (!Context.AR.IsAvailable) { ForegroundColor = ConsoleColor.Red; WriteLine("Warning: AR Data Set is unavailable, query may fail"); } if (!Context.AKC.IsAvailable) { ForegroundColor = ConsoleColor.Red; WriteLine("Warning: AKC Data Set is unavailable, query may fail"); } // Build Query int TransactionPeriod = DateTime.Now.Year * 100; // Determine year-to-date amounts var yearToDateAmounts = Context.GLF .Where(e => e.SUBPROGRAM != "0000" && (e.CODE_GL.GL_TYPE == "I" || e.CODE_GL.GL_TYPE == "E" || (e.CODE.CompareTo("26000") > 0 && e.CODE.CompareTo("29999") < 0))) .Where(e => e.TRPERD >= TransactionPeriod && e.TRAMT != 0) .GroupBy(e => new { GL = e.CODE_GL, KGLSUB = e.SUBPROGRAM_KGLSUB }) .Select(e => new GeneralLedgerBudgetItem() { Key = $"{e.Key.GL.CODE}_{e.Key.KGLSUB.SUBPROGRAM}", BudgetID = e.Key.KGLSUB.SUBPROGRAM, GeneralLedgerTypeID = e.Key.GL.CODE, BudgetType = e.Key.GL.GL_TYPE, YearToDateAmount = e.Sum(i => i.TRAMT).Value, }).ToDictionary(k => k.Key); // Determine annual budget amounts var annualBudgetAmounts = Context.GLBUDG .Where(e => e.SUBPROGRAM != "0000" && (e.CODE_GL.GL_TYPE == "I" || e.CODE_GL.GL_TYPE == "E" || (e.CODE.CompareTo("26000") > 0 && e.CODE.CompareTo("29999") < 0)) && e.ANNUALBUDG != 0) .GroupBy(e => new { GL = e.CODE_GL, KGLSUB = Context.KGLSUB.FindBySUBPROGRAM(e.SUBPROGRAM) }) .Select(e => new GeneralLedgerBudgetItem() { Key = $"{e.Key.GL.CODE}_{e.Key.KGLSUB.SUBPROGRAM}", BudgetID = e.Key.KGLSUB.SUBPROGRAM, GeneralLedgerTypeID = e.Key.GL.CODE, BudgetType = e.Key.GL.GL_TYPE, AnnualBudgetAmount = e.Sum(i => i.ANNUALBUDG).Value }).ToDictionary(k => k.Key); var glInventoryOnHand = Context.GL.FindByCODE("11003"); // Determine committed amounts var committedAmounts = Context.CRF .Where(e => e.SUBPROGRAM != "0000") .Where(e => e.TRTYPE == "O" && e.TRQTYI + e.TRQTYIX < e.TRQTY && e.TRCOST != 0 && (e.ATKEY_AR != null || e.TRXLEDGER == "IV" || Context.GL.TryFindByCODE(e.TRXCODE) != null)) .Select(e => new { GL = e.ATKEY_AR != null ? e.ATKEY_AR.CATEGORY_AKC.GLCODE_ASS_GL : e.TRXLEDGER == "IV" ? glInventoryOnHand : e.Context.GL.TryFindByCODE(e.TRXCODE), KGLSUB = e.SUBPROGRAM_KGLSUB, Commitment = (e.TRQTY - e.TRQTYI - e.TRQTYIX) * e.TRCOST }) .Where(e => e.GL.GL_TYPE == "I" || e.GL.GL_TYPE == "E" || (e.GL.CODE.CompareTo("26000") > 0 && e.GL.CODE.CompareTo("29999") < 0)) .GroupBy(e => new { e.GL, e.KGLSUB }) .Select(e => new GeneralLedgerBudgetItem() { Key = $"{e.Key.GL.CODE}_{e.Key.KGLSUB.SUBPROGRAM}", BudgetID = e.Key.KGLSUB.SUBPROGRAM, GeneralLedgerTypeID = e.Key.GL.CODE, BudgetType = e.Key.GL.GL_TYPE, CommittedAmount = e.Sum(i => i.Commitment).Value }).ToDictionary(k => k.Key); var keys = yearToDateAmounts.Keys.Concat(annualBudgetAmounts.Keys).Concat(committedAmounts.Keys).Distinct().ToList(); // Join all data var budgets = keys .Select(key => { GeneralLedgerBudgetItem validItem = default(GeneralLedgerBudgetItem); GeneralLedgerBudgetItem testItem; decimal annualBudgetAmount = default(decimal); decimal yearToDateAmount = default(decimal); decimal committedAmount = default(decimal); if (annualBudgetAmounts.TryGetValue(key, out testItem)) { validItem = testItem; annualBudgetAmount = testItem.AnnualBudgetAmount; } if (yearToDateAmounts.TryGetValue(key, out testItem)) { validItem = testItem; yearToDateAmount = testItem.YearToDateAmount; } if (committedAmounts.TryGetValue(key, out testItem)) { validItem = testItem; committedAmount = testItem.CommittedAmount; } return new GeneralLedgerBudgetItem() { BudgetID = validItem.BudgetID, GeneralLedgerTypeID = validItem.GeneralLedgerTypeID, BudgetType = validItem.BudgetType, AnnualBudgetAmount = annualBudgetAmount, YearToDateAmount = yearToDateAmount, CommittedAmount = committedAmount }; }) .OrderBy(i => i.BudgetID).ThenBy(i => i.BudgetType).ThenBy(i => i.GeneralLedgerTypeID) .ToList(); // Write Headers to Console ForegroundColor = ConsoleColor.Yellow; WriteLine($"{"BudgetID",-9} {"Type",-4} {"GL",-10} {"Budget",15} {"Spent",15} {"Committed",15}"); // Write Data to Console ForegroundColor = ConsoleColor.Gray; foreach (var budget in budgets) { WriteLine($"{budget.BudgetID,-9} {budget.BudgetType,-4} {budget.GeneralLedgerTypeID,-10} {budget.AnnualBudgetAmount,15:C2} {budget.YearToDateAmount,15:C2} {budget.CommittedAmount,15:C2}"); } }