public IActionResult EditWithAddLegalEntity(OrgUnit orgUnit, LegalEntityInformation legalEntity) { _organizationUnitProvider.AddLegalEntity(legalEntity); orgUnit.LegalEntityInformation = legalEntity; _organizationUnitProvider.Edit(orgUnit); return(Ok()); }
public IActionResult AddWithLegalEntity([FromBody] CreateEditViewModel model) { var orgUnit = new OrgUnit(); _mapper.Map(model, orgUnit); var legalEntity = new LegalEntityInformation(); model.SuperiorID = EncryptionHelper.DecryptUrlParam(model.SuperiorID); var legalEntityMapper = _mapper.Map(model, legalEntity); legalEntity.ManagingDirectorId = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(model.ManagingDirectorID)); _organizationUnitProvider.AddLegalEntity(legalEntityMapper); orgUnit.LegalEntityInformation = legalEntity; //if (model.AttachmentFile != null) //{ // var theObject = new OrgUnit(); // var tableName = GetTableName(theObject); // var attachment = new Attachment // { // TableOriginID = orgUnit.ID, // TableOriginName = tableName, // AttachmentFile = model.AttachmentFile // }; //model.SuperiorID = !string.IsNullOrEmpty(model.SuperiorID) ? EncryptionHelper.DecryptUrlParam(model.SuperiorID) : null; var orgUnitMapper = _mapper.Map(model, orgUnit); _organizationUnitProvider.Add(orgUnitMapper); return(Ok(orgUnitMapper)); }
static IsdaCompliantIndexCurveCalibratorTest() { ImmutableList.Builder <StandardId> legalEntityIdsbuilder = ImmutableList.builder(); ImmutableMarketDataBuilder marketDataBuilder = ImmutableMarketData.builder(VALUATION_DATE); ImmutableMarketDataBuilder marketDataPsBuilder = ImmutableMarketData.builder(VALUATION_DATE); for (int?i = 0; i.Value < INDEX_SIZE; ++i) { StandardId legalEntityId = StandardId.of("OG", "ABC" + i.ToString()); LegalEntityInformation information = DEFAULTED_NAMES.contains(i) ? LegalEntityInformation.isDefaulted(legalEntityId) : LegalEntityInformation.isNotDefaulted(legalEntityId); legalEntityIdsbuilder.add(legalEntityId); marketDataBuilder.addValue(LegalEntityInformationId.of(legalEntityId), information); marketDataPsBuilder.addValue(LegalEntityInformationId.of(legalEntityId), information); } LEGAL_ENTITIES = legalEntityIdsbuilder.build(); ImmutableList.Builder <CdsIndexIsdaCreditCurveNode> curveNodesBuilder = ImmutableList.builder(); ImmutableList.Builder <CdsIndexIsdaCreditCurveNode> curveNodesPsBuilder = ImmutableList.builder(); for (int i = 0; i < NUM_PILLARS; ++i) { QuoteId id = QuoteId.of(StandardId.of("OG", INDEX_TENORS[i].ToString())); CdsTemplate temp = TenorCdsTemplate.of(INDEX_TENORS[i], CONVENTION); curveNodesBuilder.add(CdsIndexIsdaCreditCurveNode.ofPointsUpfront(temp, id, INDEX_ID, LEGAL_ENTITIES, COUPON)); curveNodesPsBuilder.add(CdsIndexIsdaCreditCurveNode.ofParSpread(temp, id, INDEX_ID, LEGAL_ENTITIES)); marketDataBuilder.addValue(id, PUF_QUOTES[i]); marketDataPsBuilder.addValue(id, PS_QUOTES[i]); } CURVE_NODES = curveNodesBuilder.build(); MARKET_DATA = marketDataBuilder.build(); CURVE_NODES_PS = curveNodesPsBuilder.build(); MARKET_DATA_PS = marketDataPsBuilder.build(); }
public IActionResult EditWithLegalEntity([FromBody] CreateEditViewModel model) { var orgUnit = _organizationUnitProvider.Get(Convert.ToInt32(model.ID)); _mapper.Map(model, orgUnit); var legalEntity = new LegalEntityInformation(); if (model.LegalEntityInformationID.HasValue) { legalEntity = _organizationUnitProvider.GetLegalEntityInformation(model.LegalEntityInformationID.GetValueOrDefault()); var legalEntityMapper = _mapper.Map(model, legalEntity); _organizationUnitProvider.EditLegalEntity(legalEntityMapper); } else { var legalEntityMapper = _mapper.Map(model, legalEntity); _organizationUnitProvider.AddLegalEntity(legalEntityMapper); } #region Attachment //if (model.AttachmentFile != null) //{ // var theObject = new OrgUnit(); // var tableName = GetTableName(theObject); // if (legalEntity.AttachmentID.HasValue) // { // var attachment = GetAttachment(legalEntity.AttachmentID.GetValueOrDefault()); // attachment.TableOriginID = orgUnit.ID; // attachment.TableOriginName = tableName; // attachment.AttachmentFile = model.AttachmentFile; // SetAuditFields(attachment); // legalEntity.Attachment = attachment; // } // else // { // var attachment = new Attachment(); // attachment.TableOriginID = orgUnit.ID; // attachment.TableOriginName = tableName; // attachment.AttachmentFile = model.AttachmentFile; // context.Attachment.Add(attachment); // SetAuditFields(attachment); // legalEntity.Attachment = attachment; // } //} #endregion orgUnit.LegalEntityInformation = legalEntity; var orgUnitMapper = _mapper.Map(model, orgUnit); _organizationUnitProvider.Edit(orgUnitMapper); return(Ok(orgUnitMapper)); }
public int EditLegalEntity(LegalEntityInformation entity) { context.SbEdit(entity); return(context.SaveChanges()); }
public int AddLegalEntity(LegalEntityInformation entity) { context.SbAdd(entity); return(context.SaveChanges()); }