public ActionResult InvestorsListingDetailsPartial(int?page, string SortingBy = null, InvestorListingWrapper model = null)
        {
            var    serialization = new Serialization();
            var    investorListingsBA = new InvestorListings();
            var    HashCriteria = new Hashtable();
            string actualCriteria = string.Empty;
            string minPrincipalBalance = String.Empty, maxPrincipalBalance = String.Empty, minInterestRate = String.Empty, maxInterestRate = String.Empty;
            double minAskingPrice = 0.0, maxAskingPrice = 0.0;
            var    investorListingWrapper = new InvestorListingWrapper();

            string[] principle_tokens, asking_tokens, interest_tokens;
            if (SortingBy != null)
            {
                model.SortingOrder = SortingBy;
            }
            //Split the data for Principal Balanace, Asking value and Interest rate
            var 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";
            }

            var 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;
            }

            var 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";
            }

            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));
            }
            int pageSize  = 3;
            int pageIndex = 1;

            pageIndex = page.HasValue ? Convert.ToInt32(page) : 1;
            investorListingWrapper.PagedListInvestorListings = tempInvestorListings.ToPagedList(pageIndex, pageSize);
            return(PartialView("_InvestorListings", investorListingWrapper.PagedListInvestorListings));
        }
        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));
        }
Exemplo n.º 3
0
        public ActionResult Admin(int?page, string Tab = null, string sortingOrder = "RecentlyPosted", string searchText = "")
        {
            searchText = searchText.Replace("'", "''");
            Serialization    serialization            = new Serialization();
            DashboardWrapper dashboardWrapper         = new DashboardWrapper();
            Hashtable        HashCriteria             = new Hashtable();
            Hashtable        UsersHashCriteria        = new Hashtable();
            Hashtable        ResourcesHashCriteria    = new Hashtable();
            Hashtable        TestimonialsHashCriteria = new Hashtable();

            string actualCriteria;

            actualCriteria = serialization.SerializeBinary((object)HashCriteria);

            int pageSize  = 8;
            int pageIndex = 1;

            pageIndex = page.HasValue ? Convert.ToInt32(page) : 1;

            if (Tab == "Users")
            {
                UserRegistration userRecords = new UserRegistration();
                UsersHashCriteria.Add("Name", searchText);
                UsersHashCriteria.Add("SortingOrder", sortingOrder);
                actualCriteria = serialization.SerializeBinary((object)UsersHashCriteria);
                var users = userRecords.GetUserSpecificDetails(actualCriteria);
                dashboardWrapper.Users          = (List <UserProfileEditModel>)(serialization.DeSerializeBinary(Convert.ToString(users)));
                dashboardWrapper.PagedListUsers = dashboardWrapper.Users.ToPagedList(pageIndex, pageSize);

                return(PartialView("_AdminUsersTab", dashboardWrapper.PagedListUsers));
            }
            else if (Tab == "Resources")
            {
                Learn learnBA = new Learn();
                ResourcesHashCriteria.Add("SortingOrder", sortingOrder);
                ResourcesHashCriteria.Add("SearchText", searchText);
                ResourcesHashCriteria.Add("IsAdminDashboard", "1");
                actualCriteria = serialization.SerializeBinary((object)ResourcesHashCriteria);
                var resourcesList = learnBA.GetLearnListingDetails(actualCriteria);
                dashboardWrapper.Resources         = (List <LearnModel>)(serialization.DeSerializeBinary(Convert.ToString(resourcesList)));
                dashboardWrapper.PagedListResource = dashboardWrapper.Resources.ToPagedList(pageIndex, pageSize);
                return(PartialView("_AdminResourcesTab", dashboardWrapper.PagedListResource));
            }
            else if (Tab == "Testimonials")
            {
                Testimonial testimonialBA = new Testimonial();
                TestimonialsHashCriteria.Add("SortingOrder", sortingOrder);
                TestimonialsHashCriteria.Add("SearchText", searchText);
                actualCriteria = serialization.SerializeBinary((object)TestimonialsHashCriteria);
                dashboardWrapper.Testimonials         = testimonialBA.GetAllTestimonial(actualCriteria);
                dashboardWrapper.PagedListTestimonial = dashboardWrapper.Testimonials.ToPagedList(pageIndex, pageSize);
                return(PartialView("_AdminTestimonialsTab", dashboardWrapper.PagedListTestimonial));
            }
            else
            {
                InvestorListings       investorListings       = new InvestorListings();
                InvestorListingWrapper investorListingWrapper = new InvestorListingWrapper();
                investorListingWrapper.SortingOrder   = sortingOrder;
                investorListingWrapper.ListingTypeIds = string.Empty;
                HashCriteria.Add("ID", investorListingWrapper.ListingTypeIds);
                HashCriteria.Add("LocationName", investorListingWrapper.LocationName);
                HashCriteria.Add("SortingOrder", investorListingWrapper.SortingOrder);
                HashCriteria.Add("Name", searchText);
                HashCriteria.Add("LoanID", investorListingWrapper.LoanID);
                HashCriteria.Add("LienPositionID", investorListingWrapper.LienPositionID);
                HashCriteria.Add("LoanStatusID", investorListingWrapper.LoanStatusID);
                HashCriteria.Add("State", investorListingWrapper.State);
                HashCriteria.Add("LoanTypeID", investorListingWrapper.LoanTypeID);
                HashCriteria.Add("Address", investorListingWrapper.Address);
                HashCriteria.Add("PropertyTypeID", investorListingWrapper.PropertyTypeID);
                HashCriteria.Add("MinPrincipalBalance", 0);
                HashCriteria.Add("MaxPrincipalBalance", 0);
                HashCriteria.Add("City", investorListingWrapper.City);
                HashCriteria.Add("MinInterestRate", 0);
                HashCriteria.Add("MaxInterestRate", 0);
                HashCriteria.Add("MinAskingPrice", 0);
                HashCriteria.Add("MaxAskingPrice", 0);
                HashCriteria.Add("UserID", userID);
                actualCriteria = serialization.SerializeBinary((object)HashCriteria);
                var listing = investorListings.GetDealDetails(actualCriteria);
                dashboardWrapper.InvestorAdminListing   = (List <InvestorListingsModel>)(serialization.DeSerializeBinary(Convert.ToString(listing)));
                dashboardWrapper.PagedListAdminListings = dashboardWrapper.InvestorAdminListing.ToPagedList(pageIndex, pageSize);

                //Users default load
                actualCriteria = string.Empty;
                UserRegistration userRecords = new UserRegistration();
                UsersHashCriteria.Add("SortingOrder", sortingOrder);
                actualCriteria         = serialization.SerializeBinary((object)UsersHashCriteria);
                dashboardWrapper.Users = new List <UserProfileEditModel>();
                var users = userRecords.GetUserSpecificDetails(actualCriteria);
                dashboardWrapper.Users          = (List <UserProfileEditModel>)(serialization.DeSerializeBinary(Convert.ToString(users)));
                dashboardWrapper.PagedListUsers = dashboardWrapper.Users.ToPagedList(pageIndex, pageSize);

                //Resources default load
                actualCriteria = string.Empty;
                Learn learnBA = new Learn();
                //For Learn
                LearnModel learn = new LearnModel();

                ResourcesHashCriteria.Add("SortingOrder", sortingOrder);
                ResourcesHashCriteria.Add("IsAdminDashboard", "1");
                actualCriteria = serialization.SerializeBinary((object)ResourcesHashCriteria);
                var resourcesList = learnBA.GetLearnListingDetails(actualCriteria);
                dashboardWrapper.Resources         = (List <LearnModel>)(serialization.DeSerializeBinary(Convert.ToString(resourcesList)));
                dashboardWrapper.PagedListResource = dashboardWrapper.Resources.ToPagedList(pageIndex, pageSize);

                Testimonial testimonialBA = new Testimonial();
                TestimonialsHashCriteria.Add("SortingOrder", sortingOrder);
                TestimonialsHashCriteria.Add("SearchText", searchText);
                actualCriteria = serialization.SerializeBinary((object)TestimonialsHashCriteria);
                dashboardWrapper.Testimonials         = testimonialBA.GetAllTestimonial(actualCriteria);
                dashboardWrapper.PagedListTestimonial = dashboardWrapper.Testimonials.ToPagedList(pageIndex, pageSize);

                if (Tab != null)
                {
                    return(PartialView("_AdminListingsTab", dashboardWrapper.PagedListAdminListings));
                }
                return(View("AdminDashboard", dashboardWrapper));
            }
        }