Exemple #1
0
        }                  //End public SkmDS

        public List <SkmlistitemVM> getDatalist(SkmVM poViewModel = null)
        {
            List <SkmlistitemVM> vReturn;


            using (var db = new DBMAINContext())
            {
                var oQRY = from tb in db.Skm_infos
                           select new SkmlistitemVM
                {
                    YEAR_ID         = tb.YEAR_ID,
                    SEMESTER_ID     = tb.SEMESTER_ID,
                    CLASSTYPE_ID    = tb.CLASSTYPE_ID,
                    ID              = tb.ID,
                    WEEKNUM         = tb.WEEKNUM,
                    DATEFROM        = tb.DATEFROM,
                    EVALUATION_DESC = tb.EVALUATION_DESC
                };
                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)
                }     //End if (poViewModel != null)

                vReturn = oQRY.ToList();
            } //End using (var = new DbContext())
            return(vReturn);
        }     //End public List<SkmlistVM> getDatalist()
Exemple #2
0
        } //End public Skm_Validation()

        //Constructor 2
        public Skm_Validation(SkmVM poViewModel)
        {
            oViewModelfilter = poViewModel;
        } //End public Skm_Validation()