private async Task <IActionResult> ResponseUpPartyAsync(string upPartyName, PartyTypes upPartyType) { logger.ScopeTrace(() => $"Single Logout response, Up type {upPartyType}."); var partyId = await UpParty.IdFormatAsync(RouteBinding, upPartyName); logger.SetScopeProperty(Constants.Logs.UpPartyId, partyId); switch (upPartyType) { case PartyTypes.Login: return(HttpContext.GetUpPartyUrl(upPartyName, Constants.Routes.LoginController, Constants.Endpoints.SingleLogoutDone, includeSequence: true).ToRedirectResult()); case PartyTypes.Oidc: var oidcUpParty = await tenantRepository.GetAsync <UpParty>(partyId); return(HttpContext.GetUpPartyUrl(upPartyName, Constants.Routes.OAuthController, Constants.Endpoints.SingleLogoutDone, includeSequence: true, partyBindingPattern: oidcUpParty.PartyBindingPattern).ToRedirectResult()); case PartyTypes.Saml2: var samlUpParty = await tenantRepository.GetAsync <UpParty>(partyId); return(HttpContext.GetUpPartyUrl(upPartyName, Constants.Routes.SamlController, Constants.Endpoints.SingleLogoutDone, includeSequence: true, partyBindingPattern: samlUpParty.PartyBindingPattern).ToRedirectResult()); default: throw new NotSupportedException(); } }
private void ShowCreateDownParty(PartyTypes type, OAuthSubPartyTypes?oauthSubPartyType = null) { if (type == PartyTypes.Oidc) { var oidcDownParty = new GeneralOidcDownPartyViewModel(); oidcDownParty.CreateMode = true; oidcDownParty.Edit = true; downParties.Add(oidcDownParty); } else if (type == PartyTypes.OAuth2) { var oauthDownParty = new GeneralOAuthDownPartyViewModel(); if (!oauthSubPartyType.HasValue) { throw new ArgumentNullException(nameof(oauthSubPartyType), "Required for OAuth 2.0 down parties."); } oauthDownParty.SubPartyType = oauthSubPartyType.Value; oauthDownParty.CreateMode = true; oauthDownParty.Edit = true; downParties.Add(oauthDownParty); } else if (type == PartyTypes.Saml2) { var samlDownParty = new GeneralSamlDownPartyViewModel(); samlDownParty.CreateMode = true; samlDownParty.Edit = true; downParties.Add(samlDownParty); } }
public Collection <ListItem> GetPartyTypes() { Collection <ListItem> values = new Collection <ListItem>(); IEnumerable <PartyType> partyTypes = PartyTypes.GetPartyTypes(AppUsers.GetCurrentUserDB()); foreach (PartyType partyType in partyTypes) { values.Add(new ListItem(partyType.PartyTypeName, partyType.PartyTypeId.ToString(CultureInfo.InvariantCulture))); } return(values); }
private IActionResult ResponseUpParty(string upPartyName, PartyTypes upPartyType) { logger.ScopeTrace($"Response, Up type {upPartyType}."); switch (upPartyType) { case PartyTypes.Login: return(HttpContext.GetUpPartyUrl(upPartyName, Constants.Routes.LoginController, Constants.Endpoints.SingleLogoutDone, includeSequence: true).ToRedirectResult()); case PartyTypes.Oidc: return(HttpContext.GetUpPartyUrl(upPartyName, Constants.Routes.OAuthController, Constants.Endpoints.SingleLogoutDone, includeSequence: true).ToRedirectResult()); case PartyTypes.Saml2: return(HttpContext.GetUpPartyUrl(upPartyName, Constants.Routes.SamlController, Constants.Endpoints.SingleLogoutDone, includeSequence: true).ToRedirectResult()); default: throw new NotSupportedException(); } }
public bool LinkProsCaseParty(int ProsecutionID, long CasePartyID, PartyTypes defectType) { try { switch (defectType) { case PartyTypes.Victim: CasePartyProsecutionComponent.LinkCaseVictimPros(CasePartyID, ProsecutionID); break; case PartyTypes.Defendant: CasePartyProsecutionComponent.LinkCaseDefendantPros(CasePartyID, ProsecutionID); break; } return(true); } catch (Exception ex) { HandleException(ex); return(false); } }
private void ShowCreateUpParty(PartyTypes type) { if (type == PartyTypes.Login) { var loginUpParty = new GeneralLoginUpPartyViewModel(); loginUpParty.CreateMode = true; loginUpParty.Edit = true; upParties.Add(loginUpParty); } else if (type == PartyTypes.Oidc) { var oidcUpParty = new GeneralOidcUpPartyViewModel(); oidcUpParty.CreateMode = true; oidcUpParty.Edit = true; upParties.Add(oidcUpParty); } else if (type == PartyTypes.Saml2) { var samlUpParty = new GeneralSamlUpPartyViewModel(); samlUpParty.CreateMode = true; samlUpParty.Edit = true; upParties.Add(samlUpParty); } }
private void ShowCreateDownParty(PartyTypes type) { if (type == PartyTypes.Oidc) { var oidcDownParty = new GeneralOidcDownPartyViewModel(); oidcDownParty.CreateMode = true; oidcDownParty.Edit = true; downParties.Add(oidcDownParty); } else if (type == PartyTypes.OAuth2) { var oauthDownParty = new GeneralOAuthDownPartyViewModel(); oauthDownParty.CreateMode = true; oauthDownParty.Edit = true; downParties.Add(oauthDownParty); } else if (type == PartyTypes.Saml2) { var samlDownParty = new GeneralSamlDownPartyViewModel(); samlDownParty.CreateMode = true; samlDownParty.Edit = true; downParties.Add(samlDownParty); } }
/// <summary> /// Get the applicable taxes as the intersection of item taxes and customer/vendor taxes. /// </summary> /// <param name="itemId">Item Id</param> /// <param name="partyId">Party Id</param> /// <param name="partyType">Type of party i.e. Customer / Vendor</param> /// <returns>Taxes</returns> public IEnumerable <Tax> GetIntersectionTaxes(int itemId, int partyId, PartyTypes partyType) { ICollection <TaxGroupTax> partyTaxes = null; ICollection <ItemTaxGroupTax> itemTaxes = null; IList <Tax> taxes = new List <Tax>(); object party = null; var item = _itemRepo.GetAllIncluding(i => i.ItemTaxGroup, i => i.ItemTaxGroup.ItemTaxGroupTax) .Where(i => i.Id == itemId) .FirstOrDefault(); if (item == null || item.ItemTaxGroup == null || item.ItemTaxGroup.ItemTaxGroupTax == null || item.ItemTaxGroup.ItemTaxGroupTax.Count == 0) { //Console.Debug("Item is not configured to compute tax"); return(taxes); } itemTaxes = item.ItemTaxGroup.ItemTaxGroupTax.Where(t => t.IsExempt == false).ToList(); if (partyType == PartyTypes.Customer) { party = _customerRepo.GetAllIncluding(c => c.TaxGroup, c => c.TaxGroup.TaxGroupTax) .Where(c => c.Id == partyId) .FirstOrDefault(); if (party == null || ((Customer)party).TaxGroup == null || ((Customer)party).TaxGroup.TaxGroupTax == null || ((Customer)party).TaxGroup.TaxGroupTax.Count == 0) { //Console.Debug("Customer is not configured to compute tax"); return(taxes); } partyTaxes = ((Customer)party).TaxGroup.TaxGroupTax; } else { party = _vendorRepo.GetAllIncluding(v => v.TaxGroup, v => v.TaxGroup.TaxGroupTax) .Where(v => v.Id == partyId) .FirstOrDefault(); if (party == null || ((Vendor)party).TaxGroup == null || ((Vendor)party).TaxGroup.TaxGroupTax == null || ((Vendor)party).TaxGroup.TaxGroupTax.Count == 0) { //Console.Debug("Vendor is not configured to compute tax"); return(taxes); } partyTaxes = ((Vendor)party).TaxGroup.TaxGroupTax; } //var intersectionTaxes = from p in partyTaxes // join i in itemTaxes on p.TaxId equals i.TaxId // select new { p, i }; //if (intersectionTaxes == null || intersectionTaxes.Count() == 0) // return taxes; //taxes = from t in intersectionTaxes select t.p.Tax; var allTaxes = _taxRepo.GetAllIncluding().ToList(); foreach (var p in partyTaxes) { foreach (var i in itemTaxes) { if (p.TaxId == i.TaxId) { taxes.Add(allTaxes.Where(t => t.Id == p.TaxId).FirstOrDefault()); break; } } } return(taxes); }
public GeneralDownPartyViewModel(PartyTypes type) { Type = type; }