public ApiModel CardSwipe([FromUri] ApiModel model, string cardswipedata, int buttonindex) { OnTheFlyResource otfr = ReservationOnTheFlyUtil.GetOnTheFlyResource(cardswipedata, buttonindex); if (null == otfr) { model.ServerResponse = "OnTheFlyResource not found for " + cardswipedata + " , buttonindex: " + buttonindex.ToString(); } else { OnTheFlyImpl oimp = new OnTheFlyImpl(otfr, cardswipedata, Request.GetOwinContext().Request.RemoteIpAddress); oimp.Swipe(); string strFS = (oimp.IsProcessFailed()) ? "failed" : "started"; model.ServerResponse = otfr.GetResourceTypeAsString() + "_reservation_" + strFS; model.ResourceType = otfr.ResourceType; bool returnLog = Utility.StringToBoolean(ConfigurationManager.AppSettings["otf:ReturnFullLog"]); if (returnLog) { model.ServerResponse += oimp.GetReturnMessage(); } } return(model); }
private bool?GetState(OnTheFlyResource res) { ActionInstance act = ActionInstanceUtility.Find(ActionType.Interlock, res.Resource.ResourceID); if (act == null) { return(null); } var point = act.GetPoint(); var blockState = GetBlockState(point.Block.BlockID); var result = WagoInterlock.GetPointState(point.PointID, blockState); return(result); }