protected override void Initialize() { var child1 = new ListChild { Name = "child1" }; var parent = new ListParent { Children = new List <ListChild> { child1 } }; //Revision 1 using (var tx = Session.BeginTransaction()) { parentId = (Guid)Session.Save(parent); tx.Commit(); } //Revision 2 using (var tx = Session.BeginTransaction()) { child1.Name = "child12"; tx.Commit(); } //Revision 3 using (var tx = Session.BeginTransaction()) { Session.Delete(parent); tx.Commit(); } }
public ListChildItem(ListChild listChild) { InitializeComponent(); ListChild = listChild; Id = listChild.Id; Title = listChild.Title; Detail = listChild.Detail; StartTime = listChild.StartTime.ToString(Global.TIME_FORMAT_STRING); EndTime = listChild.EndTime.ToString(Global.TIME_FORMAT_STRING); Mark = (new MarkItem(Convert.ToInt16(listChild.Mark))).MarkName; DataContext = this; }
public void LoadListChildItems(DataTable listChildrenDataTable) { listChildrenStackPanel.Children.Clear(); for (int i = 0; i < listChildrenDataTable.Rows.Count; i++) { ListChild listChild = ListChild.GetListChildByDataRow(listChildrenDataTable.Rows[i]); ListChildItem listChildItem = new ListChildItem(listChild); listChildItem.HorizontalAlignment = HorizontalAlignment.Stretch; if (i == selectionIndex) { listChildItem.Selected = true; } listChildItem.MouseDown += listChildItem_MouseDown; listChildItem.MouseDoubleClick += listChildItem_MouseDoubleClick; listChildrenStackPanel.Children.Add(listChildItem); } }
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e) { selectionIndex = e.SelectionIndex; selectedListChild = e.SelectedListChild; }