public GetBuildingsOutput getBuildingsById(GetBuidlingsInput input) { var getBuildingById = _buildings_Manager.getBuildingsById(input.Id); var output = Mapper.Map <Models.Buildings, GetBuildingsOutput>(getBuildingById); 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 async Task <GetBuildingsOutput> getBuildingsByIdAsync(GetBuidlingsInput input) { var getBuildingByIdAsync = await _buildings_Manager.getBuildingsByIdAsync(input.Id); var output = Mapper.Map <Models.Buildings, GetBuildingsOutput>(getBuildingByIdAsync); return(output); }
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); // declare viewmodel object to pass data to view var applicationViewModel = new ApplicationsViewModel() { buildingOutput = building }; return(Json(applicationViewModel, JsonRequestBehavior.AllowGet)); // return View("ApplicationForm", applicationViewModel); }
public ActionResult EditBuildingModal(int userId) { //get the list of buildingTypes var buildingTypes = _buildingTypeAppService.getAllBuildingtype().ToList(); // get the list of neighborhoods var neighborhoods = _neighborhoodAppService.GetAllNeighborhood().ToList(); var getBuidlingsInput = new GetBuidlingsInput { Id = userId }; var getBuildingOutput = _buildingsAppService.getBuildingsById(getBuidlingsInput); var BuildingViewModel = new BuildingViewModel { Building = getBuildingOutput, BuildingTypes = buildingTypes, Neighborhoods = neighborhoods }; return(View("_EditUserModal", BuildingViewModel)); }
//[AllowAnonymous] // [Route("Building/EditBuildingModal")] // [ValidateAntiForgeryToken] // [AjaxValidateAntiForgeryToken] // [ValidateAntiForgeryTokenOnAllPosts] public ActionResult UploadFiles(HttpPostedFileBase[] files, int BuildingId)// not used 08082018 { var UploadedFile = new CreateUploadFilesInput(); //Ensure model state is valid if (ModelState.IsValid) { //iterating through multiple file collection foreach (/*HttpPostedFileBase*/ var file in files) { //Checking file is available to save. if (file != null) { //-----*** commited for not saving files to server ***----- //var InputFileName = Path.GetFileName(file.FileName); //var ServerSavePath = Path.Combine(Server.MapPath("~/UploadedFiles/") + InputFileName); ////Save file to server folder //file.SaveAs(ServerSavePath); ////assigning file uploaded status to ViewBag for showing message to user. /// /// /// ViewBag.UploadStatus = files.Count().ToString() + " files uploaded successfully."; // // // convert file data (inputStream) to array byte[] in order // to store it in database using (var binaryReader = new BinaryReader(file.InputStream)) { UploadedFile.FileData = binaryReader.ReadBytes(file.ContentLength); } //dont forget to add insertAndGetIdAsync to check if the row is inserted, // if yes return success message // add the other properties of the createUploadFilesInput object like sourcetable.. _uploadFilesAppService.Create(UploadedFile); } } } //populate the view add data to the model ////get the list of buildingTypes var buildingTypes = _buildingTypeAppService.getAllBuildingtype().ToList(); //// get the list of neighborhoods var neighborhoods = _neighborhoodAppService.GetAllNeighborhood().ToList(); var getBuidlingsInput = new GetBuidlingsInput { Id = BuildingId }; var getBuildingOutput = _buildingsAppService.getBuildingsById(getBuidlingsInput); var BuildingViewModel = new BuildingViewModel { Building = getBuildingOutput, BuildingTypes = buildingTypes, Neighborhoods = neighborhoods }; //=================================== // return PartialView("_EditUserModal", BuildingViewModel); // return null; // return RedirectToAction("EditBuildingModal",new { userId = BuildingId }); // return Json(new { Result = true }, JsonRequestBehavior.AllowGet); return(null); }
//=====================================end search bar server side public ActionResult EditBuildingModal(int userId) { //get the list of buildingTypes var buildingTypes = _buildingTypeAppService.getAllBuildingtype().ToList(); // get the list of neighborhoods var neighborhoods = _neighborhoodAppService.GetAllNeighborhood().ToList(); // get the list of building unit contents var buildingUnitContents = _buildingUnitContentsAppService.getAllBuildingUnitContents(); // get list of buildings var getAllBuildingOutput = _buildingsAppService.getAllBuildings(); // get the list of BuildingUses var buildingUses = _buildingUsesAppService.getAllBuildingUses().ToList(); var getBuidlingsInput = new GetBuidlingsInput { Id = userId }; var getBuildingOutput = _buildingsAppService.getBuildingsById(getBuidlingsInput); //Read HoushName From Database //---------------------------- var HoushNames = new List <string>(); foreach (var HoushName in getAllBuildingOutput) { 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(); //---------------------------- //----------------------------- //populate yes or no select var yesOrNo = new List <string> { "True", "False" }; var BuildingViewModel = new BuildingViewModel { Building = getBuildingOutput, BuildingTypes = buildingTypes, Neighborhoods = neighborhoods, BuildingUnitContents = buildingUnitContents, BuildingUnits = new GetBuildingUnitsOutput(), HoushNameArray = HoushNameArrayWithoutDuplicate, YesOrNo = new SelectList(yesOrNo), BuildingUses = buildingUses }; return(View("_EditUserModal", BuildingViewModel)); }
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)); }