public ActionResult Edit(int id, ResidentViewModel residentViewModel) { try { IEnumerable <User> userList = _userBusiness.GetAllUsers(); List <UserViewModel> userViewModelList = UserMapper.ToUserViewModelList(userList); IEnumerable <Unit> unitList = _unitBusiness.GetAllUnits(); List <UnitViewModel> unitViewModelList = UnitMapper.ToUnitViewModelList(unitList); residentViewModel.Users = new SelectList(userViewModelList, "UserID", "Email"); residentViewModel.Units = new SelectList(unitViewModelList, "UnitID", "Name"); if (ModelState.IsValid) { Resident resident = ResidentMapper.ToResident(residentViewModel); Result <bool> result = _residentBusiness.UpdateResident(resident); if (result.isSuccess) { return(RedirectToAction(nameof(Index))); } else { ModelState.AddModelError(string.Empty, result.errorMessage); return(View(residentViewModel)); } } else { return(View(residentViewModel)); } } catch { return(RedirectToAction("AppError", "Error")); } }
private void UpdateResidentUI(Dictionary <string, object> dict) { ResidentSSNTextBox.Text = ToNonNull <int>(dict["SSN"]).ToString("000000000"); ResidentPhoneNumTextBox.Text = ToNonNull <string>(dict["PhoneN"]); ResidentNameTextBox.Text = ToNonNull <string>(dict["Name"]); ResidentOutstandingBalanceNUD.Value = ToNonNull <int>(dict["OutstandingBalance"]); ResidentChoresMissedNUD.Value = ToNonNull <int>(dict["MissedChores"]); ResidentSmallGroupTextBox.Text = ToNonNull <string>(dict["SmallGroup"]); ResidentNextSemesterTextBox.Text = ToNonNull <string>(dict["NextSemesterPlan"]); ResidentGraduationDatetimePicker.Value = ToNonNull <DateTime>(dict["GradDate"]); ResidentContractStartDatetimePicker.Value = ToNonNull <DateTime>(dict["ContractStartDate"]); ResidentContractEndDatetimePicker.Value = ToNonNull <DateTime>(dict["ContractEndDate"]); ResidentMealPlanTextBox.Text = ToNonNull <string>(dict["ContractMealPlan"]); ResidentIsKPCheckbox.Checked = ToNonNull <bool>(dict["KP"]); ResidentIsFMCheckbox.Checked = ToNonNull <bool>(dict["FM"]); var rooms = Room.GetAllRooms(dataWrapper).Select(num => num.ToString()); ResidentAssignedRoomComboBox.Items.Clear(); ResidentAssignedRoomComboBox.Items.Add("N/A"); ResidentAssignedRoomComboBox.Items.AddRange(rooms.ToArray()); var assignedRoom = Resident.GetAssignedRoom((int)dict["SSN"], dataWrapper).ToString(); if (assignedRoom == "0") { assignedRoom = "N/A"; } ResidentAssignedRoomComboBox.SelectedItem = assignedRoom; }
protected void btnRemoveEmployee_Click(object sender, EventArgs e) { try { int ResID = 0; if (HiddenField1.Value.ToString() != "") { ResID = Convert.ToInt32(HiddenField1.Value.ToString()); Resident res = new Resident(); bool result = res.DeactivateResident(DateTime.UtcNow, ResID); if (result) { FillEmployeeData(); ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:hideRemoveEmployeeModal()", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:alert(Error)", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:alert(Empty Employee)", true); } } catch (Exception ex) { } }
/// <summary> /// отправить самолет /// </summary> public void SendPlane() { int count = ClientsOfBank.Count(); Passengers.Clear(); for (var i = 0; i < 3; i++) { try { int id = rand.Next(count); Resident res = ClientsOfBank.Where(t => t.Id == id).Single(); Passengers.Add(new Passenger { Id = res.Id, Name = res.Surname + res.Name + res.Patronymic }); } catch (Exception e) { } } _bus.Send(new Package() { From = Subject.Airport, To = Subject.WeatherStation, Method = CanFlyMethod, }); }
public IRoom AddInhabitant(int roomId, IResident dweller) { var room = _db.Rooms.Where(r => r.Id == roomId).FirstOrDefault(); if (room == null) { return(null); } Resident res = _db.Residents.Where(r => r.Id == dweller.Id).FirstOrDefault(); if (res != null) { //if (!room.Inhabitants.Contains(res)) room.Inhabitants.Add(res); } else { //var res2 = AddResident(dweller); res = new Resident() { Id = dweller.Id, JobDescription = dweller.JobDescription, LastName = dweller.LastName, Name = dweller.Name, Title = dweller.Title }; room.Inhabitants.Add(res); } _db.SaveChanges(); return(room); }
public IHttpActionResult Post(Resident resident) { //resident.OrgId = SecurityHelper.CurrentPrincipal.OrgId; var response = service.SaveLeaveNursing(resident); return(Ok(response)); }
public async Task <ActionResult <Resident> > PostResident(Resident resident) { _context.Residents.Add(resident); await _context.SaveChangesAsync(); return(CreatedAtAction("GetResident", new { id = resident.ResidentId }, resident)); }
private void button2_Click(object sender, EventArgs e) { if (_console.ResidentsList.Count + 1 <= _console.ParkingLot.ParkingSpaces.Count * 0.2) { label7.Text = @"Per daug rezervuotų vietų"; return; } if ((textBox2.Text == "") && (textBox3.Text == "") && (textBox4.Text == "") && (textBox5.Text == "") && (textBox6.Text == "")) { label7.Text = @"Užpildykite visus laukus"; return; } Resident resident = new Resident(textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text); if (_console.Reservations.Contains(resident)) { label7.Text = @"Tokiam automobiliui vieta užrezervuota"; return; } if (!_console.ResidentsList.Contains(resident)) { label7.Text = @"Tokio gyventojo gyventojų sistemoje nėra"; return; } label7.Text = @"Išsaugota"; _console.Reservations.Add(resident); textBox2.Text = String.Empty; textBox3.Text = String.Empty; textBox4.Text = String.Empty; textBox5.Text = String.Empty; textBox6.Text = String.Empty; }
public async Task <IActionResult> RegisterResident([FromHeader] string Authotization, [FromBody] RequestResident request) { try { var user = new User() { Name = request.Name, LastName = request.LastName, Email = request.Email, Password = request.Password, BirthDate = request.BirthDate, Gender = request.Gender, Phone = request.Phone, Token = Guid.NewGuid().ToString().Replace("-", ""), }; var userSaved = await _userService.Insert(user); var resident = new Resident() { IsBlocked = false, UserId = userSaved.UserId }; var residentSaved = await _residentService.Insert(resident); residentSaved.User = userSaved; OkResponse(residentSaved); return(new ObjectResult(response)); } catch (Exception e) { InternalServerErrorResponse(e.Message); return(new ObjectResult(response)); } }
public async Task <IActionResult> PutResident(int id, Resident resident) { if (id != resident.ResidentId) { return(BadRequest()); } _context.Entry(resident).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResidentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void Run() { Resident resident = _dbService.FindResidentById(3); Console.WriteLine($"{resident.Prename} {resident.LastName}\nAlter: {resident.Age}"); Console.WriteLine(); string careLevel = "3c"; List <Resident> residentList = _queryService.FilterResidentsByCareLevel(careLevel); Console.WriteLine($"Es gibt {residentList.Count} Bewohner mit Carelevel {careLevel}."); int numberOfCategories = _queryService.CountNumberOfEquipmentCategories(); Console.WriteLine($"Es gibt {numberOfCategories} Equipment-Kategorien."); string equipmentCategory = "standard"; List <Resident> residentList2 = _queryService.FilterResidentByRoomEquipment(equipmentCategory); Console.WriteLine($"Es gibt {residentList2.Count} Bewohner mit der Equipmentkategorie {equipmentCategory}."); List <Resident> residentList3 = _queryService.FilterResidentsByAge(88, 89); foreach (Resident res in residentList3) { Console.WriteLine("{0} {1}, {2}", res.Prename, res.LastName, res.Age); } }
protected void removeno_Click(object sender, EventArgs e) { try { int resid = Convert.ToInt32(HiddenField1.Value); int userid = Convert.ToInt32(HiddenField2.Value); Resident deactresident = new Resident(); bool result = deactresident.DeactivateResident(DateTime.UtcNow, resid); if (result) { FillFlatdata(); ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:HideRemoveOwner()", true); } else { lblRemoveOwnerMessage.ForeColor = System.Drawing.Color.Red; lblRemoveOwnerMessage.Text = "Could not remove owner try later or Contact Admin"; } } catch (Exception ex) { } }
/// <summary> /// method for sorting /// </summary> public void Sort() { if (Head.next == Tail) { return; } bool done = true; while (done) { done = false; var headn = Head.next; while (headn.next.next != null) { if (headn.CompareTo(headn.next) < 0) { Resident ab = headn.Get(); headn.Set(headn.next.Get()); headn.next.Set(ab); done = true; } headn = headn.next; } } }
public ActionResult Details(int id) { Resident unit = _residentBusiness.GetResidentDetails(id); ResidentViewModel unitViewModel = ResidentMapper.ToResidentViewModel(unit); return(View(unitViewModel)); }
public ActionResult Delete(int id) { Resident resident = _residentBusiness.GetResidentDetails(id); ResidentViewModel residentViewModel = ResidentMapper.ToResidentViewModel(resident); return(View(residentViewModel)); }
public static Resident GetResidentByID(int id) { Resident resident = new Resident(); SqlResidentProvider sqlResidentProvider = new SqlResidentProvider(); resident = sqlResidentProvider.GetResidentByID(id); return resident; }
// Նոր ավելացված ֆունկցիա public ActionResult CreateWithResident(int?id) { ViewBag.activeRec = "active"; try { using (var db = new StoreContext()) { this.OrganizeViewBugs(db); Resident resident = db.Residents.Find(id); var item = new CardiologicalDuplexScanItem(); item.ResidentId = resident.ResidentId; item.PatientId = resident.PatientId; item.ResidentFirstName = resident.ResidentFirstName; item.ResidentLastName = resident.ResidentLastName; item.ResidentPatronymicName = resident.ResidentPatronymicName; item.BirthDate = resident.BirthDate; return(View("InputForm", item)); } } catch (Exception ex) { return(RedirectToAction("Index", "Error", new { msg = ex.Message })); } }
public IHttpActionResult PutResident(int id, Resident resident) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != resident.ResidentId) { return(BadRequest()); } db.Entry(resident).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ResidentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IActionResult Get(int?id) { if (id == null) { List <Resident> result = UnitOfWork.Residents.GetObjectList().ToList(); if (result == null) { return(NoContent()); } else { return(Ok(result)); } } else { Resident result = UnitOfWork.Residents.GetObject((int)id); if (result == null) { return(NoContent()); } else { return(Ok(result)); } } }
private CreateExamReportTest() { _examReportService = GetService <IExamReportService>(); _medicService = GetService <IMedicService>(); _examRequestService = GetService <IExamRequestService>(); _newExamReport = new Domain.Entities.ExamReport(); _resident = new Resident() { CRM = "123", InitialDate = DateTime.Now, User = new User { Id = 1, Email = "*****@*****.**", Name = "resident", Password = "******", } }; _examRequest = new Domain.Entities.ExamRequest { Id = 1, Hypothesis = "Cancer no coracao", ExamName = ExamType.Ecocardiograma, Recomendation = "Descansar" }; _medicService.SaveAsync <MedicValidator>(_resident); _examRequestService.SaveAsync <ExamRequestValidator>(_examRequest); }
/// <summary> /// Sets the active tenant. /// </summary> /// <param name="p">The new active tenant.</param> public virtual void setActive(NetworkInstanceId p) { activeTenant = p; if (activeTenant != NetworkInstanceId.Invalid) { resident = getResident(p); if (resident != null) { resident.setResidence(building.netId); building.occupied = true; if (building.getOwner() > -1) { Player local = FindObjectOfType <Player> ().localPlayer; if (local != null) { local.updateUI(); } } } else { activeTenant = NetworkInstanceId.Invalid; building.occupied = false; } } else { resident = null; } }
/// <summary> /// Spawns buttons for interested tenants. /// </summary> public virtual void setButtons() { int i = 0; foreach (NetId id in availableTenants) { Resident p = getResident(id.id); if (p != null) { GameObject obj = (GameObject)Instantiate(Resources.Load("TenantPanel")); obj.GetComponent <TenantPanel> ().person = p.personToString(); obj.GetComponent <TenantPanel> ().portNum = p.portrait; obj.transform.SetParent(GameObject.Find("Canvas").transform.Find("ReadoutPanel").transform, false); obj.transform.position = new Vector3(obj.transform.position.x + (101 * i), obj.transform.position.y, obj.transform.position.z); int tmp = i; Building tmpBuilding = gameObject.GetComponent <Building> (); if (tmpBuilding.validOwner()) { obj.transform.Find("Button").GetComponent <Button> ().onClick.AddListener(delegate { tmpBuilding.getPlayerOwner().CmdSetTenant(tmp, gameObject.GetComponent <NetworkIdentity> ().netId); }); } buttons.Add(obj); i++; } } }
public void Test_UpdateNameResident() { int residentId = random.Next(10, 20); // Vorher Resident resident = service.FindResidentById(residentId); string preNameBefore = resident.Prename; string lastNameBefore = resident.LastName; // neue Namen: string[] preNames = { "Luise", "Lisa", "Anneliese", "Irma" }; string[] lastNames = { "Vogel", "Meyer", "Friedrich", "Siebert" }; string preName = preNames[random.Next(preNames.Length)]; string lastName = lastNames[random.Next(lastNames.Length)]; // Testaufruf resident = service.UpdateNameResident(residentId, preName, lastName); // Standardtests, die immer wahr sein müssen Assert.NotNull(resident); Assert.AreEqual(preName, resident.Prename, "Die Vornamen müssen gleich sein."); Assert.AreEqual(lastName, resident.LastName, "Die Nachnamen müssen gleich sein."); // Test, wenn Vorname sich geändert hat if (!preName.Equals(preNameBefore)) { Assert.AreNotEqual(preNameBefore, resident.Prename, "Der Vorname muss sich geändert haben"); } // Test, wenn Nachname sich geändert hat if (!lastName.Equals(lastNameBefore)) { Assert.AreNotEqual(lastNameBefore, resident.LastName, "Der Nachname muss sich geändert haben"); } }
public override House makeHouse(string typeOfHouse) { House myHouse = null; IHouseBuilder myBuilder = null; if (typeOfHouse.Equals("Resident")) { myBuilder = new ResidentBuilder(); myHouse = new Resident(myBuilder); myHouse.setName("Resident House"); } else if (typeOfHouse.Equals("Office")) { myBuilder = new OfficeBuilder(); myHouse = new Office(myBuilder); myHouse.setName("Office"); } else if (typeOfHouse.Equals("Shop")) { myBuilder = new ShopBuilder(); myHouse = new Shop(myBuilder); myHouse.setName("Shop"); } return(myHouse); }
public ActionResult PayforService(int?id) { //Session["auth"] = 12; if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Resident tempr = db.Residents.FirstOrDefault(res => res.ResidentID == userid); TempData["UserName"] = tempr.ResidentName; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Payment payment = db.Payments.Find(id); if (payment == null) { return(HttpNotFound()); } else { Payment p = db.Payments.Single(ser => ser.PaymentID == id); p.PaymentStatus = "paid"; db.SaveChanges(); int serID = (int)p.ServiceID; Service tempser = db.Services.Find(serID); tempser.ServiceApproval = "paid"; db.SaveChanges(); return(RedirectToAction("PaymentHistory")); } } }
public ActionResult Register(RegistrationModel registrationModel) { try { Setting setting = DatabaseContext.Settings.FirstOrDefault(s => s.House.Address == registrationModel.Address && s.EntranceNumber == registrationModel.Entrance && s.SettingNumber == registrationModel.SettingNumber); Resident resident = new Resident() { FullName = registrationModel.Surname + " " + registrationModel.Name + " " + registrationModel.Patronymic, PhoneNumber = registrationModel.PhoneNumber, Password = registrationModel.Password, Requests = new List <Request>(), ResidentTags = new List <ResidentTag>() }; resident.Setting = setting; DatabaseContext.Residents.Add(resident); DatabaseContext.SaveChanges(); return(RedirectToAction("Index", "PersonalCabinet")); } catch (Exception e) { Logger.Error(e.Message); return(RedirectToAction("Register")); } }
public ActionResult RaiseComplaint([Bind(Include = "ComplaintID,ResidentID,ComplaintRegarding,ComplaintStatus")] Complaint complaint) { //Session["auth"] = 12; if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Resident tempr = db.Residents.FirstOrDefault(res => res.ResidentID == userid); TempData["UserName"] = tempr.ResidentName; complaint.ResidentID = userid; complaint.ComplaintStatus = "raised"; if (ModelState.IsValid) { db.Complaints.Add(complaint); db.SaveChanges(); return(RedirectToAction("VieworDeleteComplaints")); } return(View(complaint)); } }
public ActionResult CreatePost([Bind(Include = "PostID,PostPostedBy,PostTitle,PostType,PostDescription,PostIntendedFor,PostTime")] DashboardPost dashboardPost) { //Session["auth"] = 12; if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Resident tempr = db.Residents.FirstOrDefault(res => res.ResidentID == userid); TempData["UserName"] = tempr.ResidentName; if (ModelState.IsValid) { DashboardPost tempdashboardPost = new DashboardPost(userid, dashboardPost.PostTitle, dashboardPost.PostType, dashboardPost.PostIntendedFor, dashboardPost.PostDescription, DateTime.Now); db.DashboardPosts.Add(tempdashboardPost); db.SaveChanges(); return(RedirectToAction("VieworDeletePosts")); } return(View(dashboardPost)); } }
public ActionResult VieworDeleteVisitor() { //Session["auth"] = 12; if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Resident tempr = db.Residents.FirstOrDefault(res => res.ResidentID == userid); TempData["UserName"] = tempr.ResidentName; int count = db.Visitors.Count(vis => vis.ResidentID == userid); if (count > 0) { var tables = new OneForAll { visitor = db.Visitors.Where(vis => vis.ResidentID == userid).ToList() }; return(View(tables)); } else { return(RedirectToAction("NoRecords")); } } }
public IHttpActionResult PostResident(Resident resident) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Residents.Add(resident); try { db.SaveChanges(); } catch (DbUpdateException) { if (ResidentExists(resident.ResidentId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = resident.ResidentId }, resident)); }
public IActionResult SignUp([FromBody] NewUserModel newUser) { ProviderBase prof; try { if (newUser == null || !ModelState.IsValid) { return(BadRequest(LoginErrorCode.MissingUserCredentials.ToString())); } if (userRepo.All.Any()) { IEnumerable <ProviderBase> providers; providers = userRepo.All.Where(x => x.email.Equals(newUser.email)); if (providers.Any()) { return(BadRequest(LoginErrorCode.EmailAlreadyInUse.ToString())); } } switch (newUser.role) { case Role.Coordo: prof = new Coordinator(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; case Role.Urgence: prof = new Urgence(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; case Role.AIC: prof = new AIC(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; case Role.Infirmirary: prof = new Infirmirary(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; case Role.Pediatre: prof = new Resident(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; default: return(BadRequest(LoginErrorCode.RoleNotValid.ToString())); } userRepo.Insert(prof); } catch (Exception) { return(BadRequest(LoginErrorCode.CouldNotCreateUser.ToString())); } return(Ok(prof)); }
public static bool UpdateResident(Resident resident) { SqlResidentProvider sqlResidentProvider = new SqlResidentProvider(); return sqlResidentProvider.UpdateResident(resident); }
public static int InsertResident(Resident resident) { SqlResidentProvider sqlResidentProvider = new SqlResidentProvider(); return sqlResidentProvider.InsertResident(resident); }