예제 #1
0
 public ActionResult DeleteFloor(int mapId, int floorId)
 {
     var mapsCtrl = new MapsController();
     BaseResponse response = mapsCtrl.DeleteFloor(floorId);
     ListResponse<Floor> floors = mapsCtrl.GetFloorsForMap(mapId);
     return response.Status == RespsonseStatus.Error
                ? (ActionResult) RedirectToAction("Error")
                : View("_Floors", floors);
 }
예제 #2
0
 public ActionResult DeleteMap(int id)
 {
     var mapsCtrl = new MapsController();
     BaseResponse response = mapsCtrl.DeleteMap(id);
     ListResponse<Map> maps = mapsCtrl.GetMaps();
     return response.Status == RespsonseStatus.Error
                ? (ActionResult) RedirectToAction("Error")
                : View("_Maps", maps);
 }
예제 #3
0
        public ActionResult CreateFloor(int mapId, Floor floor, HttpPostedFileBase data)
        {
            string filename = _serverUploadFolder + "\\Floors\\" + data.FileName;
            data.SaveAs(filename);

            var mapsCtrl = new MapsController();
            ObjectResponse<Floor> response = mapsCtrl.CreateFloor(floor.MapId, floor.Name,
                                                                  "Images/Floors/" + data.FileName);

            ViewBag.MapId = mapId;
            return response.Status != RespsonseStatus.Error ? RedirectToAction("Index") : RedirectToAction("Error");
        }
예제 #4
0
 private void Init()
 {
     Mouse.OverrideCursor = Cursors.Wait;
     try
     {
         Nodes.Clear();
         var mapsCtrl = new MapsController();
         var nodeResponse = mapsCtrl.GetNodeInformation(3, 1012);
         foreach (var node in nodeResponse.List)
         {
             Nodes.Add(new QRCodeNode(node));
         }
     }
     finally
     {
         Mouse.OverrideCursor = null;
     }
 }
예제 #5
0
        public ActionResult GetFloor(int id)
        {
            var mapsCtrl = new MapsController();
            ObjectResponse<Floor> floor = mapsCtrl.GetFloor(id);

            return PartialView("_Layer", floor);
        }
예제 #6
0
        public ActionResult GetConnectedNodes(int nodeId)
        {
            var mapsCtrl = new MapsController();
            ListResponse<Node> connectedNodes = mapsCtrl.GetConnectedNodes(nodeId);

            ViewBag.StartNodeId = nodeId;
            if (connectedNodes.Status == RespsonseStatus.Ok)
                return PartialView("_ConnectedNodes", connectedNodes.List);
            return RedirectToAction("Error");
        }
예제 #7
0
 public ActionResult CreateMap(Map data)
 {
     var mapsCtrl = new MapsController();
     ObjectResponse<Map> response = mapsCtrl.CreateMap(data.Name);
     return response.Status != RespsonseStatus.Error ? RedirectToAction("Index") : RedirectToAction("Error");
 }
예제 #8
0
 public JsonResult GetFloorplanImage(int mapId, int floorId)
 {
     var mapsCtrl = new MapsController();
     ObjectResponse<string> floor = mapsCtrl.GetFloorplanImage(floorId);
     floor.Object = floor.Object;
     return Json(floor, JsonRequestBehavior.AllowGet);
 }
예제 #9
0
 public JsonResult SaveNodeInformation(int nodeId, string displayName, string roomName, int poiTypeId,
     string poiDescription, string qrCode, string nfcTag)
 {
     var mapsCtrl = new MapsController();
     var nodeInf = new NodeInformation(new PoI
         {
             Description = poiDescription,
             Type = new PoiType {Id = poiTypeId}
         }, displayName, roomName, qrCode, nfcTag)
         {
             Node = new Node {Id = nodeId}
         };
     ObjectResponse<NodeInformation> tmp = mapsCtrl.SaveNodeInformation(nodeInf);
     return Json(tmp, JsonRequestBehavior.AllowGet);
 }
예제 #10
0
 public JsonResult SaveGraphForMap(int floorId, Graph newGraph, Graph deletedGraph)
 {
     var mapsCtrl = new MapsController();
     var request = new SaveGraphRequest
         {
             FloorId = floorId,
             NewGraph = newGraph,
             DeletedGraph = deletedGraph
         };
     ObjectResponse<Graph> floor = mapsCtrl.SaveGraphForFloor(request);
     return Json(floor, JsonRequestBehavior.AllowGet);
 }
예제 #11
0
 public ActionResult NodeInfo(int nodeId)
 {
     var mapsCtrl = new MapsController();
     ObjectResponse<FullNodeInformation> result = mapsCtrl.GetFullNodeInformationForNode(nodeId);
     return View(result);
 }
예제 #12
0
        public ActionResult Index(string partialViewName, object viewModel)
        {
            if (string.IsNullOrWhiteSpace(partialViewName))
            {
                ViewBag.PartialViewName = "_Maps";
                var mapsCtrl = new MapsController();
                viewModel = mapsCtrl.GetMaps();
            }
            else
                ViewBag.PartialViewName = partialViewName;

            return View("Index", viewModel);
        }
예제 #13
0
        public ActionResult GetNodeInformation(int nodeId)
        {
            var mapsCtrl = new MapsController();
            ObjectResponse<NodeInformation> nodeInformation = mapsCtrl.GetNodeInformationForNode(nodeId);

            int typId = 0;
            if (nodeInformation.Object.PoI != null && nodeInformation.Object.PoI.Type != null)
                typId = nodeInformation.Object.PoI.Type.Id;

            ViewBag.PoiTypes = mapsCtrl.GetPoiTypes().List.Select(x => new SelectListItem
                {
                    Selected = (x.Id == typId),
                    Text = x.Name,
                    Value = x.Id.ToString(CultureInfo.InvariantCulture)
                });
            return PartialView("_NodeInformation", nodeInformation.Object);
        }
예제 #14
0
        public ActionResult GetMaps()
        {
            var mapsCtrl = new MapsController();
            ListResponse<Map> maps = mapsCtrl.GetMaps();

            return PartialView("_Maps", maps);
        }
예제 #15
0
        public ActionResult GetFloorsForMap(int id)
        {
            var mapsCtrl = new MapsController();
            ListResponse<Floor> floors = mapsCtrl.GetFloorsForMap(id);

            ViewBag.MapId = id;
            return PartialView("_Floors", floors);
        }
예제 #16
0
        private void btnGenerate_Click(object sender, RoutedEventArgs e)
        {
            var enc = new QrEncoder(ErrorCorrectionLevel.M);
            var mapsCtrl = new MapsController();

            var folder = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                "StudMap");

            if (!Directory.Exists(folder))
                Directory.CreateDirectory(folder);

            foreach (var node in Nodes)
            {
                var qrCode = new QRCode
                    {
                        General = new General
                            {
                                DisplayName = node.DisplayName,
                                RoomName = node.RoomName
                            },
                        StudMap = new Core.Information.StudMap
                            {
                                NodeId = node.NodeId
                            }
                    };
                var qrCodeStr = JsonConvert.SerializeObject(qrCode);
                try
                {
                    QrCode bmp;
                    enc.TryEncode(qrCodeStr, out bmp);
                    var path = Path.Combine(folder, node.DisplayName + "_" + node.RoomName + ".png");

                    var gRenderer = new GraphicsRenderer(
                        new FixedModuleSize(2, QuietZoneModules.Two),
                        Brushes.Black, Brushes.White);

                    var ms = new MemoryStream();
                    gRenderer.WriteToStream(bmp.Matrix, ImageFormat.Png, ms);
                    var output = new Bitmap(ms);
                    output.Save(path, ImageFormat.Png);
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    mapsCtrl.SaveQRCodeForNode(node.NodeId, qrCodeStr);
                }
            }

            Process.Start(folder);
        }
예제 #17
0
 public ActionResult FloorPlan(int mapId, int floorId)
 {
     var mapsCtrl = new MapsController();
     ObjectResponse<Floor> result = mapsCtrl.GetFloor(floorId);
     return View(result);
 }
예제 #18
0
        public JsonResult GetFloorPlanData(int id)
        {
            var mapsCtrl = new MapsController();

            ObjectResponse<Graph> result = mapsCtrl.GetGraphForFloor(id);

            return Json(result, JsonRequestBehavior.AllowGet);
        }