private void SaveData(int mode) { if (!IsCheckValidate(mode)) { return; } var noteInfo = GetNoteInfo(mode); var noteInfoDetail = GetNoteInfoDetail(mode); if (noteInfo != null) { if (MessageBoxHelper.ShowConfirmMessage(BSMessage.BSM000038) != System.Windows.Forms.DialogResult.Yes) { return; } if (DoUpdate(noteInfo, noteInfoDetail)) { LoadDataGridView(); } else { MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000002); return; } } else { MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000040); NoteContent_MemoEdit.Focus(); return; } }
/// <summary> /// /// </summary> /// <param name="mode"></param> /// <returns></returns> private bool IsCheckValidate(int mode) { if (mode.In(2, 3)) { var selected = Main_GridView.GetFocusedRow().CastTo <NoteInfo>(); if (selected == null) { MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000026); return(false); } if (selected.UpdateUser.ToUpper() != UserInfo.UserID.ToUpper()) { MessageBoxHelper.ShowErrorMessage("Không thể sửa/xóa nhật ký của người khác!"); return(false); } } if (mode.In(1, 2)) { if (string.IsNullOrEmpty(NoteContent_MemoEdit.EditValue.ToString())) { MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000041, NoteContent_Label.Text); NoteContent_MemoEdit.Focus(); return(false); } } return(true); }