Esempio n. 1
0
        public ActionResult DropDownList(int buildingId)
        {
            var buildingUnitsApp = _buildingUnitsAppService.getAllBuildingUnits();
            var buildingUnits    = (from BU in buildingUnitsApp where BU.BuildingId == buildingId select BU);

            var DropDownListViewModel = new ApplicationsViewModel()
            {
                BuildingUnits = buildingUnits
            };

            return(PartialView("_DropDownListView", DropDownListViewModel));
        }
        // GET: BuildingUnit
        public ActionResult BuildingUnit()
        {   //get list of building units
            var getAllBuildingUnits = _buildingUnitsAppService.getAllBuildingUnits();
            // get list of building unit contents
            var getAllBuldingUnitContnet = _buildingUnitContentsAppService.getAllBuildingUnitContents();
            var buildingUntisViewModel   = new BuildingUnitViewModel()
            {
                BuildingUnits        = getAllBuildingUnits,
                BuildingUnitContents = getAllBuldingUnitContnet
            };

            return(View("BuildingUnit", buildingUntisViewModel));
        }
Esempio n. 3
0
        public ActionResult PopulateApplicationForm(int buildingId)
        {
            //instantiate object GetBuidlingsInput to get the building entity with given id
            var getBuildingInput = new GetBuidlingsInput()
            {
                Id = buildingId
            };
            // retrieve the building with givin id
            var building      = _buildingsAppService.getBuildingsById(getBuildingInput);
            var buildingUnits = _buildingUnitsAppService.getAllBuildingUnits().ToList();
            var BuildingUnits = from BU in buildingUnits where BU.BuildingId == buildingId select BU;
            // declare viewmodel object to pass data to view
            var applicationViewModel = new ApplicationsViewModel()
            {
                buildingOutput = building
            };

            return(Json(applicationViewModel, JsonRequestBehavior.AllowGet));
            //  return View("ApplicationForm", applicationViewModel);
        }
Esempio n. 4
0
        //  [ValidateAntiForgeryToken]
        // [DisableAbpAntiForgeryTokenValidation]
        public ActionResult Index()
        {
            var getBuildingOutput = new List <GetBuildingsOutput>();

            getBuildingOutput = _buildingsAppService.getAllBuildings().ToList();


            // if neighborhood or buildingtype is deleted
            // initiate the object with default values .
            foreach (var Building  in getBuildingOutput)
            {
                if (Building.BuildingType == null)
                {
                    Building.BuildingType = new TaawonMVC.Models.BuildingType();
                }
                if (Building.NeighboorHood == null)
                {
                    Building.NeighboorHood = new TaawonMVC.Models.Neighborhood();
                }
            }
            //get the list of buildingTypes
            var buildingTypes = _buildingTypeAppService.getAllBuildingtype().ToList();
            // get the list of neighborhoods
            var neighborhoods = _neighborhoodAppService.GetAllNeighborhood().ToList();
            // get the list of BuildingUses
            var buildingUses = _buildingUsesAppService.getAllBuildingUses().ToList();
            // get list of building units
            var buildingUnitsOutput = _buildingUnitsAppService.getAllBuildingUnits().ToList();

            //var BuildingTypeInput = new GetBuidlingTypeInput
            //{
            //    Id = id
            //};
            //var buildingType = _buildingTypeAppService.getBuildingTypeById(BuildingTypeInput);

            //populate yes-no list
            var yesOrNo = new List <string>
            {
                "True",
                "False"
            };

            //Read HoushName From Database
            //----------------------------
            var HoushNames = new List <string>();

            foreach (var HoushName in getBuildingOutput)
            {
                if (!String.IsNullOrWhiteSpace(HoushName.houshName))
                {
                    HoushNames.Add(HoushName.houshName);
                }
            }
            var HoushNameArray = HoushNames.ToArray();
            //foreach(var str in HoushNameArray)
            //{
            //    str.Trim();
            //    str.ToUpper();
            //}
            //var houshNameArrayClean = new string[HoushNameArray.Length];
            //for(int i=0;i< HoushNameArray.Length;i++)
            //{
            //    HoushNameArray[i].Trim();
            //    HoushNameArray[i].ToUpper();
            //    houshNameArrayClean[i] = HoushNameArray[i];
            //}
            // var HoushNameArrayWithoutDuplicate = new HashSet<string>(HoushNameArray);
            var HoushNameArrayWithoutDuplicate = HoushNameArray.Distinct().ToArray();

            //----------------------------
            //-----------------------------

            var BuildingsViewModel = new BuildingViewModel
            {
                Buildings            = getBuildingOutput,
                BuildingTypes        = buildingTypes,
                Neighborhoods        = neighborhoods,
                Building             = new GetBuildingsOutput(),
                YesOrNo              = new SelectList(yesOrNo),
                HoushNameArray       = HoushNameArrayWithoutDuplicate,
                BuildingUses         = buildingUses,
                BuildingUnitsOutputs = buildingUnitsOutput
            };

            return(View("Index", BuildingsViewModel));
        }