Beispiel #1
0
        private HomeViewModel GetPropertySummary(HomeViewModel homeViewModel, int PropID, string PropName)
        {
            //Sends to summary of the property
            homeViewModel.viewName = "PropertySummary";


            // Models.GlobalVariables.SelectedProperty = StaticVariables.PropList[0].Address1;
            Session["SelectedPropertyID"] = PropID;
            Session["SelectedProperty"]   = PropName;
            // Session["IsDirector"] = EstateDirectors.EstateDirectorMethods.IsCustomerDirector(GlobalVariables.CS, StaticVariables.PropList[0].ID).ToString();
            Models.MyAccountViewModel vm = GetViewModel();

            Estates es = new Estates();

            try
            {
                es = EstateMethods.GetEstatedByUnitID((int)Session["SelectedPropertyID"]);
            }
            catch { }

            Session["EstateName"] = es.EstateName;

            //Gets outstanding repairs
            vm.RepairVM        = new RepairsMaintenanceViewModel();
            vm.RepairVM.Repair = RepairMethods.GetOutstandingRepairs(es.EstatedID);
            // try
            // {

            vm = GetAccountDetails(vm, (int)Session["SelectedPropertyID"]);
            // } catch { }
            vm.PageTitle          = "Property Level Contact Preferences";
            homeViewModel.anonObj = vm;
            return(homeViewModel);
        }
 public ActionResult OutstandingRepairs(int PropID = 0)
 {
     if (Session["CustomerID"] != null && (int)Session["CustomerID"] != 0)
     {
         RepairsMaintenanceViewModel vm = new RepairsMaintenanceViewModel();
         if (Session["SelectedPropertyID"] != null)
         {
             if (PropID != 0 && Session["SelectedPropertyID"] != null)
             {
                 Session["SelectedPropertyID"] = PropID;
                 Session["SelectedProperty"]   = Models.PropertyMethods.PropertyAddress(PropID);
                 Session["IsDirector"]         = EstateDirectors.EstateDirectorMethods.IsCustomerDirector(GlobalVariables.GetConnection(), PropID).ToString();
                 //Models.GlobalVariables.SelectedProperty = Models.PropertyMethods.PropertyAddress(PropID);
                 Estates e = EstateMethods.GetEstatedByUnitID((int)Session["SelectedPropertyID"]);
                 Session["EstateName"] = e.EstateName;
                 e = null;
             }
             if ((int)Session["SelectedPropertyID"] == 0)
             {
                 vm.PropListViewModel = new ServiceChargeBudgetViewModel();
                 vm.PropListViewModel.PropertyList   = Models.PropertyMethods.GetAllOwnedProperties((int)Session["CustomerID"]);
                 vm.PropListViewModel.ControllerName = "RepairsMaintenance";
                 vm.PropListViewModel.ViewName       = "OutstandingRepairs";
             }
             else
             {
                 Estates Estate = new Estates();
                 Estate                = EstateMethods.GetEstatedByUnitID((int)Session["SelectedPropertyID"]);
                 vm.Repair             = RepairMethods.GetOutstandingRepairs(Estate.EstatedID);
                 Session["EstateName"] = Estate.EstateName;
             }
         }
         else
         {
             Estates Estate = new Estates();
             Estate                = EstateMethods.GetEstatedByUnitID((int)Session["SelectedPropertyID"]);
             vm.Repair             = RepairMethods.GetOutstandingRepairs(Estate.EstatedID);
             Session["EstateName"] = Estate.EstateName;
         }
         return(View("OutstandingRepairs", vm));
     }
     else
     {
         //return not logged in view
         return(View("../Home/NotLoggedIn"));
     }
 }
        public ActionResult RepairDetail(int repairID, string updateConfirmation = "")
        {
            if (Session["CustomerID"] != null)
            {
                RepairID = repairID;

                vm        = new RepairsMaintenanceViewModel();
                vm.Repair = new Repairs();

                vm.Repair = RepairMethods.GetAllRepairDetails(repairID);
                vm.Repair.RepairHistory = new List <Repairs>();

                //gets call reports
                vm.CallReports = RepairMethods.GetRepairReport(repairID);

                //gets service charge budget and expediture
                vm.ServiceChargeInfo = EstateMethods.GetExpenditurebyPO(vm.Repair.PONumber);

                //Gets contractor name
                vm.ContractorInfo = ContractorMethods.ContractorDetailsByPO(vm.Repair.PONumber);

                //Gets completion cost
                if (vm.Repair.Status == "Completed")
                {
                    vm.Repair.completionCost    = RepairMethods.CompletedCost(vm.Repair.PONumber);
                    vm.Repair.completionCostStr = Controls.CurrencyString(vm.Repair.completionCost);
                }

                //Repair Updates
                vm.Repair.AutomaticUpdates     = Models.RepairUpdateMethods.IsCustomerRegisteredForUpdates(repairID, (int)Session["CustomerID"]);
                vm.AutomaticUpdateConfirmation = updateConfirmation;
                //gets repair history
                vm.Repair.RepairHistory = RepairMethods.GetRepairHistory(repairID);
                vm.Repair.ID            = repairID;
                return(View(vm));
            }
            else
            {
                //return not logged in view
                return(View("../Home/NotLoggedIn"));
            }
        }
Beispiel #4
0
        public ActionResult PropertySummary(Models.PropertyTypes PropType = PropertyTypes.None, int PropID = 0, string PropName = "")
        {
            if (Session["UserType"].ToString() == "1")
            {
                if (StaticVariables.PropList != null)
                {
                    foreach (Models.Properties p in StaticVariables.PropList)
                    {
                        //sets details to display on toolbar
                        if (p.ID == PropID)
                        {
                            Session["SelectedProperty"]   = p.Address1;
                            Session["SelectedPropertyID"] = p.ID;
                            // Session["IsDirector"] = EstateDirectors.EstateDirectorMethods.IsCustomerDirector(GlobalVariables.CS, p.ID);
                            break;
                        }
                    }
                }
                else
                {
                    return(View("NotLoggedIn"));
                }

                //get View Model with summary notes
                Models.MyAccountViewModel vm = GetViewModel();
                vm.PageTitle = "Property Level Contact Preferences";
                vm           = GetAccountDetails(vm, (int)Session["SelectedPropertyID"]);

                //get details for outstanding repairs table
                Estates Estate = new Estates();
                Estate = EstateMethods.GetEstatedByUnitID((int)Session["SelectedPropertyID"]);
                Session["EstateName"] = Estate.EstateName;
                vm.RepairVM           = new RepairsMaintenanceViewModel();
                vm.RepairVM.Repair    = RepairMethods.GetOutstandingRepairs(Estate.EstatedID);
                return(View(vm));
            }
            else if (Session["UserType"].ToString() == "2")
            {
                if (PropType == PropertyTypes.Estate)
                {
                    StaticVariables.PropList = Models.PropertyMethods.GetAllUnitsProperties(PropID);

                    //Sends to list of properties (viewname = index)
                    //viewName = "Index";
                    Session["SelectedPropertyID"] = 0;
                    Session["SelectedProperty"]   = null;
                    Session["IsDirector"]         = null;
                    //Models.GlobalVariables.SelectedPropertyID = 0;
                    //Models.GlobalVariables.SelectedProperty = null;
                    object anonObj = null;
                    anonObj = StaticVariables.PropList;

                    return(View("Index", anonObj));
                }
                else if (PropType == PropertyTypes.Unit)
                {
                    //getowners
                    StaticVariables.PropList = Models.PropertyMethods.GetAllUnitsowners(PropID);

                    //Sends to list of properties (viewname = index)
                    //viewName = "Index";
                    Session["SelectedPropertyID"] = PropID;
                    Session["SelectedProperty"]   = Models.PropertyMethods.GetPropertyName(PropID);
                    Session["IsDirector"]         = null;
                    //Models.GlobalVariables.SelectedPropertyID = 0;
                    //Models.GlobalVariables.SelectedProperty = null;
                    object anonObj = null;
                    anonObj = StaticVariables.PropList;

                    return(View("Index", anonObj));
                }
                else if (PropType == PropertyTypes.Owner)
                {
                    //Session["IsDirector"] = EstateDirectors.EstateDirectorMethods.IsCustomerDirector(GlobalVariables.CS, PropID);
                    //Session["CustomerID"] = PropID;

                    //get View Model with summary notes
                    Models.MyAccountViewModel vm = GetViewModel();
                    vm.PageTitle = "Property Level Contact Preferences";
                    vm           = GetAccountDetails(vm, (int)Session["SelectedPropertyID"]);

                    //get details for outstanding repairs table
                    Estates Estate = new Estates();
                    Estate = EstateMethods.GetEstatedByUnitID((int)Session["SelectedPropertyID"]);
                    Session["EstateName"] = Estate.EstateName;
                    vm.RepairVM           = new RepairsMaintenanceViewModel();
                    vm.RepairVM.Repair    = RepairMethods.GetOutstandingRepairs(Estate.EstatedID);
                    return(View(vm));
                }
            }

            return(View("NotLoggedIn"));
        }