public void BindDLLs(LegalEntityOwnerView legalEntityOwnerView, ObjectContext db) { //Owners ddl IPhysicalEntitiesRepository physicalEntitesRepository = new PhysicalEntitiesRepository(db); ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(db); List <DDLHelper> owners = LegalEntityOwnerView.GetOwnersSelect(physicalEntitesRepository.GetValid(), legalEntitiesRepository.GetValidOwners()).OrderBy("Text ASC").ToList(); legalEntityOwnerView.Owners = new SelectList(owners, "Value", "Text"); //AdditionalFactors ddl IAdditionalFactorsRepository additionalFactorsRepository = new AdditionalFactorsRepository(db); legalEntityOwnerView.AdditionalFactors = new SelectList(additionalFactorsRepository.GetValid().OrderBy("Name ASC").ToList(), "AdditionalFactorPK", "Name"); //FulfilledFactors ddl IFulfilledFactorsRepository fulfilledFactorsRepository = new FulfilledFactorsRepository(db); legalEntityOwnerView.FulfilledFactors = new SelectList(fulfilledFactorsRepository.GetValid().OrderBy("Name ASC").ToList(), "FulfilledFactorPK", "Name"); //BussinesShareBurdens ddl IBussinesShareBurdensRepository bussinesShareBurdensRepository = new BussinesShareBurdensRepository(db); legalEntityOwnerView.BussinesShareBurdens = new SelectList(bussinesShareBurdensRepository.GetValid().OrderBy("Name ASC").ToList(), "BussinesShareBurdenPK", "Name"); //ChangeTypes ddl IChangeTypesRepository changeTypesRepository = new ChangeTypesRepository(db); legalEntityOwnerView.ChangeTypes = new SelectList(changeTypesRepository.GetValid().OrderBy("Name ASC").ToList(), "ChangeTypePK", "Name"); }
public ActionResult Index() { IAdditionalFactorsRepository additionalFactorsRepository = new AdditionalFactorsRepository(db); int page = !String.IsNullOrWhiteSpace(Request.QueryString["page"]) ? Convert.ToInt32(Request.QueryString["page"]) : 1; int pageSize = !String.IsNullOrWhiteSpace(Request.QueryString["pageSize"]) ? Convert.ToInt32(Request.QueryString["pageSize"]) : Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ResultsPerPage"]); string sortOrder = !String.IsNullOrWhiteSpace(Request.QueryString["sortOrder"]) ? Request.QueryString["sortOrder"] : "DESC"; string sortColumn = !String.IsNullOrWhiteSpace(Request.QueryString["sortColumn"]) ? Request.QueryString["sortColumn"] : "AdditionalFactorPK"; string ordering = sortColumn + " " + sortOrder; ordering = ordering.Trim(); IQueryable <AdditionalFactor> additionalFactors = additionalFactorsRepository.GetValid() .OrderBy(ordering); if (!String.IsNullOrWhiteSpace(Request.QueryString["searchString"])) { string searchString = Request.QueryString["searchString"].ToString(); additionalFactors = additionalFactors.Where(c => c.Name.Contains(searchString)); } additionalFactors = additionalFactors.Page(page, pageSize); if (!String.IsNullOrWhiteSpace(Request.QueryString["searchString"])) { string searchString = Request.QueryString["searchString"].ToString(); ViewData["numberOfRecords"] = additionalFactorsRepository.GetValid().Where(c => c.Name.Contains(searchString)).Count(); } else { ViewData["numberOfRecords"] = additionalFactorsRepository.GetValid().Count(); } int numberOfPages = ((int)ViewData["numberOfRecords"] + pageSize - 1) / pageSize; if (page > numberOfPages) { string url = LinkHelper.getQueryStringArray(new string[] { "page" }); return(Redirect("AdditionalFactor?" + url + "page=" + numberOfPages)); } else { return(View("Index", additionalFactors.ToList())); } }
public static List <LegalEntityOwnerAuditView> GetLegalEntityOwnerAuditView(ObjectContext context, int relatedEntityPK) { IAuditingDetailsRepository auditingDetailsRepository = new AuditingDetailsRepository(context); IAuditingMasterRepository auditingMasterRepository = new AuditingMasterRepository(context); var sessionTokens = (from am in auditingMasterRepository.GetAll().Where(c => c.TableName == "LegalEntityOwners") where am.RelatedEntityPK == relatedEntityPK select new { AuditingMasterPK = am.AuditingMasterPK, RelatedEntityPK = am.RelatedEntityPK, SessionToken = am.SessionToken }).ToList(); List <LegalEntityOwnerAuditView> legalEntityOwnerAuditViewList = new List <LegalEntityOwnerAuditView>(); foreach (var item in sessionTokens) { var record = auditingDetailsRepository.GetAuditingDetailByAuditingMasterPK(item.AuditingMasterPK).ToList(); LegalEntityOwnerAuditView legalEntityOwnerAuditView = new LegalEntityOwnerAuditView(); legalEntityOwnerAuditView.LegalEntityFK = record.checkInteger("LegalEntityFK"); legalEntityOwnerAuditView.OwnerFK = record.checkInteger("OwnerFK"); legalEntityOwnerAuditView.OwnerType = record.checkString("OwnerType"); legalEntityOwnerAuditView.BusinessShareAmount = record.checkDecimal("BusinessShareAmount"); legalEntityOwnerAuditView.PaidBussinesShareAmount = record.checkDecimal("PaidBussinesShareAmount"); legalEntityOwnerAuditView.NominalBussinesShareAmount = record.checkDecimal("NominalBussinesShareAmount"); legalEntityOwnerAuditView.AdditionalFactorFK = record.checkInteger("AdditionalFactorFK"); legalEntityOwnerAuditView.FulfilledFactorFK = record.checkInteger("FulfilledFactorFK"); legalEntityOwnerAuditView.BussinesShareBurdenFK = record.checkInteger("BussinesShareBurdenFK"); legalEntityOwnerAuditView.ChangeTypeFK = record.checkInteger("ChangeTypeFK"); legalEntityOwnerAuditView.NumberOfVotes = record.checkInteger("NumberOfVotes"); legalEntityOwnerAuditView.EntryDate = record.checkDate("EntryDate"); legalEntityOwnerAuditView.ChangeDate = record.checkDate("ChangeDate"); legalEntityOwnerAuditView.Deleted = record.checkBoolean("Deleted"); legalEntityOwnerAuditViewList.Add(legalEntityOwnerAuditView); } ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(context); IQueryable <LegalEntity> legalEntitiesTable = legalEntitiesRepository.GetValid(); IPhysicalEntitiesRepository physicalEntitiesRepository = new PhysicalEntitiesRepository(context); IQueryable <PhysicalEntity> physicalEntitiesTable = physicalEntitiesRepository.GetValid(); IAdditionalFactorsRepository additionalFactorsRepository = new AdditionalFactorsRepository(context); IQueryable <AdditionalFactor> additionalFactorsTable = additionalFactorsRepository.GetValid(); IFulfilledFactorsRepository fulfilledFactorsRepository = new FulfilledFactorsRepository(context); IQueryable <FulfilledFactor> fulfilledFactorsTable = fulfilledFactorsRepository.GetValid(); IBussinesShareBurdensRepository bussinesShareBurdensRepository = new BussinesShareBurdensRepository(context); IQueryable <BussinesShareBurden> bussinesShareBurdensTable = bussinesShareBurdensRepository.GetValid(); IChangeTypesRepository changeTypesRepository = new ChangeTypesRepository(context); IQueryable <ChangeType> changeTypesTable = changeTypesRepository.GetValid(); IQueryable <LegalEntityOwnerAuditView> legalEntityOwnersLE = (from t in legalEntityOwnerAuditViewList from t1 in legalEntitiesTable.Where(tbl => tbl.LegalEntityPK == t.OwnerFK).DefaultIfEmpty() from t2 in additionalFactorsTable.Where(tbl => tbl.AdditionalFactorPK == t.AdditionalFactorFK).DefaultIfEmpty() from t3 in fulfilledFactorsTable.Where(tbl => tbl.FulfilledFactorPK == t.FulfilledFactorFK).DefaultIfEmpty() from t4 in bussinesShareBurdensTable.Where(tbl => tbl.BussinesShareBurdenPK == t.BussinesShareBurdenFK).DefaultIfEmpty() from t5 in changeTypesTable.Where(tbl => tbl.ChangeTypePK == t.ChangeTypeFK).DefaultIfEmpty() where t.ChangeDate != null && t.OwnerType != null && t.OwnerType.Contains("le") select new LegalEntityOwnerAuditView { LegalEntityOwnerPK = t.LegalEntityOwnerPK, OwnerName = t1 != null && t1.Name != null ? t1.Name : null, AdditionalFactorName = t2 != null && t2.Name != null ? t2.Name : null, FulfilledFactorName = t3 != null && t3.Name != null ? t3.Name : null, BussinesShareBurdenName = t4 != null && t4.Name != null ? t4.Name : null, ChangeTypeName = t5 != null && t5.Name != null ? t5.Name : null, BusinessShareAmount = t.BusinessShareAmount != null ? t.BusinessShareAmount : null, PaidBussinesShareAmount = t.PaidBussinesShareAmount != null ? t.PaidBussinesShareAmount : null, NominalBussinesShareAmount = t.NominalBussinesShareAmount != null ? t.NominalBussinesShareAmount : null, NumberOfVotes = t.NumberOfVotes != null ? t.NumberOfVotes : null, EntryDate = t.EntryDate != null ? t.EntryDate : null, ChangeDate = t.ChangeDate != null ? t.ChangeDate : null, Deleted = t.Deleted != null ? t.Deleted : null, }).AsQueryable <LegalEntityOwnerAuditView>(); IQueryable <LegalEntityOwnerAuditView> legalEntityOwnersPE = (from t in legalEntityOwnerAuditViewList from t1 in physicalEntitiesTable.Where(tbl => tbl.PhysicalEntityPK == t.OwnerFK).DefaultIfEmpty() from t2 in additionalFactorsTable.Where(tbl => tbl.AdditionalFactorPK == t.AdditionalFactorFK).DefaultIfEmpty() from t3 in fulfilledFactorsTable.Where(tbl => tbl.FulfilledFactorPK == t.FulfilledFactorFK).DefaultIfEmpty() from t4 in bussinesShareBurdensTable.Where(tbl => tbl.BussinesShareBurdenPK == t.BussinesShareBurdenFK).DefaultIfEmpty() from t5 in changeTypesTable.Where(tbl => tbl.ChangeTypePK == t.ChangeTypeFK).DefaultIfEmpty() where t.ChangeDate != null && t.OwnerType != null && t.OwnerType.Contains("pe") select new LegalEntityOwnerAuditView { LegalEntityOwnerPK = t.LegalEntityOwnerPK, OwnerName = t1 != null && t1.Firstname != null && t1.Lastname != null ? t1.Firstname + " " + t1.Lastname : null, AdditionalFactorName = t2 != null && t2.Name != null ? t2.Name : null, FulfilledFactorName = t3 != null && t3.Name != null ? t3.Name : null, BussinesShareBurdenName = t4 != null && t4.Name != null ? t4.Name : null, ChangeTypeName = t5 != null && t5.Name != null ? t5.Name : null, BusinessShareAmount = t.BusinessShareAmount != null ? t.BusinessShareAmount : null, PaidBussinesShareAmount = t.PaidBussinesShareAmount != null ? t.PaidBussinesShareAmount : null, NominalBussinesShareAmount = t.NominalBussinesShareAmount != null ? t.NominalBussinesShareAmount : null, NumberOfVotes = t.NumberOfVotes != null ? t.NumberOfVotes : null, EntryDate = t.EntryDate != null ? t.EntryDate : null, ChangeDate = t.ChangeDate != null ? t.ChangeDate : null, Deleted = t.Deleted != null ? t.Deleted : null, }).AsQueryable <LegalEntityOwnerAuditView>(); List <LegalEntityOwnerAuditView> legalEntityOwners = legalEntityOwnersLE.Union(legalEntityOwnersPE).OrderBy(c => c.ChangeDate).ToList(); return(legalEntityOwners); }