Exemplo n.º 1
0
        /// <summary>
        /// convenience function, reads cimdata file, calls getGroupStatus, returns result
        /// </summary>
        /// <param name="path">file name</param>
        /// <param name="mrid">der group unique identifier</param>
        /// <param name="q">apparent or real</param>
        /// <returns></returns>
        public static CIMData.DERStatus getDERGroupStatus(String path, String mrid, quantity q, ref String SOAPMessage, ref String SoapResponse)
        {
            CIM c = new CIM();

            c._data = DERMSInterface.CIMData.read(path);
            CIMData.DERStatus status = c.getDERGroupStatus(mrid, q);
            SOAPMessage  = c.LastMessageSent;
            SoapResponse = c.LastMessageReceived;
            return(status);
        }
Exemplo n.º 2
0
        public static int getDERGroupStatus(
            [MarshalAs(UnmanagedType.LPTStr)] String path,
            [MarshalAs(UnmanagedType.LPTStr)] String mrid,
            [MarshalAs(UnmanagedType.LPTStr)] String q,
            [MarshalAs(UnmanagedType.LPTStr)] ref String xml)
        {
            DERResult     result   = new DERResult();
            List <String> nameList = new List <string>();

            try
            {
                quantity qtype = (quantity)Enum.Parse(typeof(DERMSInterface.quantity), q);

                Console.WriteLine("DER file : " + path);
                Console.WriteLine("DERGroupName : " + mrid);
                String            SOAPMessage  = null;
                String            SOAPResponse = null;
                CIMData.DERStatus status       = CIM.getDERGroupStatus(path, mrid, qtype, ref SOAPMessage, ref SOAPResponse);
                int rvalue = CIM.CreateDERGroup(path, mrid, nameList.ToArray <String>(), ref SOAPMessage, ref SOAPResponse);
                result.Status       = status;
                result.SOAPMessage  = SOAPMessage;
                result.SOAPResponse = SOAPResponse;
                result.Returncode   = 0;
            }
            catch (Exception e)
            {
                result.Returncode   = 1;
                result.ErrorMessage = e.ToString();
                Console.WriteLine("DERConfigureException: {0}", e);
            }

            XmlSerializer ser    = new XmlSerializer(typeof(DERResult));
            StringWriter  writer = new StringWriter();

            ser.Serialize(writer, result);
            xml = writer.ToString();

            return(result.Returncode);
        }