Expand|Select|Wrap|Line Numbers
- <property name="ForeignLink" column="FORNBLG" />
- <property name="IncludeInMerge" column="INCLUDE_IN_MERGE" />
- <property name="ReferenceNumber" column="REF_NO" type="AnsiString"/>
- <property name="FileName" column="FILENAME" type="AnsiString"/>
- <property name="Notes" column="NOTES" type="AnsiString"/>
OK, now what I am doing is passing a string into a web service for example "2523-ATTACHMENT-57925", and the web service parses the number at the end of this string as an Integer which represents the primary key of the IMAGE table (field name LINK). I need to use this primary key as my search criteria and return the value from the field NOTES and return it as a string.
I have the following code set up and am not too sure how to continue with it to return the string..
Expand|Select|Wrap|Line Numbers
- using (ISession session = mSessionFactory.OpenSession())
- {
- try
- {
- if (myString.IndexOf("-ATTACHMENT-") >= 0)
- {
- //get primary key from myString (number after -ATTACHMENT-)
- int pk = int.Parse(myString.Substring((myString.IndexOf("-ATTACHMENT-") + 12)));
- ICriteria criteria = session.CreateCriteria(typeof(Image));
- criteria.Add(new EqExpression("Link", pk, true));
- Image image = (Image)criteria.UniqueResult();
- return ..............
- etc...
- }