本文整理汇总了C#中Claim类的典型用法代码示例。如果您正苦于以下问题:C# Claim类的具体用法?C# Claim怎么用?C# Claim使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Claim类属于命名空间,在下文中一共展示了Claim类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateIssuer
private DefaultClaimSet CreateIssuer()
{
Claim issuerNameClaim = Claim.CreateNameClaim(IssuerName);
Claim[] claims = new Claim[] { issuerNameClaim };
return new DefaultClaimSet(claims);
}
示例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));
}
}
示例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;
}
示例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));
}
}
示例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;
}
示例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";
}
}
示例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;
}
示例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);
}
}
示例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());
}
}
示例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));
}
}
示例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;
}
示例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);
}
示例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));
}
}
示例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);
}