Exemplo n.º 1
0
        public JsonResult GetStaffs(int page, int rows, string birthBegin, string birthEnd)
        {
            MongoDbRemoteRepository<Staff> repository = new MongoDbRemoteRepository<Staff>();
            repository.Connect();
            List<Staff> list = repository.List(i => i.GRADUATION_SCHOOL=="四川大学");
            repository.CloseConnect();
            var json2 = new
            {
                total = list.Count,
                rows = list.ToArray(),
            };

            return Json(json2, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
        public JsonResult GetStaffs(int page, int rows, string birthBegin, string birthEnd)
        {
            MongoDbRemoteRepository <Staff> repository = new MongoDbRemoteRepository <Staff>();

            repository.Connect();
            List <Staff> list = repository.List(i => i.GRADUATION_SCHOOL == "四川大学");

            repository.CloseConnect();
            var json2 = new
            {
                total = list.Count,
                rows  = list.ToArray(),
            };

            return(Json(json2, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
 public string TagData(string tagNo)
 {
     this.mongoDbRemoteRepository = new MongoDbRemoteRepository<OpcModel>();
     mongoDbRemoteRepository.Connect();
     var opcModels = mongoDbRemoteRepository.List(i => i.TagNo == tagNo).OrderBy(i => i.Time).ToList();
     string sd = "[";
     int k = 1;
     foreach (var modle in opcModels)
     {
         sd = sd + "{" + "\"Time\":\"" + modle.Id.Created.ToString("yyyy-MM-dd hh:mm:ss") + "\"," + "\"Value\"" + ":" + modle.Value + "},";
         k++;
         if(k>=100)
         {
             break;
         }
     }
     sd = sd.Substring(0, sd.Length - 1) + "]";
     string content = JsonConvert.SerializeObject(opcModels);
     mongoDbRemoteRepository.CloseConnect();
     return sd;
 }
Exemplo n.º 4
0
        public string TagData(string tagNo)
        {
            this.mongoDbRemoteRepository = new MongoDbRemoteRepository <OpcModel>();
            mongoDbRemoteRepository.Connect();
            var    opcModels = mongoDbRemoteRepository.List(i => i.TagNo == tagNo).OrderBy(i => i.Time).ToList();
            string sd        = "[";
            int    k         = 1;

            foreach (var modle in opcModels)
            {
                sd = sd + "{" + "\"Time\":\"" + modle.Id.Created.ToString("yyyy-MM-dd hh:mm:ss") + "\"," + "\"Value\"" + ":" + modle.Value + "},";
                k++;
                if (k >= 100)
                {
                    break;
                }
            }
            sd = sd.Substring(0, sd.Length - 1) + "]";
            string content = JsonConvert.SerializeObject(opcModels);

            mongoDbRemoteRepository.CloseConnect();
            return(sd);
        }
Exemplo n.º 5
0
 public FirstReportController(MongoDbRemoteRepository<OpcModel> remote)
 {
     this.mongoDbRemoteRepository = remote;
 }
Exemplo n.º 6
0
 public FirstReportController(MongoDbRemoteRepository <OpcModel> remote)
 {
     this.mongoDbRemoteRepository = remote;
 }