Exemplo n.º 1
0
        private HttpResponseMessage GetSetCommandStructure(String StationNameStr, String TargetIDStr, String SessionID)
        {
            XmlDocument    myXml = new XmlDocument();
            XPathNavigator xNav  = myXml.CreateNavigator();

            if (UserSessionHandler.VerifyTimeout(SessionID))
            {
                STATIONNAME ThisStation = HostingHelper.ConvertStationNameStrToSTATIONNAME(StationNameStr);

                if (ThisStation == STATIONNAME.NULL)
                {
                    return(HostingHelper.ReturnError("Invalid station name. Please check.", myXml, xNav));
                }

                if (DBScheduleEngine.IsFoundScheduleByTargetID(StationNameStr, TargetIDStr))
                {
                    StationHandler StationHandle = AstroData.GetStationObject(ThisStation);
                    StationHandle.CancelScript(TargetIDStr);

                    return(HostingHelper.ReturnSuccess(ThisStation, "OK", myXml, xNav));
                }
                else
                {
                    return(HostingHelper.ReturnError("There are no TargetID in Database.", myXml, xNav));
                }

                /*
                 * TTCSCommandDisplay[] ListOfDisplayCommand = CommandDefinition.GetListCommandName(ThisStation, ThisDeviceCategory).ToArray();
                 * if (ListOfDisplayCommand != null)
                 * {
                 *  var json = new JavaScriptSerializer().Serialize(ListOfDisplayCommand);
                 *  return new HttpResponseMessage() { Content = new StringContent(json, Encoding.UTF8, "application/json") };
                 * }
                 * else
                 *  return HostingHelper.ReturnError("There are no set command avaliable on this stationName and DeviceName.", myXml, xNav);
                 */
            }
            else
            {
                return(HostingHelper.ReturnError("Session is timeout. Please login to the system.", myXml, xNav));
            }
        }