本文整理汇总了C#中Claim类的典型用法代码示例。如果您正苦于以下问题:C# Claim类的具体用法?C# Claim怎么用?C# Claim使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Claim类属于命名空间,在下文中一共展示了Claim类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateIssuer
private DefaultClaimSet CreateIssuer()
{
Claim issuerNameClaim = Claim.CreateNameClaim(IssuerName);
Claim[] claims = new Claim[] { issuerNameClaim };
return new DefaultClaimSet(claims);
}
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:7,代码来源:WspAuthorizationPolicy.cs
示例2: Execute
public static Claim Execute(Claim claim)
{
var sw = Stopwatch.StartNew();
if (!ShouldExecute(claim)) return claim;
ClearLocksBlock.UnlockClaim(claim);
try
{
if (!Reopening(claim))
{
var transaction = claim.CreateAmendClaimTransaction();
if (transaction == null) return claim;
ValidateClaimUsingTransactionRules(transaction, claim);
transaction.Cancel();
}
if (string.IsNullOrEmpty(claim.CustomCode18)) claim.CustomCode18 = claim.ExcessAndDeductiblesToProcess ? "C01" : "C02";
return claim;
}
finally
{
sw.Stop();
var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(ValidateClaimBlock).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
GlobalClaimWakeUp.Statistics[typeof(ValidateClaimBlock).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
}
}
开发者ID:victorxata,项目名称:261120,代码行数:26,代码来源:ValidateClaimBlock.cs
示例3: AddCarRental
protected internal virtual CarRental AddCarRental(Claim claim, DateTime dateIncurred, string description, decimal amount, string rentalCompany, int noOfDays) {
var item = (CarRental) (CreateExpenseItem(claim, ExpenseTypeFixture.CAR_RENTAL, dateIncurred, description, amount));
item.ModifyRentalCompany(rentalCompany);
item.ModifyNumberOfDays(noOfDays);
Container.Persist(ref item);
return item;
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例4: Execute
public static Claim Execute(Claim claim)
{
var sw = Stopwatch.StartNew();
try
{
if (!ShouldExecute(claim) ) return claim;
var transaction = claim.CreateAmendClaimWithoutValidationTransaction();
ClaimHeader claimHeader = transaction.ClaimHeader;
if (claimHeader == null && InvalidCodes.Contains(claimHeader.ClaimHeaderStatusCode))
{
transaction.Cancel();
return claim;
}
// Transfer to Genius
CreateClaimTransferRequests(claimHeader, claim);
transaction.Cancel();
claim.ClaimTransfered = true;
return claim;
}
finally
{
sw.Stop();
var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(CreateClaimTransferRequestsBlock).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
GlobalClaimWakeUp.Statistics[typeof(CreateClaimTransferRequestsBlock).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
}
}
开发者ID:victorxata,项目名称:261120,代码行数:32,代码来源:CreateClaimTransferRequestsBlock.cs
示例5: AddAirfare
protected internal virtual Airfare AddAirfare(Claim claim, DateTime dateIncurred, string description, decimal amount, string airline, string origin, string destination, bool returnJourney) {
var item = (Airfare) (CreateExpenseItem(claim, ExpenseTypeFixture.AIRFARE, dateIncurred, description, amount));
item.ModifyAirlineAndFlight(airline);
ModifyStandardJourneyFields(item, origin, destination, returnJourney);
Container.Persist(ref item);
return item;
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例6: ValidateClaimUsingTransactionRules
private static void ValidateClaimUsingTransactionRules(AbstractClaimsBusinessTransaction amendTransaction, Claim claim)
{
// The System Rules Plugin is run for any component change - need to verify it will be run across components that haven't changed as well.
var claimHeader = amendTransaction.ClaimHeader;
try
{
amendTransaction.Validate(ValidationMode.Full);
var errorOrFatalErrorMessages =
amendTransaction.Results.SelectMany(
r =>
r.Value.SelectMany(
kvp =>
kvp.Value.Where(
pr => (pr.Severity == ErrorSeverity.Error || pr.Severity == ErrorSeverity.Fatal)
)
)
)
.ToArray();
if (errorOrFatalErrorMessages.Any())
{
Logger.WarnFormat("Claim failed validation\r\n{0}\r\n", JObject.FromObject(
new
{
claimHeader.ClaimReference,
Messages = errorOrFatalErrorMessages.Select(m => new { m.Severity, m.MessageSource, m.Message }).ToArray()
}));
claim.CustomCode18 = "V02";
}
}
catch (Exception exc)
{
Logger.WarnFormat("Fatal validation error for Claim \r\n{0}\r\n", JObject.FromObject(new { amendTransaction.ClaimHeader.ClaimReference, exc.Message, exc.StackTrace }));
claim.CustomCode18 = "V01";
}
}
开发者ID:victorxata,项目名称:261120,代码行数:35,代码来源:ValidateClaimBlock.cs
示例7: addClaim
public Geo.Box addClaim(string userName, double lat, double lng)
{
Claim tile = new Claim(lat, lng);
if (!_users.ContainsKey(userName))
{
User user = new User(userName);
_users.Add(userName, user);
}
if (!_claims.ContainsKey(tile.box))
{
_claims.Add(tile.box, tile);
}
double changeInShares = _claims[tile.box].makeClaim(userName);
_users[userName].addShares(changeInShares);
foreach (string user in _claims[tile.box].getOwners().Keys)
{
if (user != userName)
{
_users[user].addShares(changeInShares * -1);
}
}
return tile.box;
}
开发者ID:joshuaphendrix,项目名称:TurfWars,代码行数:28,代码来源:TurfWars.cs
示例8: Insert
///<summary>Inserts one Claim into the database. Returns the new priKey.</summary>
internal static long Insert(Claim claim)
{
if(DataConnection.DBtype==DatabaseType.Oracle) {
claim.ClaimNum=DbHelper.GetNextOracleKey("claim","ClaimNum");
int loopcount=0;
while(loopcount<100){
try {
return Insert(claim,true);
}
catch(Oracle.DataAccess.Client.OracleException ex){
if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
claim.ClaimNum++;
loopcount++;
}
else{
throw ex;
}
}
}
throw new ApplicationException("Insert failed. Could not generate primary key.");
}
else {
return Insert(claim,false);
}
}
开发者ID:nampn,项目名称:ODental,代码行数:26,代码来源:ClaimCrud.cs
示例9: GetOutputClaimsIdentity
protected override Microsoft.IdentityModel.Claims.IClaimsIdentity GetOutputClaimsIdentity(Microsoft.IdentityModel.Claims.IClaimsPrincipal principal, Microsoft.IdentityModel.Protocols.WSTrust.RequestSecurityToken request, Scope scope)
{
if (null == principal)
{
throw new InvalidRequestException("The caller's principal is null.");
}
// Get the incoming IClaimsIdentity from IPrincipal
IClaimsIdentity callerIdentity = (IClaimsIdentity)principal.Identity;
// Create the output IClaimsIdentity
IClaimsIdentity outputIdentity = new ClaimsIdentity();
// Create a name claim from the incoming identity.
Claim nameClaim = new Claim(ClaimTypes.Name, callerIdentity.Name);
// Create an 'Age' claim with a value of 25. In a real scenario, this may likely be looked up from a database.
Claim ageClaim = new Claim("http://WindowsIdentityFoundationSamples/2008/05/AgeClaim", "25", ClaimValueTypes.Integer);
// Add the name
outputIdentity.Claims.Add(nameClaim);
outputIdentity.Claims.Add(ageClaim);
return outputIdentity;
}
开发者ID:sandrapatfer,项目名称:PROMPT11-08-Security.sandrapatfer,代码行数:25,代码来源:SimpleSecurityTokenService.cs
示例10: AddDetails
private static void AddDetails(ref PdfPTable table, ref Claim claim)
{
table.AddCell(CreateDetailTitleCell("Customer Complaint"));
table.AddCell(CreateDetailCell(claim.CustomerComplaint.ToUpper()));
table.AddCell(CreateSpacerCell());
table.AddCell(CreateDetailTitleCell("Cause of Failure"));
table.AddCell(CreateDetailCell(claim.CauseOfFailure.ToUpper()));
table.AddCell(CreateSpacerCell());
table.AddCell(CreateDetailTitleCell("Corrective Action"));
table.AddCell(CreateDetailCell(claim.CorrectiveAction.ToUpper()));
table.AddCell(CreateSpacerCell());
if(claim.MiscAmountExplanation.Trim().Length > 0 && !claim.MiscAmountExplanation.Trim().ToUpper().Equals("NONE"))
{
table.AddCell(CreateDetailTitleCell("Misc Amount Explanation"));
table.AddCell(CreateDetailCell(claim.MiscAmountExplanation.ToUpper()));
table.AddCell(CreateSpacerCell());
}
if(claim.ReimbursementComment.Trim().Length > 0 && !claim.ReimbursementComment.Trim().ToUpper().Equals("NONE"))
{
table.AddCell(CreateDetailTitleCell("Reimbursement Comment"));
table.AddCell(CreateDetailCell(claim.ReimbursementComment.ToUpper()));
table.AddCell(CreateSpacerCell());
}
}
开发者ID:dsokol,项目名称:dsokol.com,代码行数:26,代码来源:ClaimPrinter.cs
示例11: Execute
public static Claim Execute(Claim claim)
{
var sw = Stopwatch.StartNew();
if (!ShouldExecute(claim)) return claim;
var transaction = claim.CreateAmendClaimWithoutValidationTransaction();
if (transaction == null) return claim;
try
{
var claimHeader = transaction.ClaimHeader;
if (claimHeader.ClaimHeaderInternalStatus >= (short)StaticValues.ClaimHeaderInternalStatus.Finalized) return claim;
var productEvent = claim.ProductType == "MOT" ? _motorProductEvents.Value : _liabilityProductEvents.Value;
var reviewEvent = CreateReviewEvent(claimHeader, claim.GeniusXClaimHandler, productEvent.ProductEventId);
transaction.Complete(false);
if (reviewEvent != null)
{
var processHandler = GlobalClaimWakeUp.Container.Resolve<ClaimsProcessHandler>();
processHandler.ProcessComponent(reviewEvent, ProcessInvocationPoint.Virtual, 0, new ProcessParameters { Alias = "AXAManualReviewStartClaimProcessHandler" });
Logger.InfoFormat("Review Task successfully created for Claim\r\n{0}\r\n", JObject.FromObject(new { claimHeader.ClaimReference, UserId = claim.GeniusXClaimHandler }));
}
return claim;
}
catch
{
transaction.Cancel();
return claim;
}
finally
{
sw.Stop();
var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(CreateReviewTaskBlock).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
GlobalClaimWakeUp.Statistics[typeof(CreateReviewTaskBlock).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
}
}
开发者ID:victorxata,项目名称:261120,代码行数:35,代码来源:CreateReviewTaskBlock.cs
示例12: CreateExpenseItem
private AbstractExpenseItem CreateExpenseItem(Claim claim, ExpenseType type, DateTime dateIncurred, string description, decimal amount) {
AbstractExpenseItem item = (claim.CreateNewExpenseItem(type));
item.ModifyDateIncurred(dateIncurred);
item.ModifyDescription(description);
item.ModifyAmount(Money(amount, claim));
return item;
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例13: Install
public void Install() {
SVEN = EmployeeFixture.SVEN;
DICK = EmployeeFixture.DICK;
var date1 = new DateTime(2007, 7, 15);
SVEN_CLAIM_4 = CreateNewClaim(SVEN, DICK, "July 07 - 2 visits to Dublin", ProjectCodeFixture.CODE2, date1);
AddPrivateCarJourney(SVEN_CLAIM_4, date1, "Own car to airport", "Henley on Thames", "Heathrow", true, 50);
AddGeneralExpense(SVEN_CLAIM_4, date1, "Car Parking at Heathrow", Convert.ToDecimal(42.9));
AddAirfare(SVEN_CLAIM_4, date1, null, 165M, "Aer Lingus", "LHR", "DUB", true);
AddTaxi(SVEN_CLAIM_4, date1, "Taxis to & from Hotel", 30M, "Dublin Airport", "Alexander Hotel", true);
AddHotel(SVEN_CLAIM_4, date1, "Alexander Hotel", 0M, "http://ocallaghanhotels.visrez.com/dublinmain/Alexander.aspx", 1, 89M, Convert.ToDecimal(15.45), Convert.ToDecimal(3.5));
AddMeal(SVEN_CLAIM_4, date1, "Dinner", 28M);
date1 = new DateTime(2007, 7, 23);
AddPrivateCarJourney(SVEN_CLAIM_4, date1, "Own car to airport", "Henley on Thames", "Heathrow", true, 50);
AddGeneralExpense(SVEN_CLAIM_4, date1, "Car Parking at Heathrow", Convert.ToDecimal(42.9));
AddAirfare(SVEN_CLAIM_4, date1, null, 129M, "Aer Lingus", "LHR", "DUB", true);
AddTaxi(SVEN_CLAIM_4, date1, "Taxis to & from Hotel", 32M, "Dublin Airport", "Alexander Hotel", true);
AddHotel(SVEN_CLAIM_4, date1, "Alexander Hotel", 0M, "http://ocallaghanhotels.visrez.com/dublinmain/Alexander.aspx", 1, 89M, Convert.ToDecimal(15.45), Convert.ToDecimal(4.8));
AddMeal(SVEN_CLAIM_4, date1, "Dinner", 31M);
SVEN_CLAIM_4.Submit(DICK, false);
SVEN_CLAIM_4.ApproveItems(false);
}
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:26,代码来源:SvenClaim4Approved.cs
示例14: CRUD
public void CRUD()
{
using (var executionContext = new CommonTestExecutionContext())
{
var repository = new Common.DomRepository(executionContext);
var unitTestClaims = repository.Common.Claim.Query().Where(c => c.ClaimResource.StartsWith("unittest_")).ToList();
Console.WriteLine("Delete old: " + TestUtility.DumpSorted(unitTestClaims, c => c.ClaimResource + "." + c.ClaimRight) + ".");
repository.Common.Claim.Delete(unitTestClaims);
IClaimRepository cr = repository.Common.Claim;
var c1 = new Claim("unittest_c1", "c11");
var c2 = new Claim("unittest_c2", "c22");
var c3 = new Claim("unittest_c3", "c33");
cr.SaveClaims(new[] { c1, c2, c3 }, new ICommonClaim[] {}, new ICommonClaim[] {});
var loaded = cr.LoadClaims().Where(c => c.ClaimResource.StartsWith("unittest_")).ToList();
loaded.Sort((cl1, cl2) => cl1.ClaimResource.CompareTo(cl2.ClaimResource));
Assert.AreEqual("c11, c22, c33", TestUtility.Dump(loaded, c => c.ClaimRight));
loaded[0].ClaimRight = loaded[0].ClaimRight.ToUpper();
var c4 = new Claim("unittest_c4", "c44");
cr.SaveClaims(new[] { c4 }, new[] { loaded[0] }, new[] { loaded[1] });
loaded = cr.LoadClaims().Where(c => c.ClaimResource.StartsWith("unittest_")).ToList();
loaded.Sort((cl1, cl2) => cl1.ClaimResource.CompareTo(cl2.ClaimResource));
Assert.AreEqual("C11, c33, c44", TestUtility.Dump(loaded, c => c.ClaimRight));
}
}
开发者ID:koav,项目名称:Rhetos,代码行数:28,代码来源:ClaimRepositoryTest.cs
示例15: ReplaceClaimsIfExist
public void ReplaceClaimsIfExist(IClaimsIdentity claimsIdentity, Claim claimToReplaceIfExists)
{
var existingClaim = claimsIdentity.Claims.FirstOrDefault(x=> x.ClaimType == claimToReplaceIfExists.ClaimType);
if (existingClaim != null)
claimsIdentity.Claims.Remove(existingClaim);
claimsIdentity.Claims.Add(claimToReplaceIfExists);
}
开发者ID:sybrix,项目名称:EdFi-App,代码行数:7,代码来源:DashboardClaimsAuthenticationManagerProvider.cs
示例16: getClaims
public Claim[] getClaims()
{
Claim[] c = new Claim[_claims.Count];
_claims.Values.CopyTo(c,0);
return c;
}
开发者ID:joshuaphendrix,项目名称:TurfWars,代码行数:7,代码来源:TurfWars.cs
示例17: ReadJson
/// <summary>
/// Reads the JSON representation of the object.
/// </summary>
/// <param name="reader">The <see cref="T:Newtonsoft.Json.JsonReader"/> to read from.</param>
/// <param name="objectType">Type of the object.</param>
/// <param name="existingValue">The existing value of object being read.</param>
/// <param name="serializer">The calling serializer.</param>
/// <returns>The object value.</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var result = new Collection<Claim>();
while (reader.Read())
{
if (reader.TokenType == JsonToken.EndArray)
break;
if (reader.TokenType != JsonToken.StartObject)
continue;
var jo = JObject.Load(reader);
var claim = new Claim(
(string)jo["ClaimType"],
(string)jo["Value"],
(string)jo["ValueType"],
(string)jo["Issuer"],
(string)jo["OriginalIssuer"]
);
var jt = jo["Properties"];
var props = serializer.Deserialize<Dictionary<string, string>>(jt.CreateReader());
foreach (var entry in props)
claim.Properties.Add(entry.Key, entry.Value);
result.Add(claim);
}
// Reading EndObject;
reader.Read();
return result;
}
开发者ID:me-viper,项目名称:OAuthJwt,代码行数:42,代码来源:JsonClaimsConverterCollection.cs
示例18: Execute
public static void Execute(Claim claim)
{
var sw = Stopwatch.StartNew();
var transaction = claim.CreateAmendClaimWithoutValidationTransaction();
if (transaction == null) return;
try
{
List<FlattenedTransaction> transactions;
GlobalClaimWakeUp.MappedTransactionDetails.TryRemove(claim.ClaimReference, out transactions);
if (ShouldExecute(claim))
{
var claimHeader = transaction.ClaimHeader;
claimHeader.CustomCode18 = claim.CustomCode18;
transaction.Complete(false);
}
}
catch
{
transaction.Cancel();
}
finally
{
sw.Stop();
var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(SetCustomCode18Block).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
GlobalClaimWakeUp.Statistics[typeof(SetCustomCode18Block).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
}
}
开发者ID:victorxata,项目名称:261120,代码行数:28,代码来源:SetCustomCode18Block.cs
示例19: CopyClaims
private static void CopyClaims(IClaimsIdentity source, IClaimsIdentity target)
{
foreach (var claim in source.Claims)
{
// We don't copy the issuer because it is not needed in this case. The STS always issues claims
// using its own identity.
var newClaim = new Claim(claim.ClaimType, claim.Value, claim.ValueType);
// copy all claim properties
foreach (var key in claim.Properties.Keys)
{
newClaim.Properties.Add(key, claim.Properties[key]);
}
// add claim to the destination identity
target.Claims.Add(newClaim);
}
// Recursively copy claims from the source identity delegates
if (source.Actor != null)
{
target.Actor = new ClaimsIdentity();
CopyClaims(source.Actor, target.Actor);
}
}
开发者ID:colinbowern,项目名称:TwoTierSts,代码行数:25,代码来源:CustomSecurityTokenService.cs
示例20: AddPrivateCarJourney
protected internal virtual PrivateCarJourney AddPrivateCarJourney(Claim claim, DateTime dateIncurred, string description, string origin, string destination, bool returnJourney, int totalMiles) {
var item = (PrivateCarJourney) (CreateExpenseItem(claim, ExpenseTypeFixture.PRIVATE_CAR, dateIncurred, description, 0M));
ModifyStandardJourneyFields(item, origin, destination, returnJourney);
item.ModifyTotalMiles(totalMiles);
item.ModifyMileageRate(0.4);
Container.Persist(ref item);
return item;
}
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:8,代码来源:AbstractClaimFixture.cs
注:本文中的Claim类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论