Beispiel #1
0
        //public override List<TrialVisit> GenerateData()
        //{
        //    var list = new List<TrialVisit>();

        //    var trials = dataProvider.GetList(new TrialDataFilter());

        //    if (trials.Count < 1)
        //        return list;

        //    Random rand = new Random();

        //    int id = 1;
        //    foreach (var trial in trials)
        //    {
        //        int count = rand.Next(1, 7);
        //        int days = 0;
        //        int maxPunctuality = 0;
        //        for (int i = 0; i < count; i++)
        //        {
        //            list.Add(new TrialVisit
        //            {
        //                Id = id,
        //                TrialCode = trial.Code,
        //                Name = "Визит " + (i + 1),
        //                Days = days,
        //                Punctuality = days == 0 ? 0 : rand.Next(1, maxPunctuality)
        //            });
        //            id++;
        //            maxPunctuality = rand.Next(1, 8);
        //            days = days + rand.Next(1, 8);
        //        }
        //    }

        //    return list;
        //}

        protected override Func <TrialVisit, bool> GetFilterFunc(DataFilter <TrialVisit> filter)
        {
            TrialVisitDataFilter dataFilter = (TrialVisitDataFilter)filter;

            return(e =>
                   (dataFilter.TrialCode == null || e.TrialCode == dataFilter.TrialCode) &&
                   (dataFilter.Id == null || e.Id == dataFilter.Id) &&
                   (string.IsNullOrEmpty(dataFilter.Name) || e.Name.Contains(dataFilter.Name)));
        }
        public ActionResult GetTrialVisits([DataSourceRequest]DataSourceRequest request, TrialVisitDataFilter dataFilter)
        {
            var response = DataProvider.GetList(dataFilter).OrderBy(v => v.Days);

            return Json(response.ToDataSourceResult(request));
        }
        public ActionResult GetTrialVisits([DataSourceRequest] DataSourceRequest request, TrialVisitDataFilter dataFilter)
        {
            var response = DataProvider.GetList(dataFilter).OrderBy(v => v.Days);

            return(Json(response.ToDataSourceResult(request)));
        }