public void OnDestroy() { if (EditMember != null) { EditMember.LeaveForced(); } }
public int UpdateMember(EditMember editMember) { using (IDbConnection connection = OpenConnection()) { const string query = "UPDATE Member " + "SET FirstName = @FirstName, " + "LastName = @LastName, " + "Address1 = @Address1, " + "Address2 = @Address2, " + "City = @City, " + "State = @State, " + "Zipcode = @Zipcode, " + "Country = @Country, " + "FreeCases = @FreeCases, " + "EmailOptIn = @EmailOptIn " + "WHERE MemberID = @MemberID"; var parameters = new { MemberID = editMember.MemberID, CustomerProfileID = editMember.CustomerProfileID, FirstName = editMember.FirstName, LastName = editMember.LastName, Address1 = editMember.Address1, Address2 = editMember.Address2, City = editMember.City, State = editMember.State, Zipcode = editMember.Zipcode, Country = editMember.Country, FreeCases = editMember.FreeCases, EmailOptIn = editMember.EmailOptIn }; return(connection.Execute(query, parameters)); } }
public void EditMember_MakesValidEdit_ShouldSucceed() { // Arrange var sut = new MembersController(); var actionResult = sut.New(new NewMember { Name = "Person 3", Email = "*****@*****.**" }); var jsonResult = (JsonResult)actionResult; var newMember = JsonConvert.DeserializeObject <Member>(jsonResult.Data.ToString()); var editedMember = new EditMember { Id = newMember.Id, Name = newMember.Name, Email = newMember.Email }; editedMember.Name = "EDITED Person 3"; // Act sut.Edit(editedMember); // Assert var context = new TestDataContext(); var databaseMember = context.Members.First(x => x.Id == newMember.Id); Assert.AreEqual(editedMember.Id, databaseMember.Id); Assert.AreEqual(editedMember.Name, databaseMember.Name); Assert.AreEqual(editedMember.Email, databaseMember.Email); }
public ActionResult Edit(EditMember editMember) { if (ModelState.IsValid) { accountService.UpdateMember(editMember); return(RedirectToAction("Details", "Account")); } return(View(editMember)); }
public ActionResult EditMember(int id) { if (Session["isAdmin"] == null) { return(RedirectToAction("LogIn", "Account")); } EditMember model = adminService.GetMember(id); return(View(model)); }
public ActionResult EditMember(EditMember model) { if (Session["isAdmin"] == null) { return(RedirectToAction("LogIn", "Account")); } adminService.UpdateMember(model); return(RedirectToAction("Index")); }
public void Save() { EditorGUIUtility.keyboardControl = 0; EditMember.Save(); if (m_ShowMerge) { Init(m_Item); } if (m_OrphanDocItem != null) { m_OrphanDocItem.DeleteDoc(false); } }
public void EditMember_TryingToEditANonExistingMember_ShouldReturnEmptyResult() { // Arrange var editedMember = new EditMember { Id = -999, Name = "No one", Email = "*****@*****.**" }; // Act var sut = new MembersController(); var editResult = sut.Edit(editedMember); // Assert Assert.IsInstanceOf(typeof(EmptyResult), editResult); }
private void _btnEditMember_Click(object sender, RoutedEventArgs e) { var selected = _datagridMembers.SelectedItem; if (selected != null) { Member mem = (Member)selected; EditMember win = new EditMember(mem); win.ShowDialog(); _datagridMembers.ItemsSource = db.Members.ToList(); } else { MessageBox.Show("هیچ رکوردی انتخاب نشده", "پیغام", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void RevertSaveButtons() { EditorGUI.BeginDisabledGroup(EditMember == null || !EditMember.Loaded || !EditMember.Dirty); if (GUILayout.Button("Revert", EditorStyles.toolbarButton)) { EditorGUIUtility.keyboardControl = 0; EditMember.Load(); } EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(EditMember == null || !EditMember.Loaded || (!EditMember.Dirty && !EditMember.DirtyAutoChanges)); if (GUILayout.Button("Save", EditorStyles.toolbarButton)) { Save(); } EditorGUI.EndDisabledGroup(); }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { if (lbxMembers.SelectedItem is Member memberToEdit) { EditMember editMember = new EditMember(memberToEdit); editMember.ShowDialog(); Repository repo = Repository.GetInstance(); _member = repo.GetAllMembers(); lbxMembers.ItemsSource = _member; } else { MessageBox.Show("Kein Mitglied ausgewählt!"); } }
public void EditMember_WhenEditingABlankEmail_ShouldThrowException() { // Arrange var sut = new MembersController(); var actionResult = sut.New(new NewMember { Name = "Person 5", Email = "*****@*****.**" }); var jsonResult = (JsonResult)actionResult; var newMember = JsonConvert.DeserializeObject <Member>(jsonResult.Data.ToString()); var editedMember = new EditMember { Id = newMember.Id, Name = newMember.Name, Email = newMember.Email }; editedMember.Email = String.Empty; // Act & Assert Assert.Throws <DbEntityValidationException>(() => sut.Edit(editedMember)); }
public OperationResult Edit(EditMember command) { var operation = new OperationResult(); operation.IsSuccedded = false; var editItem = _memberRepository.Get(command.Id); if (editItem == null) { return(operation.Failed(ApplicationMessages.RecordNotFound)); } if (_memberRepository.Exist(x => x.Mobile == command.Mobile && x.Id != command.Id)) { return(operation.Failed(ApplicationMessages.DuplicatedRecord)); } editItem.Edit(command.FullName, command.Mobile); _memberRepository.SaveChanges(); return(operation.Succedded()); }
public IActionResult EditMember(EditMember member) { if (ModelState.IsValid) { using (var db = new StrCalcDbContext()) { var no = HttpContext.Session.GetInt32("LOGIN_USER"); var user = db.Members.FirstOrDefault(u => u.No.Equals(no)); user.Pw = member.Pw; user.NickName = member.NickName; user.Email = member.Email; db.SaveChanges(); return(RedirectToAction("MemberDetails", "Member")); } } return(View()); }
private void DocEditButtons() { bool somethingSelected = m_SelectedText >= 0; EditorGUI.BeginDisabledGroup(EditMember == null || !EditMember.Loaded || !somethingSelected); if (GUILayout.Button("Insert Example", EditorStyles.toolbarButton)) { MemberSubSection section = EditMember.Model.SubSections[m_SelectedSection]; section.TextBlocks.Insert(m_SelectedText + 1, new ExampleBlock("")); EditMember.Model.SanitizeForEditing(); EditMember.OnModelEdited(); } EditorGUI.EndDisabledGroup(); if (!m_Browser.translating) { EditorGUILayout.Space(); EditGrouping = GUILayout.Toggle(EditGrouping, "Edit Grouping", EditorStyles.toolbarButton); } }
//编辑 private void EditCheck_Click(object sender, RoutedEventArgs e) { Teacher teacher = MemberDataGrid.SelectedItem as Teacher; if (teacher != null) { EditMember editMember = new EditMember(teacher.memberId) { memberId = teacher.memberId }; editMember.ShowDialog(); if (editMember.DialogResult == true) { Init(); } } else { System.Windows.MessageBox.Show("请先选择要操作的人员", "提示"); } }
public void EditMember_WhenEditingCausesDuplicateEmail_ShouldThrowException() { // Arrange var sut = new MembersController(); var actionResult = sut.New(new NewMember { Name = "Person 7", Email = "*****@*****.**" }); var jsonResult = (JsonResult)actionResult; var PERSON_7 = JsonConvert.DeserializeObject <Member>(jsonResult.Data.ToString()); sut.New(new NewMember { Name = "Person 8", Email = "*****@*****.**" }); // Act & Assert var edited_PERSON_7 = new EditMember { Id = PERSON_7.Id, Name = PERSON_7.Name, Email = "*****@*****.**" }; Assert.Throws <DbUpdateException>(() => sut.Edit(edited_PERSON_7)); }
public ActionResult Edit(int id, HttpPostedFileBase upFile, EditMember inputData) { if (ModelState.IsValid) { var data = db.Member.Find(id); if (upFile != null) { string fileName = Path.Combine(Server.MapPath("~/img/"), upFile.FileName); upFile.SaveAs(fileName); string filePath = "/img/"; inputData.ImgPath = filePath + upFile.FileName.Trim(); data.ImgPath = inputData.ImgPath; } if (data != null) { data.Name = inputData.Name; data.PhoneNum = inputData.PhoneNum; data.Address = inputData.Address; data.Sex = inputData.Sex; data.Email = inputData.Email; data.AccountNum = inputData.AccountNum; data.Password = inputData.Password; data.Birth = inputData.Birth; data.JobID = inputData.JobID; data.IdCard = inputData.IdCard; data.CreateDT = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Index")); } } var dataCheck = db.Member.Find(id); return(View(dataCheck)); }
private void TourRegAddMember_Load(object sender, EventArgs e) { mySanctionNum = Properties.Settings.Default.AppSanctionNum; if (mySanctionNum == null) { MessageBox.Show("An active tournament must be selected from the Administration menu Tournament List option"); this.Close(); } else { if (mySanctionNum.Length < 6) { MessageBox.Show("An active tournament must be selected from the Administration menu Tournament List option"); this.Close(); } else { myDataModified = false; DataGridView.Rows.Clear(); myTourRow = getTourData(); } } sortDialogForm = new SortDialogForm(); sortDialogForm.ColumnList = DataGridView.Columns; filterDialogForm = new Common.FilterDialogForm(); filterDialogForm.ColumnList = DataGridView.Columns; myEditRegMemberDialog = new EditRegMember(); myEditMemberDialog = new EditMember(); //Initialize search fields and set starting position inputLastName.Text = ""; inputFirstName.Text = ""; inputMemberId.Text = ""; inputState.Text = ""; inputLastName.Focus(); }
public ActionResult Edit(EditMember data) { if (!ModelState.IsValid) { Response.StatusCode = (int)HttpStatusCode.BadRequest; var modelErrors = ModelState.AllErrors(); return(Json(modelErrors)); } var member = _context.Members.FirstOrDefault(x => x.Id == data.Id); if (member == null) { return(new EmptyResult()); } member.Name = data.Name; member.Email = data.Email; try { _context.SaveChanges(); } catch (UpdateException ex) { Exception currentException = ex; while (currentException != null) { ModelState.AddModelError("EF", currentException.Message); currentException = currentException.InnerException; } Response.StatusCode = (int)HttpStatusCode.InternalServerError; var modelErrors = ModelState.AllErrors(); return(Json(modelErrors)); } return(Json(JsonConvert.SerializeObject(data))); }
public ActionResult Edit(EditMember data) { var editMember = new Member { Id = data.Id, Name = data.Name, Email = data.Email, CategoryId = data.CategoryId }; var myCurrentRecord = _context.Members.SingleOrDefault(b => b.Id == editMember.Id); if (myCurrentRecord != null) { myCurrentRecord.Email = editMember.Email; myCurrentRecord.Name = editMember.Name; myCurrentRecord.CategoryId = editMember.CategoryId; } _context.SaveChanges(); return(Json(JsonConvert.SerializeObject(editMember))); }
public JsonResult OnPostEdit(EditMember command) { var result = _memberApplication.Edit(command); return(new JsonResult(result)); }
public bool LeaveWithPermission() { return(EditMember == null || EditMember.LeaveWithPermission()); }
public void UpdateMember(EditMember editMember) { accountRepository.UpdateMember(editMember); }
public void UpdateMember(EditMember editMember) { adminRepository.UpdateMember(editMember); }