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); }
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); }
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"); }
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; } }
public ActionResult GetFloor(int id) { var mapsCtrl = new MapsController(); ObjectResponse<Floor> floor = mapsCtrl.GetFloor(id); return PartialView("_Layer", floor); }
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"); }
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"); }
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); }
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); }
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); }
public ActionResult NodeInfo(int nodeId) { var mapsCtrl = new MapsController(); ObjectResponse<FullNodeInformation> result = mapsCtrl.GetFullNodeInformationForNode(nodeId); return View(result); }
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); }
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); }
public ActionResult GetMaps() { var mapsCtrl = new MapsController(); ListResponse<Map> maps = mapsCtrl.GetMaps(); return PartialView("_Maps", maps); }
public ActionResult GetFloorsForMap(int id) { var mapsCtrl = new MapsController(); ListResponse<Floor> floors = mapsCtrl.GetFloorsForMap(id); ViewBag.MapId = id; return PartialView("_Floors", floors); }
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); }
public ActionResult FloorPlan(int mapId, int floorId) { var mapsCtrl = new MapsController(); ObjectResponse<Floor> result = mapsCtrl.GetFloor(floorId); return View(result); }
public JsonResult GetFloorPlanData(int id) { var mapsCtrl = new MapsController(); ObjectResponse<Graph> result = mapsCtrl.GetGraphForFloor(id); return Json(result, JsonRequestBehavior.AllowGet); }