public Arrangement(PointsViewModel points, IConfiguration configuration, IHttpClientFactory httpClientFactory)
 {
     Points            = points;
     Configuration     = configuration;
     HttpClientFactory = httpClientFactory;
     SUT = new PlacesRepository(configuration, httpClientFactory);
 }
        public MainViewModel()
        {
            // Initialize Data layer
            var fs                          = new MyAccounts.Business.IO.WindowsFileSystem();
            var workingCopy                 = new WorkingCopy(fs, Properties.Settings.Default.WorkingFolder);
            var accountsRepository          = new AccountsRepository(workingCopy);
            var accountCommandRepository    = new AccountCommandRepository(workingCopy);
            var placesRepository            = new PlacesRepository();
            var placeProvider               = PlaceProvider.Load(placesRepository);
            var placeInfoResolver           = new PlaceInfoResolver(placeProvider);
            var operationPatternTransformer = new UnifiedAccountOperationPatternTransformer(placeInfoResolver);
            var operationsRepository        = new OperationsRepository(workingCopy, new CsvAccountOperationManager(), operationPatternTransformer);

            // Initialize Managers
            var operationsManager = new OperationsManager(App.CacheManager, operationsRepository);
            var accountsManager   = new AccountsManager(App.CacheManager, accountsRepository);
            var importManager     = new ImportManager(App.CacheManager, accountCommandRepository, operationsManager);

            // Initialize View Models

            BusyIndicator = new BusyIndicatorViewModel();

            ImportsManagerViewModel = new ImportsManagerViewModel(BusyIndicator, fs, importManager);

            OperationsManagerViewModel = new OperationsManagerViewModel(BusyIndicator, operationsManager, importManager);
            AccountsManagerViewModel   = new AccountsManagerViewModel(BusyIndicator, accountsManager, operationsManager, importManager);
            DashboardViewModel         = new DashboardViewModel(BusyIndicator);
            GmcManager       = new GmcManager(BusyIndicator, App.CacheManager, operationsManager);
            _settingsManager = new SettingsManager(App.CacheManager);

            MessengerInstance.Register <Properties.Settings>(this, OnSettingsUpdated);
            _asyncMessageReceiver = new AsyncMessageReceiver(MessengerInstance);
            _asyncMessageReceiver.RegisterAsync <AccountDataInvalidated>(this, data => Refresh());

            if (!IsInDesignMode)
            {
                LoadCommand    = new AsyncCommand(Load);
                RefreshCommand = new AsyncCommand(Refresh);
            }
            else
            {
                AccountsManagerViewModel.Accounts.Add(
                    new AccountViewModel
                {
                    Name   = "Blaise CC",
                    Status =
                    {
                        Operations            =          7,
                        Balance               = 2541.7345M,
                        LastImportedOperation = "2012-0001"
                    }
                });

                AccountsManagerViewModel.CurrentAccount = AccountsManagerViewModel.Accounts.First();
            }
        }
Beispiel #3
0
        public ActionResult Index()
        {
            ICountiesRepository      countiesRepository      = new CountiesRepository(db);
            ICountriesRepository     countriesRepository     = new CountriesRepository(db);
            IPostalOfficesRepository postalOfficesRepository = new PostalOfficesRepository(db);
            IPlacesRepository        placesRepository        = new PlacesRepository(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"] : "PlacePK";
            string ordering   = sortColumn + " " + sortOrder;

            ordering = ordering.Trim();

            IQueryable <PlaceView> places = PlaceView.GetPlaceView(placesRepository.GetValid(), postalOfficesRepository.GetValid(), countiesRepository.GetValid(), countriesRepository.GetValid())
                                            .OrderBy(ordering);

            if (!String.IsNullOrWhiteSpace(Request.QueryString["searchString"]))
            {
                string searchString = Request.QueryString["searchString"].ToString();
                places = places.Where(c => c.Name.Contains(searchString));
            }

            places = places.Page(page, pageSize);

            if (!String.IsNullOrWhiteSpace(Request.QueryString["searchString"]))
            {
                string searchString = Request.QueryString["searchString"].ToString();
                ViewData["numberOfRecords"] = placesRepository.GetValid().Where(c => c.Name.Contains(searchString)).Count();
            }
            else
            {
                ViewData["numberOfRecords"] = placesRepository.GetValid().Count();
            }

            int numberOfPages = ((int)ViewData["numberOfRecords"] + pageSize - 1) / pageSize;

            if (page > numberOfPages)
            {
                string url = LinkHelper.getQueryStringArray(new string[] { "page" });
                return(Redirect("Place?" + url + "page=" + numberOfPages));
            }
            else
            {
                return(View("Index", places.ToList()));
            }
        }
Beispiel #4
0
        public ActionResult Delete(int?placePK)
        {
            IPlacesRepository placesRepository = new PlacesRepository(db);

            if (placePK != null)
            {
                Place place = placesRepository.GetPlaceByPK((int)placePK);

                place.Deleted = true;

                placesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", place.PlacePK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
Beispiel #5
0
        public void BindDDLs(LegalEntityBranchView legalEntityBranchView, ObjectContext db)
        {
            //countries ddl
            ICountriesRepository countriesRepository = new CountriesRepository(db);

            legalEntityBranchView.Countries = new SelectList(countriesRepository.GetValid().OrderBy("Name ASC").ToList(), "CountryPK", "Name");

            //counties ddl
            ICountiesRepository countiesRepository = new CountiesRepository(db);

            legalEntityBranchView.Counties = new SelectList(countiesRepository.GetCountiesByCountry((int)legalEntityBranchView.CountryFK).OrderBy("Name ASC").ToList(), "CountyPK", "Name");

            //citiesCommunities dll
            if (legalEntityBranchView.CountyFK != null)
            {
                ICitiesCommunitiesRepository citiesCommunitiesRepository = new CitiesCommunitiesRepository(db);
                legalEntityBranchView.CitiesCommunities = new SelectList(citiesCommunitiesRepository.GetCitiesCommunitiesByCounty(Convert.ToInt32(legalEntityBranchView.CountyFK)).OrderBy("Name ASC"), "CityCommunityPK", "Name", legalEntityBranchView.CityCommunityFK);
            }
            else
            {
                legalEntityBranchView.CitiesCommunities = new SelectList(new List <CityCommunity>(), "CityCommunityPK", "Name");
            }

            //postal offices dll
            if (legalEntityBranchView.CountyFK != null)
            {
                IPostalOfficesRepository postalOfficesRepository = new PostalOfficesRepository(db);
                legalEntityBranchView.PostalOffices = new SelectList(postalOfficesRepository.GetValidByCounty(Convert.ToInt32(legalEntityBranchView.CountyFK)).OrderBy("Name ASC"), "PostalOfficePK", "Name", legalEntityBranchView.PostalOfficeFK);
            }
            else
            {
                legalEntityBranchView.PostalOffices = new SelectList(new List <PostalOffice>(), "PostalOfficePK", "Name");
            }

            //places dll
            if (legalEntityBranchView.PostalOfficeFK != null)
            {
                IPlacesRepository placesRepository = new PlacesRepository(db);
                legalEntityBranchView.Places = new SelectList(placesRepository.GetPlacesByPostalOffice(Convert.ToInt32(legalEntityBranchView.PostalOfficeFK)).OrderBy("Name ASC"), "PlacePK", "Name", legalEntityBranchView.PlaceFK);
            }
            else
            {
                legalEntityBranchView.Places = new SelectList(new List <Place>(), "PlacePK", "Name");
            }
        }
Beispiel #6
0
        public ActionResult Edit(int?placePK)
        {
            if (placePK != null)
            {
                IPlacesRepository placesRepository = new PlacesRepository(db);

                Place place = placesRepository.GetPlaceByPK((int)placePK);

                PlaceView placeView = new PlaceView();
                placeView.ConvertFrom(place, placeView, db);
                placeView.BindDDLs(placeView, db);

                return(View(placeView));
            }
            else
            {
                return(RedirectToAction("Index", "Place"));
            }
        }
Beispiel #7
0
        public ActionResult Edit(PlaceView placeView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                IPlacesRepository placesRepository = new PlacesRepository(db);
                Place             place            = placesRepository.GetPlaceByPK((int)placeView.PlacePK);
                placeView.ConvertTo(placeView, place);

                placesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", place.PlacePK);

                return(RedirectToAction("Index", "Place"));
            }
            else
            {
                placeView.BindDDLs(placeView, db);

                return(View(placeView));
            }
        }
Beispiel #8
0
        public static List <PhysicalEntityAuditView> GetPhysicalEntityAuditView(ObjectContext context, int relatedEntityPK)
        {
            IAuditingDetailsRepository auditingDetailsRepository = new AuditingDetailsRepository(context);
            IAuditingMasterRepository  auditingMasterRepository  = new AuditingMasterRepository(context);

            List <PhysicalEntityAuditView> physicalEntityAuditViewList = new List <PhysicalEntityAuditView>();

            var sessionTokens = (from am in auditingMasterRepository.GetAll().Where(c => c.TableName == "PhysicalEntities")
                                 where am.RelatedEntityPK == relatedEntityPK
                                 select new {
                auditingMasterPK = am.AuditingMasterPK,
                sessionToken = am.SessionToken
            }).ToList();

            foreach (var item in sessionTokens)
            {
                List <AuditingDetail> record = auditingDetailsRepository.GetAuditingDetailByAuditingMasterPK(item.auditingMasterPK).ToList();

                PhysicalEntityAuditView peav = new PhysicalEntityAuditView();

                peav.Firstname = record.checkString("Firstname");
                peav.Lastname  = record.checkString("Lastname");

                peav.Gender = record.checkString("Gender");

                peav.OIB  = record.checkString("OIB");
                peav.JMBG = record.checkString("JMBG");

                peav.DateOfBirth = record.checkDate("DateOfBirth");

                peav.CitizenshipFK        = record.checkInteger("CitizenshipFK");
                peav.BirthCountryFK       = record.checkInteger("BirthCountryFK");
                peav.BirthCountyFK        = record.checkInteger("BirthCountyFK");
                peav.BirthCityCommunityFK = record.checkInteger("BirthCityCommunityFK");
                peav.BirthPlace           = record.checkString("BirthPlace");

                peav.ResidenceCountryFK       = record.checkInteger("ResidenceCountryFK");
                peav.ResidenceCountyFK        = record.checkInteger("ResidenceCountyFK");
                peav.ResidenceCityCommunityFK = record.checkInteger("ResidenceCityCommunityFK");
                peav.ResidencePostalOfficeFK  = record.checkInteger("ResidencePostalOfficeFK");
                peav.ResidencePlaceFK         = record.checkInteger("ResidencePlaceFK");
                peav.ResidencePlace           = record.checkString("ResidencePlace");
                peav.ResidenceStreetName      = record.checkString("ResidenceStreetName");

                peav.IdentityCardNumber           = record.checkString("IdentityCardNumber");
                peav.IdentityCardDateOfIssue      = record.checkDate("IdentityCardDateOfIssue");
                peav.IdentityCardRegionalOfficeFK = record.checkInteger("IdentityCardRegionalOfficeFK");
                peav.IdentityCardDateTillValid    = record.checkDate("IdentityCardDateTillValid");

                peav.PassportNumber           = record.checkString("PassportNumber");
                peav.PassportDateOfIssue      = record.checkDate("PassportDateOfIssue");
                peav.PassportDateTillValid    = record.checkDate("PassportDateTillValid");
                peav.PassportCountryOfIssueFK = record.checkInteger("PassportCountryOfIssueFK");
                peav.PassportPlaceOfIssue     = record.checkString("PassportPlaceOfIssue");

                peav.ReferentRegionalOfficeFK = record.checkInteger("ReferentRegionalOfficeFK");
                peav.ReferentSubstationFK     = record.checkInteger("ReferentSubstationFK");

                peav.ChangeDate = record.checkDate("ChangeDate");

                peav.LegalRepresentative = record.checkBoolean("LegalRepresentative");
                peav.Owner    = record.checkBoolean("Owner");
                peav.Referent = record.checkBoolean("Referent");

                physicalEntityAuditViewList.Add(peav);
            }

            // Connect all foreign keys and return data collection as List<PhysicalEntityAuditView>
            ICountriesRepository countriesRepository = new CountriesRepository(context);
            IQueryable <Country> countryTable        = countriesRepository.GetValid();

            ICountiesRepository countiesRepository = new CountiesRepository(context);
            IQueryable <County> countyTable        = countiesRepository.GetValid();

            ICitiesCommunitiesRepository citiesCommunitiesRepository = new CitiesCommunitiesRepository(context);
            IQueryable <CityCommunity>   cityCommunityTable          = citiesCommunitiesRepository.GetValid();

            IPostalOfficesRepository  postalOfficesRepository = new PostalOfficesRepository(context);
            IQueryable <PostalOffice> postalOfficeTable       = postalOfficesRepository.GetValid();

            IPlacesRepository  placesRepository = new PlacesRepository(context);
            IQueryable <Place> placeTable       = placesRepository.GetValid();

            IRegionalOfficesRepository  regionalOfficesRepository = new RegionalOfficesRepository(context);
            IQueryable <RegionalOffice> regionalOfficeTable       = regionalOfficesRepository.GetValid();

            ISubstationsRepository  substationsRepository = new SubstationsRepository(context);
            IQueryable <Substation> substationTable       = substationsRepository.GetValid();

            List <PhysicalEntityAuditView> physicalEntityAuditView =
                (from t in physicalEntityAuditViewList

                 from t1 in countryTable.Where(tbl => tbl.CountryPK == t.CitizenshipFK).DefaultIfEmpty()
                 from t2 in countryTable.Where(tbl => tbl.CountryPK == t.CitizenshipFK).DefaultIfEmpty()
                 from t3 in countyTable.Where(tbl => tbl.CountyPK == t.BirthCountyFK).DefaultIfEmpty()
                 from t4 in cityCommunityTable.Where(tbl => tbl.CityCommunityPK == t.BirthCityCommunityFK).DefaultIfEmpty()

                 from t5 in countryTable.Where(tbl => tbl.CountryPK == t.ResidenceCountryFK).DefaultIfEmpty()
                 from t6 in countyTable.Where(tbl => tbl.CountyPK == t.ResidenceCountyFK).DefaultIfEmpty()
                 from t7 in cityCommunityTable.Where(tbl => tbl.CityCommunityPK == t.ResidenceCityCommunityFK).DefaultIfEmpty()
                 from t8 in postalOfficeTable.Where(tbl => tbl.PostalOfficePK == t.ResidencePostalOfficeFK).DefaultIfEmpty()
                 from t9 in placeTable.Where(tbl => tbl.PlacePK == t.ResidencePlaceFK).DefaultIfEmpty()

                 from t10 in countryTable.Where(tbl => tbl.CountryPK == t.PassportCountryOfIssueFK).DefaultIfEmpty()
                 from t11 in regionalOfficeTable.Where(tbl => tbl.RegionalOfficePK == t.IdentityCardRegionalOfficeFK).DefaultIfEmpty()

                 from t12 in regionalOfficeTable.Where(tbl => tbl.RegionalOfficePK == t.ReferentRegionalOfficeFK).DefaultIfEmpty()
                 from t13 in substationTable.Where(tbl => tbl.SubstationPK == t.ReferentSubstationFK).DefaultIfEmpty()
                 select new PhysicalEntityAuditView
            {
                PhysicalEntityPK = t.PhysicalEntityPK,
                Firstname = t.Firstname != null ? t.Firstname : null,
                Lastname = t.Lastname != null ? t.Lastname : null,

                Gender = t.Gender != null ? t.Gender : null,
                OIB = t.OIB != null ? t.OIB : null,
                JMBG = t.JMBG != null ? t.JMBG : null,

                DateOfBirth = t.DateOfBirth != null ? t.DateOfBirth : null,

                CitizenshipFK = t.CitizenshipFK != null ? t.CitizenshipFK : null,
                BirthCountryFK = t.BirthCountryFK != null ? t.BirthCountryFK : null,
                BirthCountyFK = t.BirthCountyFK != null ? t.BirthCountyFK : null,
                BirthCityCommunityFK = t.BirthCityCommunityFK != null ? t.BirthCityCommunityFK : null,
                BirthPlace = t.BirthPlace != null ? t.BirthPlace : null,

                ResidenceCountryFK = t.ResidenceCountryFK != null ? t.ResidenceCountryFK : null,
                ResidenceCountyFK = t.ResidenceCountyFK != null ? t.ResidenceCountyFK : null,
                ResidenceCityCommunityFK = t.ResidenceCityCommunityFK != null ? t.ResidenceCityCommunityFK : null,
                ResidencePostalOfficeFK = t.ResidencePostalOfficeFK != null ? t.ResidencePostalOfficeFK : null,
                ResidencePlaceFK = t.ResidencePlaceFK != null ? t.ResidencePlaceFK : null,
                ResidencePlace = t.ResidencePlace != null ? t.ResidencePlace : null,
                ResidenceStreetName = t.ResidenceStreetName != null ? t.ResidenceStreetName : null,

                IdentityCardNumber = t.IdentityCardNumber != null ? t.IdentityCardNumber : null,
                IdentityCardDateOfIssue = t.IdentityCardDateOfIssue != null ? t.IdentityCardDateOfIssue : null,
                IdentityCardRegionalOfficeFK = t.IdentityCardRegionalOfficeFK != null ? t.IdentityCardRegionalOfficeFK : null,
                IdentityCardDateTillValid = t.IdentityCardDateTillValid != null ? t.IdentityCardDateTillValid : null,

                PassportNumber = t.PassportNumber != null ? t.PassportNumber : null,
                PassportDateOfIssue = t.PassportDateOfIssue != null ? t.PassportDateOfIssue : null,
                PassportDateTillValid = t.PassportDateTillValid != null ? t.PassportDateTillValid : null,
                PassportCountryOfIssueFK = t.PassportCountryOfIssueFK != null ? t.PassportCountryOfIssueFK : null,
                PassportPlaceOfIssue = t.PassportPlaceOfIssue != null ? t.PassportPlaceOfIssue : null,

                ReferentRegionalOfficeFK = t.ReferentRegionalOfficeFK != null ? t.ReferentRegionalOfficeFK : null,
                ReferentSubstationFK = t.ReferentSubstationFK != null ? t.ReferentSubstationFK : null,

                ChangeDate = t.ChangeDate != null ? t.ChangeDate : null,

                LegalRepresentative = t.LegalRepresentative != null ? t.LegalRepresentative : null,
                Owner = t.Owner != null ? t.Owner : null,
                Referent = t.Referent != null ? t.Referent : null,

                Deleted = t.Deleted != null ? t.Deleted : null,

                Citizenship = t1 != null && t1.Citizenship != null ? t1.Citizenship : null,
                BirthCountryName = t2 != null && t2.Name != null ? t2.Name : null,
                BirthCountyName = t3 != null && t3.Name != null ? t3.Name : null,
                BirthCityCommunityName = t4 != null && t4.Name != null ? t4.Name : null,

                ResidenceCountryName = t5 != null && t5.Name != null ? t5.Name : null,
                ResidenceCountyName = t6 != null && t6.Name != null ? t6.Name : null,
                ResidenceCityCommunityName = t7 != null && t7.Name != null ? t7.Name : null,
                ResidencePostalOfficeName = t8 != null && t8.Name != null ? t8.Name : null,
                ResidencePlaceName = t9 != null && t9.Name != null ? t9.Name : null,

                PassportCountryOfIssueName = t10 != null && t10.Name != null ? t10.Name : null,
                IdentityCardRegionalOfficeName = t11 != null && t11.Name != null ? t11.Name : null,

                ReferentRegionalOfficeName = t12 != null && t12.Name != null ? t12.Name : null,
                ReferentSubstationName = t13 != null && t13.Name != null ? t13.Name : null,
            }).OrderBy(c => c.ChangeDate).ToList();

            return(physicalEntityAuditView);
        }
 public PlacesService(IOptions <DatabaseSettings> databaseSettings, IMapper mapper) : base(mapper)
 {
     _placesRepository = new PlacesRepository(databaseSettings.Value.ConnectionString);
 }
Beispiel #10
0
        public void BindDDLs(PhysicalEntityView physicalEntityView, ObjectContext db)
        {
            //countries ddl
            ICountriesRepository countriesRepository = new CountriesRepository(db);

            physicalEntityView.Citizenships             = new SelectList(countriesRepository.GetCitizenships().ToList(), "CountryPK", "Citizenship");
            physicalEntityView.BirthCountries           = new SelectList(countriesRepository.GetValid().OrderBy("Name ASC").ToList(), "CountryPK", "Name");
            physicalEntityView.ResidenceCountries       = new SelectList(countriesRepository.GetValid().OrderBy("Name ASC").ToList(), "CountryPK", "Name");
            physicalEntityView.PassportCountriesOfIssue = new SelectList(countriesRepository.GetValid().OrderBy("Name ASC").ToList(), "CountryPK", "Name");

            //counties ddl
            if (physicalEntityView.BirthCountryFK != null)
            {
                ICountiesRepository countiesRepository = new CountiesRepository(db);
                physicalEntityView.BirthCounties = new SelectList(countiesRepository.GetCountiesByCountry(Convert.ToInt32(physicalEntityView.BirthCountryFK)), "CountyPK", "Name", physicalEntityView.BirthCountyFK);
            }
            else
            {
                physicalEntityView.BirthCounties = new SelectList(new List <County>(), "CountyPK", "Name");
            }

            if (physicalEntityView.ResidenceCountryFK != null)
            {
                ICountiesRepository countiesRepository = new CountiesRepository(db);
                physicalEntityView.ResidenceCounties = new SelectList(countiesRepository.GetCountiesByCountry(Convert.ToInt32(physicalEntityView.ResidenceCountryFK)), "CountyPK", "Name", physicalEntityView.ResidenceCountyFK);
            }
            else
            {
                physicalEntityView.ResidenceCounties = new SelectList(new List <County>(), "CountyPK", "Name");
            }

            //citiesCommunities ddl
            if (physicalEntityView.BirthCountyFK != null)
            {
                ICitiesCommunitiesRepository citiesCommunitiesRepository = new CitiesCommunitiesRepository(db);
                physicalEntityView.BirthCitiesCommunities = new SelectList(citiesCommunitiesRepository.GetCitiesCommunitiesByCounty(Convert.ToInt32(physicalEntityView.BirthCountyFK)), "CityCommunityPK", "Name", physicalEntityView.BirthCityCommunityFK);
            }
            else
            {
                physicalEntityView.BirthCitiesCommunities = new SelectList(new List <CityCommunity>(), "CityCommunityPK", "Name");
            }

            if (physicalEntityView.ResidenceCountyFK != null)
            {
                ICitiesCommunitiesRepository citiesCommunitiesRepository = new CitiesCommunitiesRepository(db);
                physicalEntityView.ResidenceCitiesCommunities = new SelectList(citiesCommunitiesRepository.GetCitiesCommunitiesByCounty(Convert.ToInt32(physicalEntityView.ResidenceCountyFK)), "CityCommunityPK", "Name", physicalEntityView.ResidenceCityCommunityFK);
            }
            else
            {
                physicalEntityView.ResidenceCitiesCommunities = new SelectList(new List <CityCommunity>(), "CityCommunityPK", "Name");
            }

            //postal offices
            if (physicalEntityView.ResidenceCountyFK != null)
            {
                IPostalOfficesRepository postalOfficesRepository = new PostalOfficesRepository(db);
                var postalOffices = postalOfficesRepository.GetValidByCounty(Convert.ToInt32(physicalEntityView.ResidenceCountyFK)).OrderBy(c => c.Name);

                physicalEntityView.ResidencePostalOffices = new SelectList(postalOffices.Select(c => new { value = c.PostalOfficePK, text = c.Name + " (" + SqlFunctions.StringConvert((double)c.Number).Trim() + ")" }), "value", "text", physicalEntityView.ResidencePostalOfficeFK);
            }
            else
            {
                physicalEntityView.ResidencePostalOffices = new SelectList(new List <PostalOffice>(), "PostalOfficePK", "Name");
            }

            //places
            if (physicalEntityView.ResidencePostalOfficeFK != null)
            {
                IPlacesRepository placesRepository = new PlacesRepository(db);
                physicalEntityView.ResidencePlaces = new SelectList(placesRepository.GetPlacesByPostalOffice(Convert.ToInt32(physicalEntityView.ResidencePostalOfficeFK)), "PlacePK", "Name", physicalEntityView.ResidencePlaceFK);
            }
            else
            {
                physicalEntityView.ResidencePlaces = new SelectList(new List <Place>(), "PlacePK", "Name");
            }

            //regional offices ddl
            IRegionalOfficesRepository regionalOfficesView = new RegionalOfficesRepository(db);

            physicalEntityView.IdentityCardRegionalOffices = new SelectList(regionalOfficesView.GetValid().ToList(), "RegionalOfficePK", "Name", physicalEntityView.IdentityCardRegionalOfficeFK);
            physicalEntityView.ReferentRegionalOffices     = new SelectList(regionalOfficesView.GetValid().ToList(), "RegionalOfficePK", "Name", physicalEntityView.ReferentRegionalOfficeFK);

            //substations
            if (physicalEntityView.ReferentRegionalOfficeFK != null)
            {
                ISubstationsRepository substationsRepository = new SubstationsRepository(db);
                physicalEntityView.ReferentSubstations = new SelectList(substationsRepository.GetValidByRegionalOffice(Convert.ToInt32(physicalEntityView.ReferentRegionalOfficeFK)), "SubstationPK", "Name", physicalEntityView.ReferentSubstationFK);
            }
            else
            {
                physicalEntityView.ReferentSubstations = new SelectList(new List <Place>(), "SubstationPK", "Name");
            }

            // genders dll
            physicalEntityView.Genders = new SelectList(GeneratorView.GenerateGenders(), "Value", "Text");
        }
Beispiel #11
0
        public PlacesController()
        {
            IKernel kernel = new StandardKernel(new CoreModule());

            this.Repository = kernel.Get <PlacesRepository>();
        }
Beispiel #12
0
        public static List <LegalEntityAuditView> GetLegalEntityAuditView(ObjectContext context, int relatedEntityPK)
        {
            IAuditingDetailsRepository auditingDetailsRepository = new AuditingDetailsRepository(context);
            IAuditingMasterRepository  auditingMasterRepository  = new AuditingMasterRepository(context);

            List <LegalEntityAuditView> legalEntityAuditViewList = new List <LegalEntityAuditView>();

            var sessionTokens = (from am in auditingMasterRepository.GetAll().Where(c => c.TableName == "LegalEntities")
                                 where am.RelatedEntityPK == relatedEntityPK
                                 select new {
                auditingMasterPK = am.AuditingMasterPK,
                sessionToken = am.SessionToken
            }).ToList();

            foreach (var item in sessionTokens)
            {
                var record = auditingDetailsRepository.GetAuditingDetailByAuditingMasterPK(item.auditingMasterPK).ToList();

                LegalEntityAuditView leav = new LegalEntityAuditView();

                leav.Name                = record.checkString("Name");
                leav.ShortName           = record.checkString("ShortName");
                leav.OIB                 = record.checkString("OIB");
                leav.MB                  = record.checkString("MB");
                leav.MBS                 = record.checkString("MBS");
                leav.ActivityFK          = record.checkInteger("ActivityFK");
                leav.ActivityDescription = record.checkString("ActivityDescription");
                leav.FormFK              = record.checkInteger("FormFK");
                leav.FundamentalCapital  = record.checkDecimal("FundamentalCapital");

                leav.CountryFK       = record.checkInteger("CountryFK");
                leav.CountyFK        = record.checkInteger("CountyFK");
                leav.PlaceFK         = record.checkInteger("PlaceFK");
                leav.PostalOfficeFK  = record.checkInteger("PostalOfficeFK");
                leav.Place           = record.checkString("Place");
                leav.CityCommunityFK = record.checkInteger("CityCommunityFK");
                leav.StreetName      = record.checkString("StreetName");

                leav.RegionalOfficeFK   = record.checkInteger("RegionalOfficeFK");
                leav.SubstationFK       = record.checkInteger("SubstationFK");
                leav.ReferentFK         = record.checkInteger("ReferentFK");
                leav.DateOfRegistration = record.checkDate("DateOfRegistration");
                leav.CommercialCourtFK  = record.checkInteger("CommercialCourtFK");
                leav.TaxFK = record.checkInteger("TaxFK");

                leav.Phone  = record.checkString("Phone");
                leav.Fax    = record.checkString("Fax");
                leav.Mobile = record.checkString("Mobile");
                leav.EMail  = record.checkString("EMail");

                leav.FirstContactDate           = record.checkDate("FirstContactDate");
                leav.TouristOffice              = record.checkBoolean("TouristOffice");
                leav.TouristOfficeDescription   = record.checkString("TouristOfficeDescription");
                leav.MonumentAnnuity            = record.checkBoolean("MonumentAnnuity");
                leav.MonumentAnnuityDescription = record.checkString("MonumentAnnuityDescription");
                leav.NumberOfEmployees          = record.checkInteger("NumberOfEmployees");
                leav.MIORRegistrationNumber     = record.checkString("MIORRegistrationNumber");
                leav.HZZOObligationNumber       = record.checkString("HZZOObligationNumber");
                leav.HZZOBussinesEntityCode     = record.checkString("HZZOBussinesEntityCode");

                leav.ChangeDate = record.checkDate("ChangeDate");

                leav.Owner       = record.checkBoolean("Owner");
                leav.LegalEntity = record.checkBoolean("LegalEntity");
                leav.Active      = record.checkBoolean("Active");

                legalEntityAuditViewList.Add(leav);
            }

            // Connect all foreign keys and return data collection as List<LegalEntityAuditView>
            IFormsRepository  formsRepository = new FormsRepository(context);
            IQueryable <Form> formsTable      = formsRepository.GetValid();

            IActivitiesRepository activitiesRepository = new ActivitiesRepository(context);
            IQueryable <Activity> activitiesTable      = activitiesRepository.GetValid();

            IRegionalOfficesRepository  regionalOfficesRepository = new RegionalOfficesRepository(context);
            IQueryable <RegionalOffice> regionalOfficesTable      = regionalOfficesRepository.GetValid();

            ISubstationsRepository  substationsRepository = new SubstationsRepository(context);
            IQueryable <Substation> substationsTable      = substationsRepository.GetValid();

            ICommercialCourtsRepository  commercialCourtsRepository = new CommercialCourtsRepository(context);
            IQueryable <CommercialCourt> commercialCourtsTable      = commercialCourtsRepository.GetValid();

            ITaxesRepository taxesRepository = new TaxesRepository(context);
            IQueryable <Tax> taxesTable      = taxesRepository.GetValid();

            ICountriesRepository countriesRepository = new CountriesRepository(context);
            IQueryable <Country> countriesTable      = countriesRepository.GetValid();

            ICountiesRepository countiesRepository = new CountiesRepository(context);
            IQueryable <County> countiesTable      = countiesRepository.GetValid();

            ICitiesCommunitiesRepository citiesCommunitiesRepository = new CitiesCommunitiesRepository(context);
            IQueryable <CityCommunity>   cityCommunityTable          = citiesCommunitiesRepository.GetValid();

            IPostalOfficesRepository  postalOfficesRepository = new PostalOfficesRepository(context);
            IQueryable <PostalOffice> postalOfficeTable       = postalOfficesRepository.GetValid();

            IPlacesRepository  placesRepository = new PlacesRepository(context);
            IQueryable <Place> placesTable      = placesRepository.GetValid();

            IPhysicalEntitiesRepository physicalEntitiesRepository = new PhysicalEntitiesRepository(context);
            IQueryable <PhysicalEntity> physicalEntitiesTable      = physicalEntitiesRepository.GetValid();

            List <LegalEntityAuditView> legalEntityAuditView =
                (from t in legalEntityAuditViewList
                 from t1 in formsTable.Where(tbl => tbl.FormPK == t.FormFK).DefaultIfEmpty()
                 from t2 in activitiesTable.Where(tbl => tbl.ActivityPK == t.ActivityFK).DefaultIfEmpty()
                 from t3 in regionalOfficesTable.Where(tbl => tbl.RegionalOfficePK == t.RegionalOfficeFK).DefaultIfEmpty()
                 from t4 in substationsTable.Where(tbl => tbl.SubstationPK == t.SubstationFK).DefaultIfEmpty()
                 from t5 in commercialCourtsTable.Where(tbl => tbl.CommercialCourtPK == t.CommercialCourtFK).DefaultIfEmpty()
                 from t6 in taxesTable.Where(tbl => tbl.TaxPK == t.TaxFK).DefaultIfEmpty()
                 from t7 in countriesTable.Where(tbl => tbl.CountryPK == t.CountryFK).DefaultIfEmpty()
                 from t8 in countiesTable.Where(tbl => tbl.CountyPK == t.CountyFK).DefaultIfEmpty()
                 from t9 in cityCommunityTable.Where(tbl => tbl.CityCommunityPK == t.CityCommunityFK).DefaultIfEmpty()
                 from t10 in postalOfficeTable.Where(tbl => tbl.PostalOfficePK == t.PostalOfficeFK).DefaultIfEmpty()
                 from t11 in placesTable.Where(tbl => tbl.PlacePK == t.PlaceFK).DefaultIfEmpty()
                 from t12 in physicalEntitiesTable.Where(tbl => tbl.PhysicalEntityPK == t.ReferentFK).DefaultIfEmpty()

                 select new LegalEntityAuditView
            {
                LegalEntityPK = t.LegalEntityPK,
                Name = t.Name != null ? t.Name : null,
                ShortName = t.ShortName != null ? t.ShortName : null,
                OIB = t.OIB != null ? t.OIB : null,
                MB = t.MB != null ? t.MB : null,
                MBS = t.MBS != null ? t.MBS : null,
                ActivityFK = t.ActivityFK != null ? t.ActivityFK : null,
                ActivityDescription = t.ActivityDescription != null ? t.ActivityDescription : null,
                FormFK = t.FormFK != null ? t.FormFK : null,
                FundamentalCapital = t.FundamentalCapital != null ? t.FundamentalCapital : null,

                CountryFK = t.CountryFK != null ? t.CountryFK : null,
                CountyFK = t.CountyFK != null ? t.CountyFK : null,
                CityCommunityFK = t.CityCommunityFK != null ? t.CityCommunityFK : null,
                PostalOfficeFK = t.PostalOfficeFK != null ? t.PostalOfficeFK : null,
                PlaceFK = t.PlaceFK != null ? t.PlaceFK : null,
                Place = t.Place != null ? t.Place : null,
                StreetName = t.StreetName != null ? t.StreetName : null,

                RegionalOfficeFK = t.RegionalOfficeFK != null ? t.RegionalOfficeFK : null,
                SubstationFK = t.SubstationFK != null ? t.SubstationFK : null,
                ReferentFK = t.ReferentFK != null ? t.ReferentFK : null,
                DateOfRegistration = t.DateOfRegistration != null ? t.DateOfRegistration : null,
                CommercialCourtFK = t.CommercialCourtFK != null ? t.CommercialCourtFK : null,
                TaxFK = t.TaxFK != null ? t.TaxFK : null,

                Phone = t.Phone != null ? t.Phone : null,
                Fax = t.Fax != null ? t.Fax : null,
                Mobile = t.Mobile != null ? t.Mobile : null,
                EMail = t.EMail != null ? t.EMail : null,
                FirstContactDate = t.FirstContactDate != null ? t.FirstContactDate : null,
                TouristOffice = t.TouristOffice != null ? t.TouristOffice : null,
                TouristOfficeDescription = t.TouristOfficeDescription != null ? t.TouristOfficeDescription : null,
                MonumentAnnuity = t.MonumentAnnuity != null ? t.MonumentAnnuity : null,
                MonumentAnnuityDescription = t.MonumentAnnuityDescription != null ? t.MonumentAnnuityDescription : null,
                NumberOfEmployees = t.NumberOfEmployees != null ? t.NumberOfEmployees : null,
                MIORRegistrationNumber = t.MIORRegistrationNumber != null ? t.MIORRegistrationNumber : null,
                HZZOObligationNumber = t.HZZOObligationNumber != null ? t.HZZOObligationNumber : null,
                HZZOBussinesEntityCode = t.HZZOBussinesEntityCode != null ? t.HZZOBussinesEntityCode : null,
                ChangeDate = t.ChangeDate != null ? t.ChangeDate : null,

                Owner = t.Owner != null ? t.Owner : null,
                LegalEntity = t.LegalEntity != null ? t.LegalEntity : null,
                Active = t.Active != null ? t.Active : null,
                Deleted = t.Deleted != null ? t.Deleted : null,

                FormName = t1 != null && t1.Name != null ? t1.Name : null,
                ActivityName = t2 != null && t2.Name != null ? t2.Name : null,
                RegionalOfficeName = t3 != null && t3.Name != null ? t3.Name : null,
                SubstationName = t4 != null && t4.Name != null ? t4.Name : null,
                ReferentName = t12 != null && t12.Firstname != null && t12.Lastname != null ? t12.Firstname + " " + t12.Lastname : null,
                CommercialCourtName = t5 != null && t5.Name != null ? t5.Name : null,
                TaxName = t6 != null && t6.Name != null ? t6.Name : null,
                CountryName = t7 != null && t7.Name != null ? t7.Name : null,
                CountyName = t8 != null && t8.Name != null ? t8.Name : null,
                CityCommunityName = t9 != null && t9.Name != null ? t9.Name : null,
                PostalOfficeName = t10 != null && t10.Name != null ? t10.Name : null,
                PlaceName = t11 != null && t11.Name != null ? t11.Name : null,
            }).OrderBy(c => c.ChangeDate).ToList();

            return(legalEntityAuditView);
        }