public ActionResult EditBuildingUnitModal(int BuildingUnitId) { var getBuildingUnitInput = new GetBuildingUnitsInput() { Id = BuildingUnitId }; //get building unit upon givin id var getBuildingUnit = _buildingUnitsAppService.GetBuildingUnitsById(getBuildingUnitInput); var buildingUnitContentIds = getBuildingUnit.UnitContentsIds; //get list of all unit contents var buildingUnitContents = _buildingUnitContentsAppService.getAllBuildingUnitContents().ToList(); //get list of the contents in the unit and assign values to new list foreach (var t in buildingUnitContentIds) { BuildingUnitContentsOutput.Add(buildingUnitContents.FirstOrDefault(x => x.Id == t)); } //var BuildingUnitContentsOutputArray = new string[buildingUnitContentIds.Length]; //foreach (var BuildingUnitContent in BuildingUnitContentsOutput) //{ //} var buildingUnitViewModel = new BuildingUnitViewModel() { BuildingUnitOutput = getBuildingUnit, BuildingUnitContents = buildingUnitContents, BuildingUnitContentsInUnit = BuildingUnitContentsOutput }; return(View("_EditUserModal", buildingUnitViewModel)); }
public GetBuildingUnitsOutput GetBuildingUnitsById(GetBuildingUnitsInput input) { var BuildingUnit = _buildingUnitsManager.getBuildingUnitById(input.Id); var output = Mapper.Map <Models.BuildingUnits, GetBuildingUnitsOutput>(BuildingUnit); return(output); }
public ActionResult EditApplication(int appId) { var yesOrNo = new List <string> { "True", "False" }; var getApplicationInput = new GetApplicationsInput() { Id = appId }; // get application according to givin application Id var application = _applicationsAppService.GetApplicationById(getApplicationInput); // get the list of buildings var buildings = _buildingsAppService.getAllBuildings(); // get the list of building units var buildingUnits = _buildingUnitsAppService.getAllBuildingUnits(); var buildingUnitsByBuildingId = from BU in buildingUnits where BU.BuildingId == application.buildingId select BU; // get building information by buildingId in application var getBuildingInput = new GetBuidlingsInput() { Id = application.buildingId }; // get the building information by BuildingId var building = _buildingsAppService.getBuildingsById(getBuildingInput); // get the information of spicific building unit var getBuildingUnitInput = new GetBuildingUnitsInput() { Id = application.buildingUnitId }; var buildingUnit = _buildingUnitsAppService.GetBuildingUnitsById(getBuildingUnitInput); // get list of propertyOwnerships var propertyOwnerships = _propertyOwnershipAppService.getAllPropertyOwnerships(); // get list of interventionTypes var interventionTypes = _interventionTypeAppService.getAllInterventionTypes(); // get list of restorationTypes var restorationType = _restorationTypeAppService.getAllResorationTypes(); var ApplicationViewModel = new ApplicationsViewModel() { applicationsOutput = application, Buildings = buildings, BuildingUnits = buildingUnitsByBuildingId, buildingOutput = building, YesOrNo = new SelectList(yesOrNo), PropertyOwnerShips = propertyOwnerships, BuildingUnit = buildingUnit, InterventionTypes = interventionTypes, RestorationTypes = restorationType }; return(View("_EditApplicationsModal", ApplicationViewModel)); }
public ActionResult PopulateBuildingUnit(int BuildingUnitId) { var getBuildingUnitInput = new GetBuildingUnitsInput() { Id = BuildingUnitId }; var buildingUnit = _buildingUnitsAppService.GetBuildingUnitsById(getBuildingUnitInput); var applicationBuildingUnitViewModel = new ApplicationsViewModel() { BuildingUnit = buildingUnit }; return(Json(applicationBuildingUnitViewModel, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateApplication(UpdateApplicationsInput model) { var updateApplication = new UpdateApplicationsInput(); updateApplication.buildingId = Convert.ToInt32(Request["buildingnumber"]); updateApplication.buildingUnitId = Convert.ToInt32(Request["dropDownBuildingUnitApp"]); //==== get building and unit related to application for update ====== var buildingInput = new GetBuidlingsInput() { Id = updateApplication.buildingId }; var buildingUnitInput = new GetBuildingUnitsInput() { Id = updateApplication.buildingUnitId }; var buildingApp = _buildingsAppService.getBuildingsById(buildingInput); var buildingUnitApp = _buildingUnitsAppService.GetBuildingUnitsById(buildingUnitInput); buildingApp.streetName = Request["buildingaddress"]; buildingApp.isInHoush = Convert.ToBoolean(Request["IsInHoush"]); buildingApp.houshName = Request["HoushName"]; // buildingUnitApp.BuildingId = updateApplication.buildingId; buildingUnitApp.ResidenceStatus = Request["residentstatus"]; // copy object getBuildingUnitInput to updateBuildingUnitInput var updateBuildingUnitInput = new UpdateBuildingUnitsInput() { BuildingId = buildingUnitApp.BuildingId, ResidentName = buildingUnitApp.ResidentName, ResidenceStatus = buildingUnitApp.ResidenceStatus, NumberOfFamilyMembers = buildingUnitApp.NumberOfFamilyMembers, Floor = buildingUnitApp.Floor, UnitContentsIds = buildingUnitApp.UnitContentsIds }; //============================================ // copy object from getBuildingOutput to updateBuildingInput var updateBuildingInput = new UpdateBuidlingsInput() { Id = 1, //buildingApp.Id, buildingID = 1, //buildingApp.buildingID, numOfBuildingUnits = buildingApp.numOfBuildingUnits, numOfFloors = buildingApp.numOfFloors, streetName = buildingApp.streetName, buildingNo = buildingApp.buildingNo, neighborhoodID = buildingApp.neighborhoodID, buildingTypeID = buildingApp.buildingTypeID, GISMAP = buildingApp.GISMAP, houshProperty = buildingApp.houshProperty, houshName = buildingApp.houshName, X = buildingApp.X, Y = buildingApp.Y, buildingName = buildingApp.buildingName, isInHoush = buildingApp.isInHoush, buildingUsesID = buildingApp.buildingUsesID }; //====================================================== updateApplication.Id = Convert.ToInt32(Request["applicationId"]); updateApplication.fullName = model.fullName; updateApplication.phoneNumber1 = model.phoneNumber1; updateApplication.phoneNumber2 = model.phoneNumber2; updateApplication.isThereFundingOrPreviousRestoration = model.isThereFundingOrPreviousRestoration; updateApplication.isThereInterestedRepairingEntity = model.isThereInterestedRepairingEntity; updateApplication.housingSince = model.housingSince; updateApplication.previousRestorationSource = model.previousRestorationSource; updateApplication.interestedRepairingEntityName = model.interestedRepairingEntityName; updateApplication.PropertyOwnerShipId = Convert.ToInt32(Request["PropertyOwnerShip"]); updateApplication.otherOwnershipType = model.otherOwnershipType; updateApplication.interventionTypeId = Convert.ToInt32(Request["interventionTypeName"]); updateApplication.otherRestorationType = model.otherRestorationType; updateApplication.propertyStatusDescription = model.propertyStatusDescription; updateApplication.requiredRestoration = model.requiredRestoration; updateApplication.buildingId = Convert.ToInt32(Request["buildingnumber"]); updateApplication.buildingUnitId = Convert.ToInt32(Request["dropDownBuildingUnitApp"]); // ==== get of restoration types which it is multi select drop down list ====== var restorationTypes = Request["example-getting-started"]; string[] restorationTypesSplited = restorationTypes.Split(','); byte[] restorationTypesArray = new byte[restorationTypesSplited.Length]; for (var i = 0; i < restorationTypesArray.Length; i++) { restorationTypesArray[i] = Convert.ToByte(restorationTypesSplited[i]); } updateApplication.restorationTypeIds = restorationTypesArray; // ====== end of RestorationTypes _buildingsAppService.update(updateBuildingInput); _applicationsAppService.Update(updateApplication); // _buildingUnitsAppService.Update(updateBuildingUnitInput); // ==== get list of applications ============== var applicationsUpdate = _applicationsAppService.getAllApplications(); var applicationsViewModel = new ApplicationsViewModel() { Applications = applicationsUpdate }; return(View("Applications", applicationsViewModel)); }