Пример #1
0
 public void SelectTest()
 {
     var noSqlWorker = new NoSqlWorker();
     noSqlWorker.Initialization();
     var list = noSqlWorker.SelectByFilter("name","test1", "", "", "create_date", Convert.ToDateTime("11.06.2016")).GetAwaiter().GetResult();
     //var test1 = noSqlWorker.GetSituation(31485076);
     //var test2 = noSqlWorker.GetSituation(40054951);
     Assert.Fail();
 }
Пример #2
0
        public async Task <IEnumerable <liteBundleElement> > GetAllSituations([FromBody] Filter filter)
        {
            List <Situation> bundle;

            if (filter.sourceType)
            {
                bundle = OwlWorker.CurrentSituationBaseFromOwl;
            }
            else
            {
                var noSqlWorker = new NoSqlWorker();
                noSqlWorker.Initialization();
                var      name = filter.name != "" ? "name" : "";
                var      type = filter.type != "" ? "type" : "";
                var      date = filter.date != "" ? "create_date" : "";
                DateTime dateIn;
                if (DateTime.TryParse(filter.date, out dateIn))
                {
                    DateTime.TryParse(filter.date, out dateIn);
                    bundle = await noSqlWorker.SelectByFilter(name, filter.name, type, filter.type, date, dateIn);
                }
                else
                {
                    bundle = await noSqlWorker.SelectByFilter(name, filter.name, type, filter.type, date, DateTime.Now);
                }
            }
            var liteBundle = bundle.Select(situation => new liteBundleElement
            {
                id   = situation.id,
                name = situation.name,
                type = situation.type,
                date = situation.create_date.ToShortDateString()
            }).ToList();

            return(liteBundle);
        }