Example #1
0
 public void SaveCapitalCall(CapitalCall capitalCall)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (capitalCall.CapitalCallID == 0) {
             context.CapitalCalls.AddObject(capitalCall);
         } else {
             //Update capitalCall,capitalCall account values
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key;
             object originalItem;
             foreach (var item in capitalCall.CapitalCallLineItems) {
                 key = default(EntityKey);
                 key = context.CreateEntityKey("CapitalCallLineItems", item);
                 if (context.TryGetObjectByKey(key, out originalItem)) {
                     context.ApplyCurrentValues(key.EntitySetName, item);
                 }
             }
             key = default(EntityKey);
             key = context.CreateEntityKey("CapitalCalls", capitalCall);
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 context.ApplyCurrentValues(key.EntitySetName, capitalCall);
             }
         }
         context.SaveChanges();
     }
 }
Example #2
0
 public List<AccountInformation> BankAccountInformationList(int pageIndex, int pageSize, string sortName, string sortOrder, ref int totalRows, int investorId)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         IQueryable<AccountInformation> query = (from account in context.InvestorAccountsTable
                                                 where account.InvestorID == investorId
                                                 select new AccountInformation {
                                                     ABANumber = account.Routing,
                                                     AccountNumber = account.Account,
                                                     Attention = account.Attention,
                                                     AccountOf = account.AccountOf,
                                                     BankName = account.BankName,
                                                     ByOrderOf = account.ByOrderOf,
                                                     FFC = account.FFC,
                                                     FFCNumber = account.FFCNumber,
                                                     AccountId = account.InvestorAccountID,
                                                     IBAN = account.IBAN,
                                                     Reference = account.Reference,
                                                     Swift = account.SWIFT,
                                                     InvestorId = account.InvestorID
                                                 });
         query = query.OrderBy(sortName, (sortOrder == "asc"));
         PaginatedList<AccountInformation> paginatedList = new PaginatedList<AccountInformation>(query, pageIndex, pageSize);
         totalRows = paginatedList.TotalCount;
         return paginatedList;
     }
 }
Example #3
0
 public void SaveEntityMenu(EntityMenu entityMenu)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (entityMenu.EntityMenuID == 0) {
             if (context.EntityMenus.Count() > 0)
                 entityMenu.SortOrder = context.EntityMenus.Select(em => em.EntityMenuID).Max() + 1;
             else
                 entityMenu.SortOrder = 1;
             context.EntityMenus.AddObject(entityMenu);
         }
         else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("EntityMenus", entityMenu);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, entityMenu);
             }
         }
         context.SaveChanges();
     }
 }
Example #4
0
 public List<Models.Entity.Fund> GetAllFundNames()
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         return (from fund in context.FundsTable
                 orderby fund.FundName
                 select fund).ToList();
     }
 }
Example #5
0
 public Models.Entity.Fund FindFund(string fundName)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         return context.FundsTable
                       .Where(fund => fund.FundName == fundName)
                       .FirstOrDefault();
     }
 }
Example #6
0
 public AccountingEntryTemplate FindAccountingEntryTemplate(int id)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         return (from accountingEntryTemplate in context.AccountingEntryTemplatesTable
                 where accountingEntryTemplate.AccountingEntryTemplateID == id
                 select accountingEntryTemplate).FirstOrDefault();
     }
 }
Example #7
0
 public bool AccountNameAvailable(string accountName, int virtualAccountID)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         return ((from virtualAccount in context.VirtualAccountsTable
                  where virtualAccount.AccountName == accountName && virtualAccount.VirtualAccountID != virtualAccountID
                  select virtualAccount.VirtualAccountID).Count()) > 0 ? true : false;
     }
 }
Example #8
0
 public void DeleteFundRateSchedule(int id)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         FundRateSchedule rateSchedule = context.FundRateSchedulesTable
                                              .SingleOrDefault(schedule => schedule.FundRateScheduleID == id);
         context.FundRateSchedules.DeleteObject(rateSchedule);
         context.SaveChanges();
     }
 }
Example #9
0
 public List<FundClosing> GetAllFundClosings(int fundId)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         return (from fundClose in context.FundClosingsTable
                 where fundClose.FundID == fundId
                 orderby fundClose.FundClosingDate descending
                 select fundClose).ToList();
     }
 }
Example #10
0
 public AccountingEntryTemplate FindAccountingEntryTemplate(int fundID,   int accountingTransactionTypeID, bool isCredit)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         return (from accountingEntryTemplate in context.AccountingEntryTemplatesTable
                 where accountingEntryTemplate.FundID == fundID
                  && accountingEntryTemplate.AccountingTransactionTypeID == accountingTransactionTypeID
                  && accountingEntryTemplate.IsCredit == isCredit
                 select accountingEntryTemplate).FirstOrDefault();
     }
 }
Example #11
0
 public Models.Entity.Fund FindFund(int fundId)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         return context.Funds
                       .Include("FundClosings")
                       .Include("FundAccounts")
                       .Include("FundRateSchedules")
                       .Include("InvestorFunds")
                       .EntityFilter()
                       .SingleOrDefault(fund => fund.FundID == fundId);
     }
 }
Example #12
0
 public void SaveModule(MODULE module)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (module.ModuleID == 0) {
             context.MODULEs.AddObject(module);
         } else {
             context.MODULEsTable.SingleOrDefault(entityType => entityType.ModuleID == module.ModuleID);
             context.MODULEs.ApplyCurrentValues(module);
         }
         context.SaveChanges();
     }
 }
Example #13
0
 public bool DeleteAccountingEntryTemplate(int id)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         AccountingEntryTemplate accountingEntryTemplate = context.AccountingEntryTemplatesTable.FirstOrDefault(virAcc => virAcc.AccountingEntryTemplateID == id);
         if (accountingEntryTemplate != null) {
             if (accountingEntryTemplate.AccountingEntries.Count() == 0) {
                 context.AccountingEntryTemplates.DeleteObject(accountingEntryTemplate);
                 context.SaveChanges();
                 return true;
             }
         }
         return false;
     }
 }
Example #14
0
 public void DeleteManagementFeeRateSchedule(int id)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         ManagementFeeRateSchedule rateSchedule = context.ManagementFeeRateSchedules
                                                 .Include("ManagementFeeRateScheduleTiers")
                                                 .EntityFilter()
                                                 .SingleOrDefault(schedule => schedule.ManagementFeeRateScheduleID == id);
         foreach (var tier in rateSchedule.ManagementFeeRateScheduleTiers) {
             context.ManagementFeeRateScheduleTiers.DeleteObject(tier);
         }
         context.ManagementFeeRateSchedules.DeleteObject(rateSchedule);
         context.SaveChanges();
     }
 }
Example #15
0
 public List<AutoCompleteList> FindAccountingEntryAmountTypes(string accountingEntryAmountTypeName)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         IQueryable<AutoCompleteList> query = (from accEntryAmountType in context.AccountingEntryAmountTypesTable
                                               where accEntryAmountType.Name.StartsWith(accountingEntryAmountTypeName)
                                               orderby accEntryAmountType.Name
                                               select new AutoCompleteList {
                                                   id = accEntryAmountType.AccouningEntryAmountTypeID,
                                                   label = accEntryAmountType.Name,
                                                   value = accEntryAmountType.Name
                                               });
         return new PaginatedList<AutoCompleteList>(query, 1, AutoCompleteOptions.RowsLength);
     }
 }
Example #16
0
 public bool DeleteVirtualAccount(int id)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         VirtualAccount virtualAccount = context.VirtualAccountsTable.FirstOrDefault(virAcc => virAcc.VirtualAccountID == id);
         if (virtualAccount != null) {
             foreach (var virAcc in virtualAccount.VirtualAccount1) {
                 virAcc.ActualAccountID = null;
             }
             context.VirtualAccounts.DeleteObject(virtualAccount);
             context.SaveChanges();
             return true;
         }
         return false;
     }
 }
Example #17
0
 public List<AutoCompleteList> FindFundClosings(string fundName, int? fundId)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         IQueryable<AutoCompleteList> fundListQuery = (from fundClosing in context.FundClosingsTable
                                                       where fundClosing.Name.StartsWith(fundName)
                                                       && fundClosing.FundID == (fundId ?? 0)
                                                       orderby fundClosing.Name
                                                       select new AutoCompleteList {
                                                           id = fundClosing.FundClosingID,
                                                           label = fundClosing.Name,
                                                           value = fundClosing.Name
                                                       });
         return new PaginatedList<AutoCompleteList>(fundListQuery, 1, AutoCompleteOptions.RowsLength);
     }
 }
 public void SaveUnderlyingDirectDocument(UnderlyingDirectDocument underlyingDirectDocument)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (underlyingDirectDocument.UnderlyingDirectDocumentID == 0) {
             context.UnderlyingDirectDocuments.AddObject(underlyingDirectDocument);
         }
         else {
             EntityKey key;
             object originalItem;
             UnderlyingDirectDocument updateUnderlyingDirectDocument = context.UnderlyingDirectDocumentsTable.SingleOrDefault(deepblueUnderlyingDirectDocument => deepblueUnderlyingDirectDocument.UnderlyingDirectDocumentID == underlyingDirectDocument.UnderlyingDirectDocumentID);
             /* Contact & Communication */
             key = default(EntityKey);
             originalItem = null;
             key = context.CreateEntityKey("Files", underlyingDirectDocument.File);
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 context.ApplyCurrentValues(key.EntitySetName, underlyingDirectDocument.File);
             }
             else {
                 updateUnderlyingDirectDocument.File = new Models.Entity.File {
                     CreatedBy = underlyingDirectDocument.File.CreatedBy,
                     CreatedDate = underlyingDirectDocument.File.CreatedDate,
                     EntityID = underlyingDirectDocument.File.EntityID,
                     FileID = underlyingDirectDocument.File.FileID,
                     FileName = underlyingDirectDocument.File.FileName,
                     FilePath = underlyingDirectDocument.File.FilePath,
                     FileTypeID = underlyingDirectDocument.File.FileTypeID,
                     LastUpdatedBy = underlyingDirectDocument.File.LastUpdatedBy,
                     LastUpdatedDate = underlyingDirectDocument.File.LastUpdatedDate,
                     Size = underlyingDirectDocument.File.Size
                 };
             }
             // Define an ObjectStateEntry and EntityKey for the current object.
             key = default(EntityKey);
             originalItem = null;
             key = context.CreateEntityKey("UnderlyingDirectDocuments", underlyingDirectDocument);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, underlyingDirectDocument);
             }
         }
         context.SaveChanges();
     }
 }
Example #19
0
 public List<AutoCompleteList> FindDealFunds(int underlyingFundId, string fundName)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         IQueryable<AutoCompleteList> fundListQuery = (from fund in context.FundsTable
                                                       join deal in context.DealsTable on fund.FundID equals deal.FundID
                                                       join dealUnderlyingFund in context.DealUnderlyingFundsTable on deal.DealID equals dealUnderlyingFund.DealID
                                                       where fund.FundName.StartsWith(fundName) && dealUnderlyingFund.UnderlyingFundID == underlyingFundId
                                                       group fund by fund.FundID into funds
                                                       orderby funds.FirstOrDefault().FundName
                                                       select new AutoCompleteList {
                                                           id = funds.FirstOrDefault().FundID,
                                                           label = funds.FirstOrDefault().FundName,
                                                           value = funds.FirstOrDefault().FundName
                                                       });
         return new PaginatedList<AutoCompleteList>(fundListQuery, 1, AutoCompleteOptions.RowsLength);
     }
 }
Example #20
0
 public void SaveVirtualAccount(VirtualAccount virtualAccount)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (virtualAccount.VirtualAccountID == 0) {
             context.VirtualAccounts.AddObject(virtualAccount);
         } else {
             EntityKey key;
             object originalItem;
             originalItem = null;
             key = default(EntityKey);
             key = context.CreateEntityKey("VirtualAccounts", virtualAccount);
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 context.ApplyCurrentValues(key.EntitySetName, virtualAccount);
             }
         }
         context.SaveChanges();
     }
 }
Example #21
0
 public void SaveUser(USER user)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (user.UserID == 0) {
             context.USERs.AddObject(user);
         } else {
             //Update user,user account values
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key;
             object originalItem;
             key = default(EntityKey);
             key = context.CreateEntityKey("USERs", user);
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 context.ApplyCurrentValues(key.EntitySetName, user);
             }
         }
         context.SaveChanges();
     }
 }
Example #22
0
 public object FindInvestorFundDetail(int investorFundId)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         return (from investorFund in context.InvestorFundsTable
                 where investorFund.InvestorFundID == investorFundId
                 select new {
                     InvestorName = investorFund.Investor.InvestorName,
                     InvestorId = investorFund.Investor.InvestorID,
                     InvestorFundId = investorFund.InvestorFundID,
                     OriginalCommitmentAmount = investorFund.TotalCommitment,
                     UnfundedAmount = investorFund.UnfundedAmount ?? 0,
                     Date = DateTime.Now,
                     CounterPartyInvestorId = 0,
                     CounterPartyInvestorName = string.Empty,
                     TransactionTypeId = (int)DeepBlue.Models.Transaction.Enums.TransactionType.Sell,
                     FundId = investorFund.FundID
                 }).ToList();
     }
 }
 public void SaveUnderlyingFundCapitalCallLineItem(UnderlyingFundCapitalCallLineItem underlyingFundCapitalCallLineItem)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (underlyingFundCapitalCallLineItem.UnderlyingFundCapitalCallLineItemID == 0) {
             context.UnderlyingFundCapitalCallLineItems.AddObject(underlyingFundCapitalCallLineItem);
         }
         else {
             //Update underlyingFundCapitalCallLineItem,underlyingFundCapitalCallLineItem account values
             //Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key;
             object originalItem;
             key = default(EntityKey);
             key = context.CreateEntityKey("UnderlyingFundCapitalCallLineItems", underlyingFundCapitalCallLineItem);
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 context.ApplyCurrentValues(key.EntitySetName, underlyingFundCapitalCallLineItem);
             }
         }
         context.SaveChanges();
     }
 }
Example #24
0
 public List<ContactInformation> ContactInformationList(int pageIndex, int pageSize, string sortName, string sortOrder, ref int totalRows, int investorId)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         IQueryable<ContactInformation> query = (from investorContact in context.InvestorContactsTable
                                                 where investorContact.InvestorID == investorId
                                                 select new ContactInformation {
                                                     Person = investorContact.Contact.ContactName,
                                                     DistributionNotices = investorContact.Contact.ReceivesDistributionNotices,
                                                     Financials = investorContact.Contact.ReceivesFinancials,
                                                     InvestorLetters = investorContact.Contact.ReceivesInvestorLetters,
                                                     K1 = investorContact.Contact.ReceivesK1,
                                                     Designation = investorContact.Contact.Designation,
                                                     ContactId = investorContact.ContactID,
                                                     InvestorId = investorContact.InvestorID,
                                                     InvestorContactId = investorContact.InvestorContactID,
                                                     AddressInformations = (from contactAddress in investorContact.Contact.ContactAddresses
                                                                            select new AddressInformation {
                                                                                Address1 = contactAddress.Address.Address1,
                                                                                Address2 = contactAddress.Address.Address2,
                                                                                Country = contactAddress.Address.Country,
                                                                                CountryName = contactAddress.Address.COUNTRY1.CountryName,
                                                                                State = contactAddress.Address.State,
                                                                                StateName = contactAddress.Address.STATE1.Name,
                                                                                City = contactAddress.Address.City,
                                                                                Zip = contactAddress.Address.PostalCode,
                                                                                AddressId = contactAddress.AddressID,
                                                                                ContactAddressId = contactAddress.ContactAddressID
                                                                            }),
                                                     ContactCommunications = (from contactCommunication in investorContact.Contact.ContactCommunications
                                                                              select new ContactCommunicationInformation {
                                                                                  ContactCommunicationId = contactCommunication.ContactCommunicationID,
                                                                                  CommunicationTypeId = contactCommunication.Communication.CommunicationTypeID,
                                                                                  CommunicationValue = contactCommunication.Communication.CommunicationValue
                                                                              }),
                                                 });
         query = query.OrderBy(sortName, (sortOrder == "asc"));
         PaginatedList<ContactInformation> paginatedList = new PaginatedList<ContactInformation>(query, pageIndex, pageSize);
         totalRows = paginatedList.TotalCount;
         return paginatedList;
     }
 }
 public void SaveCommunicationGrouping(CommunicationGrouping communicationGrouping)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (communicationGrouping.CommunicationGroupingID == 0) {
             context.CommunicationGroupings.AddObject(communicationGrouping);
         } else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("CommunicationGroupings", communicationGrouping);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, communicationGrouping);
             }
         }
         context.SaveChanges();
     }
 }
 public void SaveDealUnderlyingFundAdjustment(DealUnderlyingFundAdjustment dealUnderlyingFund)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (dealUnderlyingFund.DealUnderlyingFundAdjustmentID == 0) {
             context.DealUnderlyingFundAdjustments.AddObject(dealUnderlyingFund);
         }
         else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("DealUnderlyingFundAdjustments", dealUnderlyingFund);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, dealUnderlyingFund);
             }
         }
         context.SaveChanges();
     }
 }
 public void SaveManagementFeeRateSchedule(ManagementFeeRateSchedule managementFeeRateSchedule)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (managementFeeRateSchedule.ManagementFeeRateScheduleID == 0) {
             context.ManagementFeeRateSchedules.AddObject(managementFeeRateSchedule);
         }
         /*else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("ManagementFeeRateSchedules", managementFeeRateSchedule);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, managementFeeRateSchedule);
             }
         }*/
         context.SaveChanges();
     }
 }
 public void SaveUnderlyingDirectLastPrice(UnderlyingDirectLastPrice underlyingDirectLastPrice)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (underlyingDirectLastPrice.UnderlyingDirectLastPriceID == 0) {
             context.UnderlyingDirectLastPrices.AddObject(underlyingDirectLastPrice);
         }
         else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("UnderlyingDirectLastPrices", underlyingDirectLastPrice);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, underlyingDirectLastPrice);
             }
         }
         context.SaveChanges();
     }
 }
Example #29
0
 public void SaveFundActivityHistory(FundActivityHistory fundActivityHistory)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (fundActivityHistory.FundActivityHistoryID == 0) {
             context.FundActivityHistories.AddObject(fundActivityHistory);
         }
         else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("FundActivityHistories", fundActivityHistory);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, fundActivityHistory);
             }
         }
         context.SaveChanges();
     }
 }
Example #30
0
 public USER FetchUserLogin(string userName, int entityId)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         return context.USERs.Where(user => user.Login == userName && user.EntityID == entityId && user.Enabled == true).SingleOrDefault();
     }
 }