예제 #1
0
        public List <ListingType> GetListingLoanType()
        {
            var listingsBA  = new Listings();
            var lstLoanType = listingsBA.GetListingLoanTypes();

            return(lstLoanType);
        }
        public ActionResult InvestorsListingDetails(int?page, InvestorListingWrapper model = null)
        {
            var    listingsBA = new Listings();
            var    serialization = new Serialization();
            var    investorListingsBA = new InvestorListings();
            var    HashCriteria = new Hashtable();
            var    actualCriteria = string.Empty;
            var    investorListingWrapper = new InvestorListingWrapper();
            string minPrincipalBalance = string.Empty, maxPrincipalBalance = string.Empty, minInterestRate = string.Empty, maxInterestRate = string.Empty;
            double minAskingPrice = 0.0, maxAskingPrice = 0.0;

            string[] principle_tokens, asking_tokens, interest_tokens;
            if (page != null)
            {
                model.LoanID          = Convert.ToInt32(Session["LoanID"]);
                model.LienPositionID  = Convert.ToInt32(Session["LienPositionID"]);
                model.LoanStatusID    = Convert.ToInt32(Session["LoanStatusID"]);
                model.State           = Convert.ToString(Session["State"]);
                model.LoanTypeID      = Convert.ToInt32(Session["LoanTypeID"]);
                model.Address         = Convert.ToString(Session["Address"]);
                model.PropertyTypeID  = Convert.ToInt32(Session["PropertyTypeID"]);
                model.PricipalBalance = Convert.ToString(Session["PricipalBalance"]);
                model.City            = Convert.ToString(Session["City"]);
                model.AskingPrice     = Convert.ToString(Session["AskingPrice"]);
                model.InterestRate    = Convert.ToString(Session["InterestRate"]);
            }
            else
            {
                RemoveTempDataForInvestor();
            }

            model.SortingOrder = "RecentlyPosted";
            var pageSize  = 3;
            var pageIndex = 1;

            pageIndex = page.HasValue ? Convert.ToInt32(page) : 1;
            //Split the data for Principal Balanace, Asking value and Interest rate
            string principleBalance = Convert.ToString(model.PricipalBalance);

            if (principleBalance != "0" && principleBalance != null)
            {
                principle_tokens    = principleBalance.Split('-');
                minPrincipalBalance = principle_tokens[0];
                maxPrincipalBalance = principle_tokens[1];
            }
            else
            {
                minPrincipalBalance = "0";
                maxPrincipalBalance = "0";
            }

            string askingPrice = Convert.ToString(model.AskingPrice);

            if (askingPrice != "0" && askingPrice != null)
            {
                asking_tokens  = askingPrice.Split('-');
                minAskingPrice = Convert.ToDouble(asking_tokens[0]);
                maxAskingPrice = Convert.ToDouble(asking_tokens[1]);
            }
            else
            {
                minAskingPrice = 0.0;
                maxAskingPrice = 0.0;
            }

            string interestRate = Convert.ToString(model.InterestRate);

            if (interestRate != "0" && interestRate != null)
            {
                interest_tokens = interestRate.Split('-');
                minInterestRate = interest_tokens[0];
                maxInterestRate = interest_tokens[1];
            }
            else
            {
                minInterestRate = "0";
                maxInterestRate = "0";
            }

            var res = investorListingsBA.GetAllFeaturedList();

            investorListingWrapper.FeaturedListings          = (List <InvestorListingsModel>)(serialization.DeSerializeBinary(Convert.ToString(res)));
            investorListingWrapper.PagedListFeaturedListings = investorListingWrapper.FeaturedListings.ToPagedList(1, 4);

            HashCriteria.Add("LoanID", model.LoanID);
            HashCriteria.Add("LienPositionID", model.LienPositionID);
            HashCriteria.Add("LoanStatusID", model.ActualLoanStatusID);
            HashCriteria.Add("State", model.State);
            HashCriteria.Add("LoanTypeID", model.ListingTypeID);
            HashCriteria.Add("Address", model.Address);
            HashCriteria.Add("PropertyTypeID", model.PropertyTypeID);
            HashCriteria.Add("MinPrincipalBalance", minPrincipalBalance);
            HashCriteria.Add("MaxPrincipalBalance", maxPrincipalBalance);
            HashCriteria.Add("City", model.City);
            HashCriteria.Add("MinInterestRate", minInterestRate);
            HashCriteria.Add("MaxInterestRate", maxInterestRate);
            HashCriteria.Add("MinAskingPrice", minAskingPrice);
            HashCriteria.Add("MaxAskingPrice", maxAskingPrice);
            HashCriteria.Add("SortingOrder", model.SortingOrder);
            HashCriteria.Add("UserID", userID);
            actualCriteria = serialization.SerializeBinary((object)HashCriteria);
            var result = investorListingsBA.GetDealDetails(actualCriteria);

            investorListingWrapper.InvestorListings = (List <InvestorListingsModel>)(serialization.DeSerializeBinary(Convert.ToString(result)));
            var tempInvestorListings = new List <InvestorListingsModel>();

            foreach (var item in investorListingWrapper.InvestorListings)
            {
                tempInvestorListings.Add(item);
                item.ImagePath = CheckFileExists(item.ImagePath, "ListingImagePath", Convert.ToString(item.ID));
            }
            investorListingWrapper.PagedListInvestorListings = tempInvestorListings.ToPagedList(pageIndex, pageSize);
            foreach (var item in investorListingWrapper.PagedListFeaturedListings)
            {
                item.ImagePath = CheckFileExists(item.ImagePath, "ListingImagePath", Convert.ToString(item.ID));
            }
            investorListingWrapper.ListingTypeList = investorListingsBA.GetListingTypes();
            var resultListingLoanInfo = listingsBA.GetListingDefaultValuesForLoanInformation();
            var listingModel          = (LoanInformation)(serialization.DeSerializeBinary(Convert.ToString(resultListingLoanInfo)));

            investorListingWrapper.LienPosition = listingModel.LienPositionType;
            investorListingWrapper.ListingType  = listingsBA.GetListingLoanTypes();
            var resultListing   = listingsBA.GetListingDefaultValuesForPropertyInformation();
            var listingModelnew = (PropertyInformation)(serialization.DeSerializeBinary(Convert.ToString(resultListing)));

            investorListingWrapper.PropertyType = listingModelnew.PropertyType;
            return(View("InvestorsListingDetails", investorListingWrapper));
        }