コード例 #1
0
        internal IFacadeUpdateResult <SetupMenuData> SaveSetupMenu(SetupMenuDto dto)
        {
            ArgumentValidator.IsNotNull("dto", dto);

            FacadeUpdateResult <SetupMenuData> result = new FacadeUpdateResult <SetupMenuData>();
            ISetupMenuService service  = UnitOfWork.GetService <ISetupMenuService>();
            SetupMenu         instance = RetrieveOrNew <SetupMenuData, SetupMenu, ISetupMenuService>(result.ValidationResult, dto.Id);

            if (result.IsSuccessful)
            {
                instance.Name         = dto.Name;
                instance.ParentMenuId = dto.ParentMenuId;
                instance.MenuText     = dto.MenuText;
                instance.Tooltip      = dto.Tooltip;
                instance.NavigateUrl  = dto.NavigateUrl;
                instance.Sort         = dto.Sort;
                instance.MenuTypeId   = dto.MenuTypeId;

                var saveQuery = service.Save(instance);

                result.AttachResult(instance.RetrieveData <SetupMenuData>());
                result.Merge(saveQuery);
            }

            return(result);
        }
コード例 #2
0
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         SetupMenuFacade facade   = new SetupMenuFacade(uow);
         SetupMenuDto    instance = facade.RetrieveOrNewSetupMenu(InstanceId);
         CurrentInstance         = instance;
         ucIEdit.CurrentInstance = instance;
     }
 }
コード例 #3
0
 public IFacadeUpdateResult<SetupMenuData> SaveSetupMenu(SetupMenuDto dto)
 {
     UnitOfWork.BeginTransaction();
     IFacadeUpdateResult<SetupMenuData> result = SetupMenuSystem.SaveSetupMenu(dto);
     if (result.IsSuccessful)
     {
         UnitOfWork.CommitTransaction();
     }
     else
     {
         UnitOfWork.RollbackTransaction();
     }
     return result;
 }
コード例 #4
0
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                SetupMenuDto    project = e.Instance as SetupMenuDto;
                SetupMenuFacade facade  = new SetupMenuFacade(uow);
                IFacadeUpdateResult <SetupMenuData> result = facade.SaveSetupMenu(project);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    CurrentInstances = facade.RetrieveAllSetupMenu();
                    // Refresh global cache
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
コード例 #5
0
        protected void ucIEdit_InstanceSaving(object sender, InstanceSavingEventArgs e)
        {
            SetupMenuDto instance = e.Instance as SetupMenuDto;

            if (instance != null)
            {
                using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
                {
                    SetupMenuFacade facade = new SetupMenuFacade(uow);
                    IFacadeUpdateResult <SetupMenuData> result = facade.SaveSetupMenu(instance);
                    e.IsSuccessful = result.IsSuccessful;
                    if (result.IsSuccessful)
                    {
                        // Refresh Instance
                        CurrentInstance = result.ToDto <SetupMenuDto>(new SetupMenuConverter());
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result.ValidationResult, result.Exception);
                    }
                }
            }
        }