SIMS 7 - TPPerson
This method returns photos of all people stored in SIMS System. Sample output from this interface is shown below
This method returns data of photo associated with a personId supplied as an input. Sample code and output is shown below
Example #1
TPPerson personInfo = new TPPerson();
string data = personInfo.GetXmlPersonPhotos(1);
Output
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<PersonPhotos>
<PersonPhoto>
<PersonID>1</PersonID>
<Photo>FFD8FFE000104A46494600010101006000600000FFDB0043000101010101010101010101010101016D8B8CAB00406C93CE172A40EBBB23BE3D0863EA54A728CA9D249CE4DDA2D6F67FCCFFAB33055A6925A3B2495EF7B2D3BFE47476C96F6E3ED296915D48EBE5B7FA45D594DB5887DCD35BAE59728018C9DACC431E5168A96C363AF9448DCA818839ED8079208EA7D68AC94F955946365E5E69F7F21FB79768FE3FE7EBFD6FF00FFD9</Photo>
</PersonPhoto>
<PersonPhotos>
Example #2
SIMS.Processes.TPPerson tpPersonPhoto = new TPPerson();
string xmlwithPhoto = tpPersonPhoto.GetXmlPersonPhotos(7338);
System.Xml.Linq.XDocument xDocument = XDocument.Parse(xmlwithPhoto);
var query = xDocument.Element("PersonPhotos")
.Element("PersonPhoto")
.Element("Photo").Value;
int NumberChars = query.Length;
byte[] bytesPhoto = new byte[NumberChars / 2];
for (int i = 0; i < NumberChars; i += 2)
bytesPhoto[i / 2] = Convert.ToByte(query.Substring(i, 2), 16);
System.IO.MemoryStream ms = new MemoryStream(bytesPhoto);
ms.Position = 0;
//push the image to the UI control.
pictureBox1.Image = Image.FromStream(ms, false, true);
This method will return the User Defined Fields stored within the SIMS System.
The method has 4 overloads.
- GetXmlPersonUDFs() will return all of the UDF values for all people.
- GetXmlPersonUDFs(string _UDF) will return a specific UDF of name @UDF for all people (that have a value).
- GetXmlPersonUDFs(int personId, string _UDF) will return the specific UDF value for a specific person.
- GetXmlPersonUDFs(int personId) will return the set of UDF values for a person.
Sample code and output is shown below
TPPerson personInfo = new TPPerson();
string data = personInfo.GetXmlPersonUDFs(7338);
Output
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<PersonUDFs>
<PersonUDF>
<PersonID>7338</PersonID>
<Name>crazy</Name>
<Value />
<Code>TP Test</Code>
<Description>Partner Support UDF test</Description>
</PersonUDF>
<PersonUDF>
<PersonID>7338</PersonID>
<Name>Media Permission</Name>
<Value>F</Value>
<Code />
<Description />
</PersonUDF>
</PersonUDFs>
The call to interface on 04/01/2010 will get all the photos associated to Persons[personId] from SIMS system.
When the date passed to this interface is on/after the logging date, it will only get the information of photos when the photographs associated with a person have been modified/added or deleted from SIMS System.
The below sample code and output is based on following:
Changing the Photograph with PersonId [5253] and adding a new photograph to PersonId [5095]:
Output: [The information of Photos has been truncated from this sample]
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<PersonPhotos>
<PersonPhoto deleted="true">
<PersonID>5253</PersonID>
</PersonPhoto>
<PersonPhoto>
<PersonID>5095</PersonID> <Photo>FFD8FFE000104A4649460001010100F000F10000FFDB00430001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101FFDB00430101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101FFC000110800B70096030122000211013249AF64E7F34D7E0FAA3FB7EFD9A6D2FE4F82BF0F069F70B6F12786AC976B2E4901A5039C9FF0039F6A28A2B8B2293793E5D26DDDE128B7ABDDC57F923CDC6C22B175D2564AA3D16DD0FFFD9</Photo>
</PersonPhoto>
</PersonPhotos>