private TreeViewItemViewModel(BaseTreeItem treeItem, TreeViewItemViewModel parent) { _treeItem = treeItem; _parent = parent; _children = new ReadOnlyCollection <TreeViewItemViewModel>(_treeItem.Children.Select(child => new TreeViewItemViewModel(child, this)).ToList()); }
private void FireChangedFocusedTreeNode() { BaseTreeItem item = treeList.GetDataRecordByNode(treeList.FocusedNode) as BaseTreeItem; if (item != null) { HwgrTreeItem hw = item as HwgrTreeItem; if (hw != null) { m_context.WorldToHwgr = hw.Hwgr; } else { WgrTreeItem w = item as WgrTreeItem; if (w != null) { foreach (BaseTreeItem parent in treeList.DataSource as BindingTemplate <BaseTreeItem> ) { if (parent.ID == w.ParentID) { m_context.WorldToHwgr = (parent as HwgrTreeItem).Hwgr; break; } } m_context.HwgrToWgr = w.Wgr; } } } }
public void Bind(BaseTreeItem entity, long storeID) { m_vice = entity; m_storeID = storeID; edParent.Properties.DataSource = new BaseTreeItem[] { entity }; edParent.EditValue = entity; }
public void Bind(BaseTreeItem entity, long storeID) { m_vice = entity; m_storeID = storeID; edParent.Properties.DataSource = new BaseTreeItem[] { entity}; edParent.EditValue = entity; }
private TreeListNode GetNodeByEntity(BaseTreeItem entity) { TreeListNode ret_node = null; foreach (TreeListNode node in treeList.Nodes) { if (entity == GetEntityByNode(node)) { ret_node = node; break; } } return(ret_node); }
public override bool Commit() { try { DateTime begin = BeginTime, end = EndTime; Utility.AssignWeek(ref begin, ref end); BeginTime = begin; EndTime = end; switch (m_assignEnum) { case AssignEnum.ThisHwgrToWgr: case AssignEnum.ThisWgrToHWGR: HwgrToWgr assign = ClientEnvironment.HwgrToWgrService.CreateEntity(); assign.BeginTime = BeginTime; assign.EndTime = EndTime; assign.HWGR_ID = (long)edParent.EditValue; assign.Import = false; assign.StoreID = m_storeID; assign.WGR_ID = (long)edChild.EditValue; ClientEnvironment.HwgrToWgrService.Save(assign); m_assigned = new WgrTreeItem(assign, assign.HWGR_ID); break; case AssignEnum.ThisHwgrToWorld: WorldToHwgr assign2 = ClientEnvironment.WorldToHWGRService.CreateEntity(); assign2.BeginTime = BeginTime; assign2.EndTime = EndTime; assign2.HWGR_ID = (long)edChild.EditValue; assign2.Import = false; assign2.StoreID = m_storeID; assign2.WorldID = (Entity as WorldToHwgr).WorldID; ClientEnvironment.WorldToHWGRService.Save(assign2); m_assigned = new HwgrTreeItem(assign2, 0); break; case AssignEnum.WorldHwgrDisable: DateTime t1 = timeRange.BeginTime, t2 = timeRange.EndTime; Utility.AssignWeek(ref begin, ref end); timeRange.BeginTime = t1; timeRange.EndTime = t2; WorldToHwgr vice = Entity as WorldToHwgr; WorldToHwgr first = ClientEnvironment.WorldToHWGRService.FindById(vice.ID); first.BeginTime = timeRange.BeginTime; first.EndTime = timeRange.EndTime; ClientEnvironment.WorldToHWGRService.Update(first); break; case AssignEnum.HwgrWgrDisable: HwgrToWgr vice2 = Entity as HwgrToWgr; Domain.HwgrToWgr first2 = ClientEnvironment.HwgrToWgrService.FindById(vice2.ID); first2.EndTime = timeRange.EndTime; first2.BeginTime = timeRange.BeginTime; ClientEnvironment.HwgrToWgrService.Update(first2); break; } } catch (ValidationException) { XtraMessageBox.Show(Baumax.Localization.Localizer.GetLocalized("InvalidTimeRange")); return(false); }/* * catch (Exception ex) * { * XtraMessageBox.Show (ex.Message); * return false; * }*/ return(true); }
public override bool Commit () { try { DateTime begin = BeginTime, end = EndTime; Utility.AssignWeek (ref begin, ref end); BeginTime = begin; EndTime = end; switch (m_assignEnum) { case AssignEnum.ThisHwgrToWgr : case AssignEnum.ThisWgrToHWGR : HwgrToWgr assign = ClientEnvironment.HwgrToWgrService.CreateEntity(); assign.BeginTime = BeginTime; assign.EndTime = EndTime; assign.HWGR_ID = (long)edParent.EditValue; assign.Import = false; assign.StoreID = m_storeID; assign.WGR_ID = (long)edChild.EditValue; ClientEnvironment.HwgrToWgrService.Save (assign); m_assigned = new WgrTreeItem(assign, assign.HWGR_ID); break; case AssignEnum.ThisHwgrToWorld : WorldToHwgr assign2 = ClientEnvironment.WorldToHWGRService.CreateEntity(); assign2.BeginTime = BeginTime; assign2.EndTime = EndTime; assign2.HWGR_ID = (long)edChild.EditValue; assign2.Import = false; assign2.StoreID = m_storeID; assign2.WorldID = (Entity as WorldToHwgr).WorldID; ClientEnvironment.WorldToHWGRService.Save(assign2); m_assigned = new HwgrTreeItem(assign2, 0); break; case AssignEnum.WorldHwgrDisable: DateTime t1 = timeRange.BeginTime, t2 = timeRange.EndTime; Utility.AssignWeek(ref begin, ref end); timeRange.BeginTime = t1; timeRange.EndTime = t2; WorldToHwgr vice = Entity as WorldToHwgr; WorldToHwgr first = ClientEnvironment.WorldToHWGRService.FindById(vice.ID); first.BeginTime = timeRange.BeginTime; first.EndTime = timeRange.EndTime; ClientEnvironment.WorldToHWGRService.Update(first); break; case AssignEnum.HwgrWgrDisable: HwgrToWgr vice2 = Entity as HwgrToWgr; Domain.HwgrToWgr first2 = ClientEnvironment.HwgrToWgrService.FindById(vice2.ID); first2.EndTime = timeRange.EndTime; first2.BeginTime = timeRange.BeginTime; ClientEnvironment.HwgrToWgrService.Update(first2); break; } } catch(ValidationException) { XtraMessageBox.Show(Baumax.Localization.Localizer.GetLocalized("InvalidTimeRange")); return false; }/* catch (Exception ex) { XtraMessageBox.Show (ex.Message); return false; }*/ return true; }
public TreeViewItemViewModel(BaseTreeItem treeItem) : this(treeItem, null) { }
private TreeListNode GetNodeByEntity(BaseTreeItem entity) { TreeListNode ret_node = null; foreach(TreeListNode node in treeList.Nodes) if (entity == GetEntityByNode(node)) { ret_node = node; break; } return ret_node; }