private void EditPersonToolStripMenuItem_Click(object sender, EventArgs e) { EditPerson editPerson = new EditPerson(); editPerson.MdiParent = this; editPerson.Show(); }
public IActionResult Index(int PersonID) { var reqLang = this.Request.Headers["Accept-Language"].ToString(); if (reqLang.StartsWith("ro,") || reqLang.StartsWith("ro-") || reqLang.StartsWith("ro;")) { CultureInfo.CurrentCulture = new CultureInfo("ro"); CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern = "dd.MM.yyyy"; } else { CultureInfo.CurrentCulture = new CultureInfo("en"); CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy"; } var personBO = new PersonBusinessObject(this.personRepository); var person = personBO.GetPersonBusiness(PersonID); var temp = System.Convert.ToDateTime(person.DateOfBirth.ToString()).ToString($"{GetRequestDateFormat(false)} "); var editPerson = new EditPerson { PersonID = person.PersonID, FirstName = person.FirstName, LastName = person.LastName, DateOfBirth = person.DateOfBirth }; return(View("Index", editPerson)); }
public IActionResult EditPerson(int id, CreatePersonViewModel createPerson) { if (ModelState.IsValid) { Person car = _peopleService.EditPerson(id, createPerson); return(RedirectToAction(nameof(Index))); } EditPerson editPerson = new EditPerson(); editPerson.Id = id; editPerson.CreatePerson = createPerson; return(View(editPerson)); //[HttpPost] //public IActionResult Delete(int id, DeletePerson deletePerson) //{ // Person person = _peopleService.FindBy(id); // if (person == null) // { // return RedirectToAction("Index"); // } // DeletePerson deletePerson = new DeletePerson(); // deletePerson.Delete = _peopleService.Remove(id); // return View(deletePerson); //} }
public Task <bool> Put([FromBody] PersonDTO personDTO) { var editPersonRequest = new EditPerson(personDTO); var results = _mediator.Send(editPersonRequest, default); return(results); }
private void btnEdit_Click(object sender, System.EventArgs e) { var row = dataGridView1.SelectedRows[0].DataBoundItem as Model.Models.Person; var form = new EditPerson(repository, row); form.ShowDialog(); Reload(); }
private void btnEdit_Click(object sender, System.EventArgs e) { var row = dataGridView1.SelectedRows[0].DataBoundItem as ServiceReference1.Person; var form = new EditPerson(service, row); form.ShowDialog(); Reload(); }
protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["IDPerson"]; Person p = handler.personHandler.GetPerson(Guid.Parse(id)); EditPerson epc = LoadControl("~/Controls/EditPerson.ascx") as EditPerson; editPerson.Controls.Add(epc); epc.LoadPersonData(p); }
public object GetProjectTeam(EditPerson person) { if (!ModelState.IsValid) { return(operateContext.RedirectWebApi(WebResultCode.Exception, GlobalConstant.参数异常.ToString(), null)); } var data = operateContext.bllSession.T_CompProInfo.GetComByGuID(person); return(operateContext.RedirectWebApi(WebResultCode.Ok, GlobalConstant.数据获取成功.ToString(), data)); }
public object DeletePerson(EditPerson person) { if (!ModelState.IsValid) { return(operateContext.RedirectWebApi(WebResultCode.Exception, GlobalConstant.参数异常.ToString(), null)); } var data = operateContext.bllSession.A01.DeletePerson(person) ? "01" : "02"; return(operateContext.RedirectWebApi(WebResultCode.Ok, GlobalConstant.数据获取成功.ToString(), data)); }
public IActionResult EditPerson(Person currentPerson) { ModelState.Clear(); var model = new EditPerson(_configuration) { CurrentPerson = currentPerson }; var PersonId = model.SavePerson(); return(EditPerson(PersonId)); }
public ViewResult EditStaffProfile() { String userId = User.Identity.GetUserId(); Instructor staff = _staffRepo.GetStaffByUserId(int.Parse(userId)); var model = new EditPerson(staff); model.CurrentProfilePhotoUrl = _generalHelper.GetStaffProfilePhoto(staff); model.CountryOptions = new SelectList(_coreRepo.GetAll <Country>().OrderByDescending(x => x.Id), "Id", "Name").ToList(); return(View(model)); }
protected void Page_Load(object sender, EventArgs e) { List <Person> persons = handler.personHandler.GetPersons().ToList(); foreach (Person p in persons) { EditPerson ep = LoadControl("~/Controls/EditPerson.ascx") as EditPerson; EditContent.Controls.Add(ep); ep.LoadPersonData(p); } }
private void btnModificar_Click(object sender, EventArgs e) { Persona person = ((Persona)this.listPersons.SelectedItem); EditPerson editPerson = new EditPerson(person); if (editPerson.ShowDialog() == DialogResult.OK) { this.listPersons.Items.Clear(); foreach (Persona p in PersonDao.loadPersons()) { this.listPersons.Items.Add(p); } } }
public IActionResult EditPerson(int Id = 0) { //Update/Insert Failed if (Id < 0) { return(Content("Something went wrong")); } var model = new EditPerson(_configuration) { PersonId = Id }; return(PartialView("Partial/EditPerson", model)); }
public IActionResult EditPerson(EditPerson person) { var personBO = new PersonBusinessObject(this.personRepository); personBO.EditPerson(new EditPersonDTO() { PersonID = person.PersonID, FirstName = person.FirstName, LastName = person.LastName, DateOfBirth = person.DateOfBirth }); return(RedirectToAction("Index", "Home")); }
public IActionResult Edit(int id, CreatePerson createPerson) { if (ModelState.IsValid) { Person person = _peopleService.Edit(id, createPerson); return(RedirectToAction(nameof(Index))); } EditPerson editPerson = new EditPerson(); editPerson.Id = id; editPerson.CreatePerson = createPerson; return(View(editPerson)); }
public IActionResult DeletePerson(int Id) { try { var model = new EditPerson(_configuration) { PersonId = Id }; model.DeletePerson(); return(Content("success")); } catch { return(Content("failed")); } }
public IActionResult EditPerson(int id) { Person person = _peopleService.FindBy(id); if (person == null) { return(RedirectToAction("Index")); } EditPerson editPerson = new EditPerson(); editPerson.Id = id; editPerson.CreatePerson = _peopleService.PersonToCreatePerson(person); return(View(editPerson)); }
public IActionResult Edit(int id) { Person person = _peopleService.FindbyId(id); if (person == null) { return RedirectToAction(nameof(Index)); } EditPerson editPerson = new EditPerson(id, person); editPerson.Citylist = _cityService.All(); // Hela listan av Citys return View(editPerson); }
public ActionResult EditStudentProfile() { String username = User.Identity.Name; Student student = _studentRepo.GetStudent(username); //If student has graduated, no access to edit profile if (student.StudentStatus == StudentStatus.Graduated) { TempData[ApplicationConstants.Error404Notification] = "Sorry you can't edit your profile, since you have already graduated!"; return(RedirectToAction("PageNotFound", "Error")); } var model = new EditPerson(student); model.CurrentProfilePhotoUrl = _generalHelper.GetStudentProfilePhoto(student); model.CountryOptions = new SelectList(_coreRepository.GetAll <Country>().OrderByDescending(x => x.Id), "Id", "Name").ToList(); return(View(model)); }
public IActionResult Edit(int id, CreatePersonViewModel createPerson) { Person person = _peopleService.FindbyId(id); if (person == null) { return RedirectToAction(nameof(Index)); } if (ModelState.IsValid) { _peopleService.Edit(id, createPerson); return RedirectToAction(nameof(Index)); } EditPerson editPerson = new EditPerson(id, createPerson); editPerson.Citylist = _cityService.All();// return View(editPerson); }
private void EditEmployee_OnClick(object sender, RoutedEventArgs e) { var editEmployeeFrom = new EditPerson(new Employee()); editEmployeeFrom.Show(); }
public ActionResult EditStaffProfile(EditPerson model) { if (ModelState.IsValid) { var staffToEdit = _coreRepo.Get <Instructor>(model.ParentClassId); if (staffToEdit != null) { staffToEdit.Person.Title = model.Title; staffToEdit.Person.Gender = model.Gender; staffToEdit.Person.DateOfBirth = model.DateOfBirth; staffToEdit.Person.MaritalStatus = model.MaritalStatus; staffToEdit.Person.Religion = model.Religion; //SET ALL COUNTRIES var nationality = _coreRepository.GetAll <Country>() .FirstOrDefault(x => x.Id.Equals(model.NationalityId)); staffToEdit.Person.Country2 = nationality; staffToEdit.Person.Country = nationality; staffToEdit.Person.Country1 = nationality; staffToEdit.Person.PlaceOfBirth = nationality != null ? nationality.Name : null; string newFileName = null; if (model.ProfilePhotoFile != null) { if (_generalHelper.SaveFile(model.ProfilePhotoFile, ApplicationConstants.StaffResourcesFolder, out newFileName, model.ProfilePhotoName)) { _generalHelper.ResizeImage(model.ProfilePhotoFile, ResourceFolders.ThumbnailSmall, ApplicationConstants.StaffResourcesFolder, newFileName, model.ProfilePhotoName); _generalHelper.ResizeImage(model.ProfilePhotoFile, ResourceFolders.Thumbnail, ApplicationConstants.StaffResourcesFolder, newFileName, model.ProfilePhotoName); staffToEdit.Person.ProfilePhotoName = newFileName; staffToEdit.User.ProfilePhotoName = newFileName; } } if (!string.IsNullOrEmpty(model.TelephoneContact)) { staffToEdit.Person.TelephoneContact = model.TelephoneContact; } if (!string.IsNullOrEmpty(model.AltTelephoneContact)) { staffToEdit.Person.AltTelephoneContact = model.AltTelephoneContact; } if (!string.IsNullOrEmpty(model.EmailAddress)) { staffToEdit.Person.EmailAddress = model.EmailAddress; } if (!string.IsNullOrEmpty(model.AltEmailAddress)) { staffToEdit.Person.AltEmailAddress = model.AltEmailAddress; } if (!string.IsNullOrEmpty(model.NextOfKinName)) { staffToEdit.Person.NextOfKinName = model.NextOfKinName; } if (!string.IsNullOrEmpty(model.NextOfKinRelationship)) { staffToEdit.Person.NextOfKinRelationship = model.NextOfKinRelationship; } if (!string.IsNullOrEmpty(model.NextOfKinContact)) { staffToEdit.Person.NextOfKinContact = model.NextOfKinContact; } //Default the occupation to Staff staffToEdit.Person.Occupation = "Staff"; if (!string.IsNullOrEmpty(model.PostalAddress)) { staffToEdit.Person.PostalAddress = model.PostalAddress; } staffToEdit.Person.PersonOwnerType = int.Parse(ApplicationConstants.StaffUserType); DateTime savedDateTime = DateTime.Now; staffToEdit.Person.LastModified = savedDateTime; var isSaved = _coreRepo.SaveOrUpdate(staffToEdit); if (isSaved) { if (!string.IsNullOrEmpty(newFileName)) { TempData[ApplicationConstants.SuccessNotification] = "The profile photo has been updated. Log out and log back in to view changes!"; } return(RedirectToAction("Index", "Staff")); } else { ModelState.AddModelError("Save Fail", "Saving of Edit failed"); } } else { ModelState.AddModelError("StaffNone", "Staff Member doesn't exist"); } } //Listing errors foreach (string error in _generalHelper.GetErrorList(ModelState)) { ModelState.AddModelError("", error); } model.CountryOptions = new SelectList(_coreRepo.GetAll <Country>().OrderByDescending(x => x.Id), "Id", "Name").ToList(); return(View(model)); }
private void EditCustomer_OnClick(object sender, RoutedEventArgs e) { var editCustomerFrom = new EditPerson(new Customer()); editCustomerFrom.Show(); }