コード例 #1
0
ファイル: UCEditWgrToHwgr.cs プロジェクト: 5509850/baumax
        public override bool Commit()
        {
            if (IsValid())
            {
                if (IsModified())
                {
                    HwgrToWgr entity = new HwgrToWgr();
                    CopyEntity(EntityHwgrToWgr, entity);
                    
                    entity.WGR_ID = WgrId;
                    entity.HWGR_ID = HwgrId;
                    entity.BeginTime = BeginTime;
                    entity.EndTime = EndTime;
                    
                    try
                    {
                        List<HwgrToWgr> lst =  ClientEnvironment.HwgrToWgrService.InsertRelation (entity);
                        
                        Context.TakeStoreStructure.MergeHwgrToWgr(lst);

                        CopyEntity(entity, EntityHwgrToWgr);
                        EntityHwgrToWgr.WgrName = wgrLookUpCtrl.Text;
                        Modified = true;

                        return base.Commit();
                    }
                    catch (ValidationException)
                    {
                        ErrorMessage(GetLocalized("ErrorDateRangeIntersect"));
                        return false;
                    }
                }
                else return base.Commit();

            }
            return false;
        }
コード例 #2
0
ファイル: UCAttachWgr.cs プロジェクト: 5509850/baumax
 public override bool Commit()
 {
     try
     {
         HwgrToWgr attach = ClientEnvironment.HwgrToWgrService.CreateEntity();
         attach.BeginTime = uc.BeginTime;
         attach.EndTime = uc.EndTime;
         attach.WGR_ID = (long)EditWgr.EditValue;
         attach.Import = false;
         attach.StoreID = m_hwgr.ID;
         m_entityName = EditWgr.Text;
         m_attached = attach = ClientEnvironment.HwgrToWgrService.SaveOrUpdate(attach);
     }
     catch(EntityException e)
     {
         ProcessEntityException(e);
         return false;
     }
     return true;
 }
コード例 #3
0
ファイル: UCEditWgrToHwgr.cs プロジェクト: 5509850/baumax
        private void CopyEntity(HwgrToWgr source, HwgrToWgr dest)
        {
            dest.ID = source.ID;
            dest.HWGR_ID = source.HWGR_ID;
            dest.WgrName = source.WgrName;
            dest.Import = source.Import;
            dest.StoreID = source.StoreID;
            dest.WGR_ID = source.WGR_ID;
            dest.BeginTime = source.BeginTime;
            dest.EndTime = source.EndTime;

        }
コード例 #4
0
ファイル: UCStoreTree.cs プロジェクト: 5509850/baumax
        public void NewAssignWgrToHwgr()
        {
            WgrTreeItem item = null;

            if (IsWgrFocused) item = FocusedEntity as WgrTreeItem;

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

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

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


        }