コード例 #1
0
ファイル: OwnerController.cs プロジェクト: mgorijala/BGBCMgmt
        public ActionResult TenantViewPayments(int id)
        {
            //List<BGBC.Web.Models.TenantViewPayment> tenantViewPayment = new List<Models.TenantViewPayment>();
            List <vRentPayment> rentpay = new List <vRentPayment>();

            try
            {
                User tuser = _userRepository.Get(id);

                Profile profile = tuser.Profiles.FirstOrDefault();
                ViewBag.Name    = tuser.FirstName + " " + tuser.LastName;
                ViewBag.Address = profile.BillingAddress;
                ViewBag.State   = profile.BillingState;
                ViewBag.City    = profile.BillingCty;
                ViewBag.Zip     = profile.BillingZip;

                rentpay = BGBCFunctions.RentPayments().Where(x => x.TenantUserID == id).ToList();
                return(View(rentpay));
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }
            return(View(new List <vRentPayment>()));
        }
コード例 #2
0
ファイル: OwnerController.cs プロジェクト: mgorijala/BGBCMgmt
        public ActionResult ViewPayments(int id)
        {
            List <BGBC.Web.Models.AllPropertiesAndTenant> allPropertiesAndTenant = new List <Models.AllPropertiesAndTenant>();

            try
            {
                Property p = _propertyRepo.Get(id);
                BGBC.Web.Models.AllPropertiesAndTenant propertiesTenant = new Models.AllPropertiesAndTenant();
                ViewBag.PropertyID = p.PropertyID;
                ViewBag.Name       = p.Name;
                ViewBag.Address    = p.Address;
                ViewBag.Address2   = p.Address2;
                ViewBag.City       = p.City;
                ViewBag.State      = p.State;
                ViewBag.Zip        = p.Zip;

                propertiesTenant.tenantRentPay = new List <Models.TenantRentPay>();
                foreach (var t in p.Tenants)
                {
                    BGBC.Web.Models.TenantRentPay tenantRentPay = new BGBC.Web.Models.TenantRentPay();
                    tenantRentPay.tname       = t.User.FirstName;
                    tenantRentPay.RentPayment = BGBCFunctions.RentPayments().Where(x => x.TenantUserID == t.User.UserID).ToList();
                    propertiesTenant.tenantRentPay.Add(tenantRentPay);
                }
                allPropertiesAndTenant.Add(propertiesTenant);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }
            return(View(allPropertiesAndTenant));
        }
コード例 #3
0
        public ActionResult ViewPropertyPayment(int id)
        {
            List <vRentPayment> rentpay = new List <vRentPayment>();

            try
            {
                // User user = _userRepository.Get(((BGBC.Core.CustomPrincipal)(User)).UserId);
                Property property = _propertyRepo.Get(id);
                ViewBag.PropertyID = property.PropertyID;
                ViewBag.Name       = property.Name;
                rentpay            = BGBCFunctions.RentPayments().Where(x => x.PropertyID == id).OrderByDescending(o => o.TransDate).ToList();
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }
            return(View(rentpay));
        }
コード例 #4
0
        public ActionResult ViewTenantsPayment(int id)
        {
            List <vRentPayment> rentpay = new List <vRentPayment>();

            try
            {
                User tuser = _userRepository.Get(id);

                Profile profile = tuser.Profiles.FirstOrDefault();
                ViewBag.Name = tuser.FirstName + " " + tuser.LastName;
                rentpay      = BGBCFunctions.RentPayments().Where(x => x.TenantUserID == id).ToList();
                return(View(rentpay));
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }
            return(View(new List <vRentPayment>()));
        }
コード例 #5
0
        public ActionResult TenantPaymentHistory(int?id)
        {
            IEnumerable <vRentPayment> paymentdetails = new List <vRentPayment>();

            try
            {
                paymentdetails = BGBCFunctions.RentPayments()
                                 .Where(x => x.TenantUserID == (id == null ? ((BGBC.Core.CustomPrincipal)(User)).UserId : id))
                                 .OrderByDescending(d => d.TransDate).ToList();

                Tenant tenants = _tenantRepo.Get().Where(x => x.UserID == (id == null ? ((BGBC.Core.CustomPrincipal)(User)).UserId : id)).FirstOrDefault();

                ViewBag.Propertyname = (tenants != null ? tenants.Property.Name : "");
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }
            return(View(paymentdetails));
        }
コード例 #6
0
        public ActionResult PropertyPaymentsHistory(int id)
        {
            List <vRentPayment> rentpay = new List <vRentPayment>();

            try
            {
                User     user     = _userRepository.Get(((BGBC.Core.CustomPrincipal)(User)).UserId);
                Property property = _propertyRepo.Get((int)user.Properties.FirstOrDefault().PropertyID);
                ViewBag.Address  = property.Address;
                ViewBag.Address2 = property.Address2;
                ViewBag.City     = property.City;
                ViewBag.State    = property.State;
                ViewBag.Zip      = property.Zip;
                rentpay          = BGBCFunctions.RentPayments().Where(x => x.PropertyID == id).ToList();
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }
            return(View(rentpay));
        }
コード例 #7
0
        public ActionResult AllPropertiesAndTenant()
        {
            List <BGBC.Web.Models.AllPropertiesAndTenant> allPropertiesAndTenant = new List <Models.AllPropertiesAndTenant>();
            List <Property> property = _pro.GetRef(((BGBC.Core.CustomPrincipal)(User)).UserId);

            foreach (var p in property)
            {
                BGBC.Web.Models.AllPropertiesAndTenant allProps = new Models.AllPropertiesAndTenant();
                allProps.Pname         = p.Name;
                allProps.tenantRentPay = new List <Models.TenantRentPay>();
                foreach (var t in p.Tenants)
                {
                    BGBC.Web.Models.TenantRentPay tRentPay = new BGBC.Web.Models.TenantRentPay();
                    tRentPay.tname       = t.User.FirstName + " " + t.User.LastName;
                    tRentPay.RentPayment = BGBCFunctions.RentPayments().Where(x => x.TenantUserID == t.User.UserID).OrderByDescending(d => d.TransDate).Take(5).ToList();
                    allProps.tenantRentPay.Add(tRentPay);
                }
                allPropertiesAndTenant.Add(allProps);
            }

            return(View(allPropertiesAndTenant));
        }
コード例 #8
0
        public ActionResult PaymentHistory(string sortOrder, string currentFilter, string searchString, int?page, string pageSize, string searchOwner)
        {
            int currentPageSize = int.Parse(pageSize == null ? "10" : pageSize), pageNumber = (page ?? 1);

            try
            {
                var rentPayments = BGBCFunctions.RentPayments();
                ViewBag.currentSort      = sortOrder;
                ViewBag.dateSortParam    = sortOrder == "date" ? "date_desc" : "date";
                ViewBag.idSortParam      = sortOrder == "id" ? "id_desc" : "id";
                ViewBag.nameSortParam    = sortOrder == "name" ? "name_desc" : "name";
                ViewBag.ownerSortParam   = sortOrder == "owner" ? "owner_desc" : "owner";
                ViewBag.descSortParam    = sortOrder == "desc" ? "desc_desc" : "desc";
                ViewBag.amountSortParam  = sortOrder == "amount" ? "amount_desc" : "amount";
                ViewBag.commentSortParam = sortOrder == "comment" ? "comment_desc" : "comment";

                if (pageSize != null)
                {
                    ViewBag.currentPageSize = currentPageSize;
                }


                if (searchString != null)
                {
                    page = 1;
                }
                else
                {
                    searchString = currentFilter;
                }

                ViewBag.currentFilter = searchString;
                ViewBag.page          = pageNumber;
                if (!string.IsNullOrEmpty(searchString))
                {
                    rentPayments = rentPayments.Where(x => x.TenantLastName.Contains(searchString) || x.TenantFirstName.Contains(searchString) ||
                                                      x.OwnerFirstName.Contains(searchString) || x.OwnerLastName.Contains(searchString) ||
                                                      x.TransID.Contains(searchString));
                    //  ||  x.Amount.Equals(searchString)||  x.TransDate.Equals(searchString));
                }
                if (!string.IsNullOrEmpty(searchOwner))
                {
                    rentPayments = rentPayments.Where(x => x.OwnerFirstName.Contains(searchOwner));
                    ViewBag.currentFilterForDropdown = searchOwner;
                }
                switch (sortOrder)
                {
                case "date_desc":
                    rentPayments = rentPayments.OrderByDescending(x => x.TransDate);
                    break;

                case "id":
                    rentPayments = rentPayments.OrderBy(x => x.ID);
                    break;

                case "id_desc":
                    rentPayments = rentPayments.OrderByDescending(x => x.ID);
                    break;

                case "name":
                    rentPayments = rentPayments.OrderBy(x => x.TenantFirstName);
                    break;

                case "name_desc":
                    rentPayments = rentPayments.OrderByDescending(x => x.TenantFirstName);
                    break;

                case "owner":
                    rentPayments = rentPayments.OrderBy(x => x.OwnerFirstName);
                    break;

                case "owner_desc":
                    rentPayments = rentPayments.OrderByDescending(x => x.OwnerFirstName);
                    break;

                case "desc":
                    rentPayments = rentPayments.OrderBy(x => x.Description);
                    break;

                case "desc_desc":
                    rentPayments = rentPayments.OrderByDescending(x => x.Description);
                    break;

                case "amount":
                    rentPayments = rentPayments.OrderBy(x => x.Amount);
                    break;

                case "amount_desc":
                    rentPayments = rentPayments.OrderByDescending(x => x.Amount);
                    break;

                case "comment":
                    rentPayments = rentPayments.OrderBy(x => x.Comments);
                    break;

                case "comment_desc":
                    rentPayments = rentPayments.OrderByDescending(x => x.Comments);
                    break;

                default:
                    rentPayments = rentPayments.OrderBy(x => x.TransDate);
                    break;
                }
                PropagateOwnerDropdown(ViewBag.currentFilterForDropdown);
                return(View(rentPayments.ToPagedList(pageNumber, currentPageSize)));
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }
            return(View(new List <vRentPayment>()));
        }