-
Notifications
You must be signed in to change notification settings - Fork 728
/
isbl
69 lines (62 loc) · 2.28 KB
/
isbl
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
// Types
App : IApplication
Employees : IReference.РАБ = References.ReferenceFactory("РАБ").GetComponent
// Operators
Result = 1 + 1 / 2
// Numbers
Integer = 5
Float = 5.5
WordBool = True
// Strings
Double_Quotes = "An example"
Single_Quotes = 'An example'
// Comments
/********************************************
* Получить список кодов или ИД работников, *
* соответствующих пользователю. *
********************************************/
// Example code
ADD_EQUAL_NUMBER_TEMPLATE = "%s.%s = %s"
ADD_EQUAL_STATE_TEMPLATE = "%s.%s = '%s'"
EMPLOYEES_REFERENCE = "РАБ"
// Проверить, сущуствует ли пользователь с ИД UserID
ExceptionsOff()
FreeException()
ServiceFactory.GetUserByID(UserID)
ExceptionsOn()
if ExceptionExists()
Raise(CreateException("EDIRInvalidTypeOfParam";
LoadStringFmt("DIR21A2F148_1B41_40F3_9152_6E09E712025A"; "COMMON";
ArrayOf(UserID)); ecException)) // Не существует пользователя с ИД = %s
endif
Employees : IReference.РАБ = CreateReference(EMPLOYEES_REFERENCE; ArrayOf("Пользователь"; SYSREQ_STATE); FALSE)
Employees.Events.DisableAll
EmployeesTableName = Employees.TableName
EmployeesUserWhereID = Employees.AddWhere(Format(ADD_EQUAL_NUMBER_TEMPLATE; ArrayOf(EmployeesTableName;
Employees.Requisites("Пользователь").SQLFieldName; UserID)))
if OnlyActive
EmployeesStateWhereID = Employees.AddWhere(Format(ADD_EQUAL_STATE_TEMPLATE; ArrayOf(EmployeesTableName;
Employees.Requisites(SYSREQ_STATE).SQLFieldName; Employees.Requisites(SYSREQ_STATE).Items.IDByValue("Действующая"))))
endif
if Assigned(OurOrgID)
EmployeesOurOrgIDWhereID = Employees.AddWhere(Format(ADD_EQUAL_STATE_TEMPLATE; ArrayOf(EmployeesTableName;
Employees.Requisites("НашаОрг").SQLFieldName; OurOrgID)))
endif
Employees.Open()
Result = CreateStringList()
foreach Employee in Employees
if IsResultCode
Result.Add(Employee.SYSREQ_CODE)
else
Result.Add(Employee.SYSREQ_ID)
endif
endforeach
Employees.Close()
Employees.DelWhere(EmployeesUserWhereID)
if OnlyActive
Employees.DelWhere(EmployeesStateWhereID)
endif
if Assigned(OurOrgID)
Employees.DelWhere(EmployeesOurOrgIDWhereID)
endif
Employees.Events.EnableAll