private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         SetupMenuFacade facade = new SetupMenuFacade(uow);
         CurrentInstances = facade.RetrieveAllSetupMenu();
     }
 }
示例#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;
     }
 }
        protected void ucIList_InstanceRowDeleting(object sender, InstanceRowDeletingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                SetupMenuFacade facade = new SetupMenuFacade(uow);
                IFacadeUpdateResult <SetupMenuData> result = facade.DeleteSetupMenu(e.Instance.Id);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    CurrentInstances = facade.RetrieveAllSetupMenu();
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
示例#4
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);
                    }
                }
            }
        }
        private IList <BindingListItem> GetBindingList(string subjectType)
        {
            IList <BindingListItem> dataSource = null;

            switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), subjectType))
            {
            case InstanceTypes.Customer:
                CustomerSystem sys = new CustomerSystem(UnitOfWork);
                dataSource = sys.GetBindingList();
                break;

            case InstanceTypes.Contact:
                ContactSystem contactSystem = new ContactSystem(UnitOfWork);
                dataSource = contactSystem.GetBindingList();
                break;

            case InstanceTypes.Product:
                ProductSystem productSystem = new ProductSystem(UnitOfWork);
                dataSource = productSystem.GetBindingList();
                break;

            case InstanceTypes.Supplier:
                SupplierSystem supplierSystem = new SupplierSystem(UnitOfWork);
                dataSource = supplierSystem.GetBindingList();
                break;

            case InstanceTypes.Catalog:
                CatalogSystem catalogSystem = new CatalogSystem(UnitOfWork);
                dataSource = catalogSystem.GetBindingList();
                break;

            case InstanceTypes.Employee:
                EmployeeSystem employeeSystem = new EmployeeSystem(UnitOfWork);
                dataSource = employeeSystem.GetBindingList();
                break;

            case InstanceTypes.Document:
                DocumentSystem docSystem = new DocumentSystem(UnitOfWork);
                dataSource = docSystem.GetBindingList();
                break;

            case InstanceTypes.User:
                UserFacade facade = new UserFacade(UnitOfWork);
                dataSource = facade.GetBindingList();
                break;

            case InstanceTypes.Language:
                LanguageFacade languageFacade = new LanguageFacade(UnitOfWork);
                dataSource = languageFacade.GetBindingList();
                break;

            case InstanceTypes.Domain:
                DomainFacade domainFacade = new DomainFacade(UnitOfWork);
                dataSource = domainFacade.GetBindingList();
                break;

            case InstanceTypes.MainMenu:
                MainMenuFacade mainMenuFacade = new MainMenuFacade(UnitOfWork);
                dataSource = mainMenuFacade.GetBindingList();
                break;

            case InstanceTypes.SetupMenu:
                SetupMenuFacade setupMenuFacade = new SetupMenuFacade(UnitOfWork);
                dataSource = setupMenuFacade.GetBindingList();
                break;

            case InstanceTypes.ShipTo:
                ShipToFacade shipTofacade = new ShipToFacade(UnitOfWork);
                dataSource = shipTofacade.GetBindingList();
                break;

            case InstanceTypes.SellingPeriod:
                SellingPeriodFacade sellingPeriodfacade = new SellingPeriodFacade(UnitOfWork);
                dataSource = sellingPeriodfacade.GetBindingList();
                break;

            case InstanceTypes.UserMatch:
                dataSource = GetUserMatch();
                break;
            }

            return(dataSource);
        }