Пример #1
0
        public void NewAssignHwgrToWorld()
        {
            HwgrTreeItem item = null;

            if (IsHwgrFocused)
            {
                item = FocusedEntity as HwgrTreeItem;
            }

            WorldToHwgr newitem = new WorldToHwgr();

            newitem.StoreID = m_context.Store.ID;
            if (item != null)
            {
                newitem.HWGR_ID   = item.Hwgr.HWGR_ID;
                newitem.WorldID   = item.Hwgr.WorldID;
                newitem.BeginTime = DateTimeHelper.GetNextMonday(DateTime.Today);
                newitem.EndTime   = DateTimeSql.SmallDatetimeMax;
            }
            else
            {
                newitem.BeginTime = DateTime.Today;
                newitem.EndTime   = DateTimeSql.SmallDatetimeMax;
                newitem.HWGR_ID   = m_context.WorldToHwgr.HWGR_ID;
                newitem.WorldID   = m_context.WorldToHwgr.WorldID;
            }

            using (FormAssignHwgrToWorld form = new FormAssignHwgrToWorld())
            {
                form.Context = m_context;
                form.Entity  = newitem;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    treeList.BeginUpdate();
                    m_context.TakeStoreStructure.ReBuildByHwgr(newitem.HWGR_ID, (treeList.DataSource as BindingTemplate <BaseTreeItem>));
                    EntityChanged();
                    treeList.EndUpdate();
                }
            }
        }
Пример #2
0
        public void NewAssignHwgrToWorld()
        {
            HwgrTreeItem item = null;

            if (IsHwgrFocused) item = FocusedEntity as HwgrTreeItem;

            WorldToHwgr newitem = new WorldToHwgr();
            newitem.StoreID = m_context.Store.ID;
            if (item != null)
            {
                newitem.HWGR_ID = item.Hwgr.HWGR_ID;
                newitem.WorldID = item.Hwgr.WorldID;
                newitem.BeginTime = DateTimeHelper.GetNextMonday(DateTime.Today);
                newitem.EndTime = DateTimeSql.SmallDatetimeMax;
            }
            else
            {
                newitem.BeginTime = DateTime.Today;
                newitem.EndTime = DateTimeSql.SmallDatetimeMax;
                newitem.HWGR_ID = m_context.WorldToHwgr.HWGR_ID;
                newitem.WorldID = m_context.WorldToHwgr.WorldID;
            }

            using (FormAssignHwgrToWorld form = new FormAssignHwgrToWorld())
            {
                form.Context = m_context;
                form.Entity = newitem;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    treeList.BeginUpdate();
                    m_context.TakeStoreStructure.ReBuildByHwgr (newitem.HWGR_ID, (treeList.DataSource as BindingTemplate<BaseTreeItem>));
                    EntityChanged();
                    treeList.EndUpdate();
                }
            }
        }