public void GetEntryInfo(ShowEntryEditableRequestModel request)
        {
            var response = new ShowEntryEditableResponseModel();

            var selectedCase = _caseCRUD.ReadCase(request.CaseID);

            response.caseID       = selectedCase.CaseID;
            response.realtorID    = _caseCRUD.ReturnRealtorIDOnCase(request.CaseID);
            response.creationDate = selectedCase.CreationDate;
            response.closedDate   = selectedCase.ClosedDate;
            response.price        = selectedCase.Price;


            var selectedProperty = _propertyCRUD.ReadPropertyFromCaseID(request.CaseID);

            response.estimatedPrice = selectedProperty.EstimatedPrice;
            response.postalCode     = selectedProperty.PostalCode;
            response.addressLine1   = selectedProperty.AddressLine1;

            var selectedAddress = _addressCRUD.ReadAddress(selectedProperty.PostalCode, selectedProperty.AddressLine1);

            response.addressLine2  = selectedAddress.AddressLine2;
            response.ownershipCost = selectedAddress.OwnershipCost;
            response.exteriorArea  = selectedAddress.ExteriorArea;
            response.interiorArea  = selectedAddress.InteriorArea;
            response.buildYear     = selectedAddress.BuildYear;


            _updateEntryOutput.ReturnEntryInformation(response);
        }
Example #2
0
        public void GetEntries()
        {
            List <ShowEntriesResponseModel> responseList        = new List <ShowEntriesResponseModel>();
            List <Entities.Property>        workingPropertyList = _propertyCRUD.GetAllProperties();

            foreach (var property in workingPropertyList)
            {
                ShowEntriesResponseModel showEntriesResponseModel = new ShowEntriesResponseModel();
                showEntriesResponseModel.EstimatedPrice = property.EstimatedPrice;

                Entities.Case workingCase = _caseCRUD.ReadCase(property.CaseID);

                if (workingCase.Realtor != null)
                {
                    showEntriesResponseModel.RealtorID = workingCase.Realtor.RealtorID;
                }

                if (workingCase.ClosedDate != null)
                {
                    showEntriesResponseModel.ClosedDate = workingCase.ClosedDate;
                }

                showEntriesResponseModel.Price = workingCase.Price;


                Entities.Address workingAddress = _addressCRUD.ReadAddress(property.PostalCode, property.AddressLine1);

                showEntriesResponseModel.PostalCode    = workingAddress.PostalCode;
                showEntriesResponseModel.AddressLine1  = workingAddress.AddressLine1;
                showEntriesResponseModel.AddressLine2  = workingAddress.AddressLine2;
                showEntriesResponseModel.OwnershipCost = workingAddress.OwnershipCost;
                showEntriesResponseModel.ExteriorArea  = workingAddress.ExteriorArea;
                showEntriesResponseModel.InteriorArea  = workingAddress.InteriorArea;
                showEntriesResponseModel.BuildYear     = workingAddress.BuildYear;
                responseList.Add(showEntriesResponseModel);

                _showEntryOutput.DisplayListOfEntries(responseList);
            }
        }
        public PrintObject GetDataForPrint(int caseId)
        {
            PrintObject printObject = new PrintObject();
            CalculateAverageWithIntegerInput calc = new CalculateAverageWithIntegerInput(_caseCRUD);

            Entities.Case workingCase = _caseCRUD.ReadCase(caseId);

            Entities.Realtor workingRealtor = _realtorCRUD.ReadRealtor(_caseCRUD.ReturnRealtorIDOnCase(caseId));

            Entities.Property workingProperty = _propertyCRUD.ReadPropertyFromCaseID(caseId);

            Entities.Address workingAddress = _addressCRUD.ReadAddress(workingProperty.PostalCode, workingProperty.AddressLine1);

            printObject.RealtorName  = workingRealtor.Name;
            printObject.RealtorPhone = workingRealtor.PhoneNR;

            printObject.CaseID       = workingCase.CaseID;
            printObject.CreationDate = workingCase.CreationDate;
            if (workingCase.ClosedDate != null)
            {
                printObject.ClosedDate = (DateTime)workingCase.ClosedDate;
            }
            printObject.Price = workingCase.Price;

            printObject.PostalCode     = workingProperty.PostalCode;
            printObject.AddressLine1   = workingProperty.AddressLine1;
            printObject.EstimatedPrice = workingProperty.EstimatedPrice;


            printObject.AddressLine2 = workingAddress.AddressLine2;
            printObject.ExteriorArea = workingAddress.ExteriorArea;
            printObject.InteriorArea = workingAddress.InteriorArea;
            printObject.BuildYear    = workingAddress.BuildYear;

            printObject.AverageAreaPrice = calc.Calculate(workingProperty.PostalCode);

            return(printObject);
        }