Example #1
0
 public bool checkIsManage(int id)
 {
     User user = findAnUser(id);
     if(user.RoleID == 2)
     {
         NetCafeService net_services = new NetCafeService();
         List<NetCafe> netcafes = net_services.getAllNetCafe();
         foreach(NetCafe net in netcafes)
         {
             if (net.SupervisorID == user.UserID)
             {
                 return true;
             }
         }
     }
     return false;
 }
        public string getNetCafes(string username, string password)
        {
            NetCafeService netService = new NetCafeService();
            //JavaScriptSerializer json = new JavaScriptSerializer();

            //string output = json.Serialize(service.getPcList(username, password, netCafeId));
            //Newtonsoft.Json.Linq.JObject o = new Newtonsoft.Json.Linq.JObject();
            //string json = JsonConvert.SerializeObject(service.getPcList(username, password, netCafeId));
            List<NetCafe> netcafes = netService.getAllNetCafe();
            List<NetCafeJSon> netjsons = new List<NetCafeJSon>();
            //  string json = JsonConvert.SerializeObject(pcs,Formatting.Indented);
            foreach (NetCafe net in netcafes)
            {
                NetCafeJSon netj = new NetCafeJSon();
                netj.id = net.NetCafeID;
                netj.name = net.NetCafeName;
                netjsons.Add(netj);
            }

            var jsonSerialiser = new JavaScriptSerializer();
            var json = jsonSerialiser.Serialize(netjsons);
            return json;
        }