Beispiel #1
0
        }                  //End public SkhDS

        public List <SkhlistitemVM> getDatalist(SkhVM poViewModel = null)
        {
            List <SkhlistitemVM> vReturn;


            using (var db = new DBMAINContext())
            {
                var oQRY = from tb in db.Skh_infos
                           select new SkhlistitemVM
                {
                    YEAR_ID      = tb.YEAR_ID,
                    SEMESTER_ID  = tb.SEMESTER_ID,
                    CLASSTYPE_ID = tb.CLASSTYPE_ID,
                    THEME_ID     = tb.THEME_ID,
                    WEEKNUM      = tb.WEEKNUM,
                    DATEFROM     = tb.DATEFROM,
                    ID           = tb.ID,
                    ACTIVITY     = tb.ACTIVITY,
                    INDICATOR    = tb.INDICATOR,
                    MEDIA        = tb.MEDIA
                };
                if (poViewModel != null)
                {
                    if (poViewModel.FILTER_YEAR_ID != null)
                    {
                        oQRY = oQRY.Where(fld => fld.YEAR_ID == poViewModel.FILTER_YEAR_ID);
                    } //End if (poViewModel.YEAR_ID != null)
                    if (poViewModel.FILTER_SEMESTER_ID != null)
                    {
                        oQRY = oQRY.Where(fld => fld.SEMESTER_ID == poViewModel.FILTER_SEMESTER_ID);
                    } //End if (poViewModel.SEMESTER_ID != null)
                    if (poViewModel.FILTER_CLASSTYPE_ID != null)
                    {
                        oQRY = oQRY.Where(fld => fld.CLASSTYPE_ID == poViewModel.FILTER_CLASSTYPE_ID);
                    } //End if (poViewModel.CLASSTYPE_ID != null)

                    if (poViewModel.FILTER_WEEKNUM != null)
                    {
                        oQRY = oQRY.Where(fld => fld.WEEKNUM == poViewModel.FILTER_WEEKNUM);
                    } //End if (poViewModel.CLASSTYPE_ID != null)
                    if (poViewModel.FILTER_DATEFROM != null)
                    {
                        oQRY = oQRY.Where(fld => fld.DATEFROM == poViewModel.FILTER_DATEFROM);
                    } //End if (poViewModel.CLASSTYPE_ID != null)
                    if (poViewModel.FILTER_THEME_ID != null)
                    {
                        oQRY = oQRY.Where(fld => fld.THEME_ID == poViewModel.FILTER_THEME_ID);
                    } //End if (poViewModel.CLASSTYPE_ID != null)
                }     //End if (poViewModel != null)
                vReturn = oQRY.ToList();
            }         //End using (var = new DbContext())
            return(vReturn);
        }             //End public List<SkhlistVM> getDatalist()
Beispiel #2
0
        } //End public Skh_Validation()

        //Constructor 2
        public Skh_Validation(SkhVM poViewModel)
        {
            oViewModelfilter = poViewModel;
        } //End public Skh_Validation()