public override void OnBeforeDelete(IDeleteRequestHandler handler) { if (ReferenceEquals(null, Target) || (Target.Flags & FieldFlags.Updatable) != FieldFlags.Updatable) { return; } var idField = (handler.Row as IIdRow).IdField; var row = new NotesRow(); var fld = NotesRow.Fields; var deleteList = new List <Int64>(); new SqlQuery() .From(row) .Select(fld.NoteId) .Where( fld.EntityType == handler.Row.Table & fld.EntityId == idField[handler.Row].Value) .ForEach(handler.Connection, () => { deleteList.Add(row.NoteId.Value); }); foreach (var id in deleteList) { DeleteNote(handler.UnitOfWork, id); } }
private static Cell GetNotesRow(NotesRow notesRow) { Label label = new Label { Text = notesRow.Title.ToUpper(), HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Center, TextColor = CustomColors.LightSharkonColor, FontSize = PlatformsConstants.TableViewFieldLabelFontSize, Margin = new Thickness(0, 5, 0, 0), }; Editor editor = new Editor() { Text = notesRow.Text, Keyboard = Keyboard.Default, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, HeightRequest = 75, Margin = new Thickness(0, -5, 0, 0), FontSize = PlatformsConstants.TableViewFieldEntryFontSize, }; StackLayout stackLayout = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Margin = new Thickness(15, 0, 15, 0), Spacing = 7, Children = { label, editor, }, }; CustomViewCell viewCell = new CustomViewCell() { View = stackLayout, ShowSelection = false }; editor.TextChanged += (sender, e) => notesRow.TextChangedAction?.Invoke(sender, e); editor.Focused += (sender, e) => notesRow.OnFocusAction?.Invoke(e); editor.Unfocused += (sender, e) => notesRow.OnUnfocusAction?.Invoke(e); return(viewCell); }
private void SaveNote(IUnitOfWork uow, NotesRow note, string entityType, Int64 entityId, Int64?noteId) { note = note.Clone(); note.NoteId = noteId; note.EntityType = entityType; note.EntityId = entityId; note.InsertDate = null; note.ClearAssignment(NotesRow.Fields.InsertDate); var saveRequest = new SaveRequest <NotesRow> { Entity = note }; if (noteId == null) { new NotesRepository().Create(uow, saveRequest); } else { new NotesRepository().Update(uow, saveRequest); } }