ChrisCompleteCodeTrunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using LFSO100Lib;
namespace AmsLaserficheDataProvider.Controllers
{
public class LetterController : ApiController
{
public IHttpActionResult Get(string id)
{
if (WebApiApplication.IsConnectedToLaserfiche)
{
if (id.IndexOf("-", 0) < 0)
{
return Ok(
new Models.ErrorModel(true, "Cycle number was not provided.")
);
}
try
{
List<Models.LetterModel> result = new List<Models.LetterModel>();
string[] splitId = id.Split(new char[] { '-' });
string searchCommand = String.Format(
"{{LF:NAME=\"{0}-{1}*SDS*\",TYPE=\"D\"}}|{{LF:NAME=\"{2}-{3}*CERT*\",TYPE=\"D\"}}&{{LF:LOOKIN=\"{4}\"}}",
new object[]
{
splitId[0],
splitId[1],
splitId[0],
splitId[1],
String.Format(
"{0}{1}\\{2}\\Letters",
new object[]
{
ConfigurationManager.AppSettings["LF_ROOT"],
splitId[0],
splitId[1]
}
)
}
);
LFSearch laserficheSearch = WebApiApplication.LaserficheConnection.Database.CreateSearch();
LFSearchListingParams laserficheSearchListingParams = new LFSearchListingParams();
laserficheSearch.Command = searchCommand;
laserficheSearch.BeginSearch(true);
LFSearchResultListing laserficheSearchResultListing = laserficheSearch.GetSearchResultListing(laserficheSearchListingParams, 1000);
for (int i = 0; i != laserficheSearchResultListing.RowCount; i++)
{
string letterName = laserficheSearchResultListing.DatumByColType[i + 1, Column_Type.COLUMN_TYPE_NAME];
int entryId = laserficheSearchResultListing.DatumByColType[i + 1, Column_Type.COLUMN_TYPE_ID];
result.Add(
new Models.LetterModel(entryId,letterName)
);
}
laserficheSearchResultListing.Dispose();
laserficheSearch.Dispose();
return Ok(result);
}
catch (Exception ex)
{
return Ok(
new Models.ErrorModel(true, ex.Message)
);
}
}
else
{
return Ok(
new Models.ErrorModel(true, WebApiApplication.LaserficheConnectionError)
);
}
//return Ok();
}
}
}
|
Revision |
Author |
Commited |
Message |
1
|
BBDSCHRIS
|
Wed 22 Aug, 2018 20:08:03 +0000 |
|