本文整理汇总了C#中iSolutions.iApply.DataContract.Application类的典型用法代码示例。如果您正苦于以下问题:C# Application类的具体用法?C# Application怎么用?C# Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Application类属于iSolutions.iApply.DataContract命名空间,在下文中一共展示了Application类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AdministratorDefaultToWriteAccess
public void AdministratorDefaultToWriteAccess()
{
Application application = new Application
{
FormId = "form-1",
OrganisationId = "org-1",
WorkflowState = "New"
};
User user = new User
{
Id = "administrator-1",
Roles = new Dictionary<string, string> { { "role-1", "role-1" }, { "Administrators", "Administrators" } }
};
user.Organisations.Add("org-1", "Organisation One");
var controlsList = new ControlList
{
new TextControl { Id = 1 }
};
AccessLevel applicationAccess = this.provider.GetApplicationAccess(new SecureSession(user), application, this.roleList, 1);
List<ControlAccess> controlsAccess = this.provider.GetControlsAccess(new SecureSession(user), application, controlsList, this.roleList, 1);
Assert.AreEqual(AccessLevel.Write, applicationAccess);
Assert.AreEqual(AccessLevel.Write, controlsAccess[0].AccessLevel);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:27,代码来源:ApplicationEntitlementProviderTests.cs
示例2: Map
/// <summary>
/// Populates <paramref name="target"/> with static and <paramref name="source"/> values
/// as defined by <paramref name="fieldMap"/>.
/// </summary>
/// <param name="source">The application from which to get field values.</param>
/// <param name="fieldMap">A definition of field mappings.</param>
/// <param name="target">The target object to populate with mapped key/values.</param>
internal void Map(Application source, MappedFieldList fieldMap, JObject target)
{
foreach (MappedField map in fieldMap)
{
switch (map.MapType)
{
case MapType.Value:
case MapType.PrivateValue:
target.Add(map.Target, map.Source);
break;
case MapType.Field:
object tokenValue = source.GetTokenValue(map.Source);
if (tokenValue == null)
{
target.Add(map.Target, string.Empty);
}
else if (tokenValue is IEnumerable<object>)
{
target.Add(map.Target, JArray.FromObject(tokenValue));
}
else
{
target.Add(map.Target, tokenValue.ToString());
}
break;
default:
throw new InvalidOperationException(string.Format(ExceptionMessages.InvalidMapType, map.MapType));
}
}
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:40,代码来源:JsonEndpointRequestMapper.cs
示例3: GetDataPropertyValueUnknownToken
public void GetDataPropertyValueUnknownToken()
{
Application application = new Application();
object value = application.GetTokenValue("Foo");
Assert.IsNull(value);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:7,代码来源:ApplicationExtensionsTests.cs
示例4: AccessNewApplication
public void AccessNewApplication()
{
ApplicationEntitlementProvider wrappedProvider = new ApplicationEntitlementProvider(new MockSecurityService());
FormPreviewApplicationEntitlementProvider provider = new FormPreviewApplicationEntitlementProvider(wrappedProvider)
{
ImpersonatedSession = new ImpersonatedSession(new Dictionary<string, string>
{
{ "role-2", "role-2" }
})
};
Application application = new Application
{
FormId = "form-1",
OrganisationId = "org-1",
WorkflowState = "New"
};
User user = new User
{
Id = "user-1",
Roles = new Dictionary<string, string>
{ { "role-1", "role-1" } }
};
user.Organisations.Add("org-1", "Organisation One");
AccessLevel applicationAccess = provider.GetApplicationAccess(new SecureSession(user), application, this.roleList, 1);
Assert.AreEqual(AccessLevel.Write, applicationAccess);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:30,代码来源:FormPreviewApplicationEntitlementProviderTests.cs
示例5: GetApplicationAccess
/// <summary>
/// Gets the base <see cref="AccessLevel" /> applicable for a combination of user & application.
/// </summary>
/// <param name="session">Contains session and user information used to determine access rights.</param>
/// <param name="application">The application.</param>
/// <param name="roleList">The list of roles.</param>
/// <param name="versionNumber">The version number of the form being accessed.</param>
/// <returns>The base <see cref="AccessLevel" /> applicable for a combination of user & application.</returns>
public virtual AccessLevel GetApplicationAccess(SecureSession session, Application application, RoleList roleList, int versionNumber)
{
if (this.IsAdministrator(session))
{
return AccessLevel.Write;
}
if (!this.IsOrganisationEntitled(session, application))
{
return AccessLevel.NoAccess;
}
string userId = this.GetSessionUserId(session);
bool viewAllDrafts = session.AuthenticatedUser != null && this.GetSystemEntitlements(userId)[SystemEntitlementAccess.VIEW_DRAFT_APPLICATIONS] > AccessLevel.NoAccess;
if (application.Draft && application.AssignedTo != userId && !viewAllDrafts)
{
return AccessLevel.NoAccess;
}
var systemEntitlements = this.GetSystemEntitlements(session.AuthenticatedUser != null ? session.AuthenticatedUser.Id : null);
if (application.Draft && application.AssignedTo != userId && systemEntitlements[SystemEntitlementAccess.VIEW_DRAFT_APPLICATIONS] == AccessLevel.NoAccess)
{
return AccessLevel.NoAccess;
}
Dictionary<string, string> userRoles = this.DetermineRolesForUser(session, roleList, application);
ApplicationEntitlementList applicationEntitlements = this.securityService.GetApplicationEntitlements(application.FormId, versionNumber, application.WorkflowState, userRoles.Keys);
return applicationEntitlements.Any() ? applicationEntitlements.Max(e => e.AccessLevel) : AccessLevel.NoAccess;
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:38,代码来源:ApplicationEntitlementProvider.cs
示例6: GetClassPropertyValueNull
public void GetClassPropertyValueNull()
{
Application application = new Application();
object value = application.GetTokenValue("ApplicationId");
Assert.IsNull(value);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:7,代码来源:ApplicationExtensionsTests.cs
示例7: ApplicationUrl
public void ApplicationUrl()
{
Application application = new Application { ApplicationId = "4kdlsjfdlsfjldsads" };
this.formatter.BaseUrl = @"http://core.iapply.web";
string replaced = this.formatter.Format(@"{%ApplicationUrl%}", application, new ControlList());
string testUrl = string.Format("{0}/#/form/{1}/app/{2}", this.formatter.BaseUrl, application.FormId, application.ApplicationId);
Assert.AreEqual(string.Format("<a href=\"{0}\">{0}</a>", testUrl), replaced);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:8,代码来源:StringFormatterTests.cs
示例8: GetDataPropertyValue
public void GetDataPropertyValue()
{
Application application = new Application();
application.ApplicationData.Add("Foo", "Bar");
string value = application.GetTokenValue("Foo").ToString();
Assert.AreEqual("Bar", value);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:8,代码来源:ApplicationExtensionsTests.cs
示例9: GetDataPropertyValueNull
public void GetDataPropertyValueNull()
{
Application application = new Application();
application.ApplicationData.Add("Foo", null);
object value = application.GetTokenValue("Foo");
Assert.IsNull(value);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:8,代码来源:ApplicationExtensionsTests.cs
示例10: DateTimeStamp
public void DateTimeStamp()
{
Application application = new Application { OrganisationId = "MyOrg!", ApplicationId = "4kdlsjfdlsfjldsads" };
string replaced = this.formatter.Format(@"Example\Path\Docs\{%OrganisationId%}_{%ApplicationId%}_{%Timestamp[yyyyMMdd-HHmmss]%}.pdf", application, new ControlList());
string date = DateTime.Now.ToString("yyyyMMdd-HHmmss");
Assert.AreEqual(@"Example\Path\Docs\MyOrg!_4kdlsjfdlsfjldsads_" + date + ".pdf", replaced);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:8,代码来源:StringFormatterTests.cs
示例11: ApplicationWorkflowItem
/// <summary>
/// Initializes a new instance of the <see cref="ApplicationWorkflowItem"/> class.
/// </summary>
/// <param name="postedApplication">The updated <see cref="Application"/> containing
/// the posted <see cref="ApplicationData"/>.</param>
/// <param name="existingData">The existing <see cref="ApplicationData"/>. Defaults to <see langword="null"/>.</param>
/// <param name="controlList">The controls. Defaults to <see langword="null"/>.</param>
public ApplicationWorkflowItem(Application postedApplication, ApplicationData existingData = null, ControlList controlList = null)
: this(postedApplication.FormId, postedApplication.LastEditBy)
{
this.ApplicationId = postedApplication.ApplicationId;
this.VersionNumber = postedApplication.VersionNumber;
this.PostedData = postedApplication.ApplicationData;
this.ExistingData = existingData;
this.ControlList = controlList;
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:16,代码来源:ApplicationWorkflowItem.cs
示例12: GetApplicationAccess
/// <summary>
/// Gets the base <see cref="AccessLevel" /> applicable for a combination of user & application.
/// </summary>
/// <param name="session">Contains session and user information used to determine access rights.</param>
/// <param name="application">The application.</param>
/// <param name="roleList">The list of roles.</param>
/// <param name="versionNumber">The version number of the form being accessed.</param>
/// <returns>The base <see cref="AccessLevel" /> applicable for a combination of user & application.</returns>
public AccessLevel GetApplicationAccess(SecureSession session, Application application, RoleList roleList, int versionNumber)
{
if (this.ImpersonatedSession != null && string.IsNullOrWhiteSpace(application.Id))
{
this.ImpersonateEntitlements(session);
}
return this.wrappedProvider.GetApplicationAccess(session, application, roleList, versionNumber);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:17,代码来源:FormPreviewApplicationEntitlementProvider.cs
示例13: GetClassPropertyValue
public void GetClassPropertyValue()
{
Application application = new Application
{
ApplicationId = "GetMe"
};
string value = application.GetTokenValue("ApplicationId").ToString();
Assert.AreEqual("GetMe", value);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:10,代码来源:ApplicationExtensionsTests.cs
示例14: ApplicationDataValueNotFound
public void ApplicationDataValueNotFound()
{
Application application = new Application { OrganisationId = "MyOrg!", ApplicationId = "4kdlsjfdlsfjldsads" };
application.ApplicationData.Add("key1", "someval");
application.ApplicationData.Add("key2", 456);
application.ApplicationData.Add("key3", false);
string replaced = this.formatter.Format(@"Example\Path\Docs\{%OrganisationId%}_{%ApplicationId%}_{%Timestamp[yyyyMMdd]%}_{%keyunknown%}.pdf", application, new ControlList());
string date = DateTime.Now.ToString("yyyyMMdd");
Assert.AreEqual(@"Example\Path\Docs\MyOrg!_4kdlsjfdlsfjldsads_" + date + "_.pdf", replaced);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:11,代码来源:StringFormatterTests.cs
示例15: CreateGetRequest
/// <summary>
/// Creates and returns a GET request.
/// </summary>
/// <param name="baseUrl">The base URL, to which QueryString parameters will be appended.</param>
/// <param name="application">The application.</param>
/// <param name="requestFieldMap">The list of request fields to map.</param>
/// <param name="obfuscatedRequestBody">The request body.</param>
/// <returns>A new <see cref="HttpWebRequest" /> that uses the GET method.</returns>
private HttpWebRequest CreateGetRequest(string baseUrl, Application application, MappedFieldList requestFieldMap, out string obfuscatedRequestBody)
{
Dictionary<string, string> parameterData = this.GetHttpVariableRequestContent(application, requestFieldMap);
string url = new UrlBuilder().Create(baseUrl, parameterData);
Uri myUri = new Uri(url);
obfuscatedRequestBody = this.ObfuscateRequest(myUri.Query, HttpResources.HttpRequestFieldValueLocator, requestFieldMap);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = WebRequestMethods.Http.Get;
return request;
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:19,代码来源:HttpWebRequestFactory.cs
示例16: SendRequest
public string SendRequest(ServiceEndpoint endpoint, ServiceEndpointUtilisation utilisation, Application application, ApplicationData updateTarget)
{
if (this.type == "VALIDATE")
{
string validateStr = AssemblyResourceReader.ReadAsString(string.Format("Test_Data.EndpointValidation.VALIDATE-{0}.json", endpoint.Id.PadLeft(2, '0')));
return validateStr;
}
return null;
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:11,代码来源:MockHttpEndpointCommunicator.cs
示例17: Create
/// <summary>
/// Creates a new <see cref="HttpWebRequest" />.
/// </summary>
/// <param name="endpoint">Contains information on what sort of request to create.</param>
/// <param name="application">The application containing values to map.</param>
/// <param name="requestFieldMap">The list of request fields to map.</param>
/// <param name="obfuscatedRequestBody">The request body.</param>
/// <returns>A new <see cref="HttpWebRequest" />.</returns>
internal HttpWebRequest Create(ServiceEndpoint endpoint, Application application, MappedFieldList requestFieldMap, out string obfuscatedRequestBody)
{
obfuscatedRequestBody = string.Empty;
if (endpoint.Method == HttpRequestMethod.GET && endpoint.RequestFormat != ServiceDataFormat.HttpVariables)
{
throw new InvalidOperationException(string.Format(ExceptionMessages.IncompatibleRequestFormat, endpoint.RequestFormat, endpoint.Method));
}
return (endpoint.Method == HttpRequestMethod.GET) ?
this.CreateGetRequest(endpoint.Url, application, requestFieldMap, out obfuscatedRequestBody) :
this.CreatePostRequest(endpoint, application, requestFieldMap, out obfuscatedRequestBody);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:20,代码来源:HttpWebRequestFactory.cs
示例18: NestedCalcDependency
public void NestedCalcDependency()
{
Application app = new Application();
app.ApplicationData[this.rootControl.Name] = "9"; // * 3
List<Dictionary<string, object>> outerValue = new List<Dictionary<string, object>>
{
new Dictionary<string, object>()
};
outerValue[0][this.outerChild.Name] = "7"; // *2
outerValue.Add(new Dictionary<string, object>());
outerValue[1][this.outerChild.Name] = "6"; // *2
List<Dictionary<string, object>> innerValue0 = new List<Dictionary<string, object>>
{
new Dictionary<string, object>()
};
innerValue0[0][this.innerChild.Name] = "10"; // * 5
innerValue0.Add(new Dictionary<string, object>());
innerValue0[1][this.innerChild.Name] = "8"; // * 5
outerValue[0][this.innerRepeat.Name] = innerValue0.ToArray();
List<Dictionary<string, object>> innerValue1 = new List<Dictionary<string, object>>
{
new Dictionary<string, object>()
};
innerValue1[0][this.innerChild.Name] = "4"; // * 5
innerValue1.Add(new Dictionary<string, object>());
innerValue1[1][this.innerChild.Name] = "5"; // * 5
outerValue[1][this.innerRepeat.Name] = innerValue1.ToArray();
app.ApplicationData[this.outerRepeat.Name] = outerValue.ToArray();
MultiExpressionEvaluator evaluator = new MultiExpressionEvaluator(app, this.controlList);
ApplicationData result = evaluator.EvaluateAll();
/* RootControl | RootCalc | OuterChild | OuterCalc | InnerChild | InnerCalc | InnerCalcWithDependency
* 9 | 27 | 7 | 14 | 10 | 50 | 91
* 9 | 27 | 7 | 14 | 8 | 40 | 81
* 9 | 27 | 6 | 12 | 4 | 20 | 59
* 9 | 27 | 6 | 12 | 5 | 25 | 64
*/
var outerResult = (Dictionary<string, object>[])result[this.outerRepeat.Name];
var outer0Inner = (Dictionary<string, object>[])outerResult[0][this.innerRepeat.Name];
var outer1Inner = (Dictionary<string, object>[])outerResult[1][this.innerRepeat.Name];
Assert.AreEqual("91", outer0Inner[0][this.innerCalcWithDependency.Name]);
Assert.AreEqual("81", outer0Inner[1][this.innerCalcWithDependency.Name]);
Assert.AreEqual("59", outer1Inner[0][this.innerCalcWithDependency.Name]);
Assert.AreEqual("64", outer1Inner[1][this.innerCalcWithDependency.Name]);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:52,代码来源:MultiExpressionEvaluatorTests.cs
示例19: ApplicationDataMissingValue
public void ApplicationDataMissingValue()
{
Application application = new Application(new ApplicationData(), Guid.NewGuid().ToString("N"));
MappedFieldList fieldMap = new MappedFieldList
{
new MappedField { MapType = MapType.Field, Source = "ReleaseYear", Target = "FinalDestination2" }
};
new XmlEndpointRequestMapper().Map(application, fieldMap, this.xmlDoc);
XmlNodeList nodeList = this.xmlDoc.GetElementsByTagName("FinalDestination2");
Assert.AreEqual(1, nodeList.Count);
Assert.AreEqual(string.Empty, nodeList[0].InnerText);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:13,代码来源:XmlEndpointRequestMapperTests.cs
示例20: ApplicationDataMissingValue
public void ApplicationDataMissingValue()
{
Application application = new Application(new ApplicationData(), Guid.NewGuid().ToString("N"));
MappedFieldList fieldMap = new MappedFieldList
{
new MappedField { MapType = MapType.Field, Source = "ReleaseYear", Target = "FinalDestination2" }
};
Dictionary<string, string> dictionary = new Dictionary<string, string>();
new HttpVarEndpointRequestMapper().Map(application, fieldMap, dictionary);
Assert.AreEqual(string.Empty, dictionary["FinalDestination2"]);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:13,代码来源:HttpVarEndpointRequestMapperTests.cs
注:本文中的iSolutions.iApply.DataContract.Application类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论