コード例 #1
0
        public void ResourcesDistributionList(string category)
        {
            try
            {
                ErrorDisplay1.ClearError();

                //var res = _db.Resources.Where(m => m.Status == 2).ToList();
                var res = _db.Resources.ToList();


                //if (int.Parse(ageClass) > 0)
                //{
                //    res = res.Where(m => m.AgeId == int.Parse(ageClass)).ToList();
                //}

                if (int.Parse(category) > 0)
                {
                    res = res.Where(m => m.CategoryId == int.Parse(category)).ToList();
                }

                if (!res.Any())
                {
                    grdReports.DataSource = new List <Resource>();
                    grdReports.DataBind();
                    ErrorDisplay1.ShowWarning("No record found");
                    return;
                }
                grdReports.DataSource = res;
                grdReports.DataBind();
            }
            catch (Exception ex)
            {
            }
        }