Exemplo n.º 1
0
        protected virtual double SetMeasuredAutoLength(ContainerView containerView, GridTrack gridTrack, double value)
        {
            Debug.Assert(value - gridTrack.MeasuredLength > 0);
            var delta = gridTrack.SetMeasuredLength(value);

            gridTrack.Owner.TotalAutoLength += delta;
            return(delta);
        }
        private void styleView()
        {
            TitleLabel.Font       = Styles.SetBoldFont(13);
            DateLabel.Font        = Styles.SetRegularFont(13);
            DescriptionLabel.Font = Styles.SetRegularFont(13);
            DateLabel.TextColor   = UIColor.LightGray;

            ContainerView.setBorderShadow();
        }
        protected void OnClosedContainer(ContainerView containerView)
        {
            var containerWindow = m_ContainerWindows[containerView.ID];

            if (containerWindow)
            {
                Destroy(containerWindow.gameObject);
            }
        }
Exemplo n.º 4
0
        public DynamicSplitViewController(UIViewController first, UIViewController second)
        {
            this.First    = first;
            this.Second   = second;
            containerView = new ContainerView(this);
            Splitter      = new SplitterView();

            containerView.BackgroundColor = first.View.BackgroundColor;
        }
Exemplo n.º 5
0
        public IHttpActionResult Create(ContainerView NewContainerView)
        {
            NewContainerView.Create(_Repository);

            return(Created <ContainerView>(
                       Request.RequestUri + "/" + NewContainerView.ViewID.ToString(),
                       NewContainerView
                       ));
        }
Exemplo n.º 6
0
        public override void PresentationTransitionWillBegin()
        {
            dimmingView.Frame = ContainerView.Bounds;
            ContainerView.AddSubview(dimmingView);

            var transitionCoordinaotr = PresentingViewController.GetTransitionCoordinator();

            transitionCoordinaotr.AnimateAlongsideTransition(context => dimmingView.Alpha = 0.8f, null);
        }
Exemplo n.º 7
0
 private void DisposeGestures()
 {
     if (_cellTapGesture != null)
     {
         ContainerView.RemoveGestureRecognizer(_cellTapGesture);
         _cellTapGesture.Dispose();
         _cellTapGesture = null;
     }
 }
		public DynamicSplitViewController (UIViewController first, UIViewController second)
		{
			this.First = first;
			this.Second = second;
			containerView = new ContainerView (this);
			Splitter = new SplitterView ();

			containerView.BackgroundColor = first.View.BackgroundColor;
		}
Exemplo n.º 9
0
        private void UpdateAutoSize(ContainerView containerView, Binding binding, Size measuredSize)
        {
            Debug.Assert(binding.IsAutoSize);
            var gridRange      = binding.GridRange;
            var measuredWidth  = gridRange.GetMeasuredWidth(x => !x.IsAutoLength);
            var measuredHeight = gridRange.GetMeasuredHeight(x => !x.IsAutoLength);

            UpdateAutoSize(containerView, binding.AutoWidthGridColumns, measuredWidth, binding.AutoHeightGridRows, measuredHeight, measuredSize);
        }
Exemplo n.º 10
0
        void ReleaseDesignerOutlets()
        {
            if (BackForwardToolBarItem != null)
            {
                BackForwardToolBarItem.Dispose();
                BackForwardToolBarItem = null;
            }

            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }

            if (LoggedInLabel != null)
            {
                LoggedInLabel.Dispose();
                LoggedInLabel = null;
            }

            if (RefreshToolBarItem != null)
            {
                RefreshToolBarItem.Dispose();
                RefreshToolBarItem = null;
            }

            if (SearchFieldCell != null)
            {
                SearchFieldCell.Dispose();
                SearchFieldCell = null;
            }

            if (SearchRecordsField != null)
            {
                SearchRecordsField.Dispose();
                SearchRecordsField = null;
            }

            if (SearchToolBarItem != null)
            {
                SearchToolBarItem.Dispose();
                SearchToolBarItem = null;
            }

            if (ServerToolBarItem != null)
            {
                ServerToolBarItem.Dispose();
                ServerToolBarItem = null;
            }

            if (NetworkStatus != null)
            {
                NetworkStatus.Dispose();
                NetworkStatus = null;
            }
        }
Exemplo n.º 11
0
        public override void PresentationTransitionWillBegin()
        {
            base.PresentationTransitionWillBegin();

            dimmingView.Frame = ContainerView.Bounds;
            dimmingView.Alpha = 0;

            ContainerView.InsertSubview(dimmingView, 0);
            SetAplhaOnTransitionBegin(1);
        }
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();

     FlyingObjects = new FlyingObjectsView(View.Frame);
            View.InsertSubview(FlyingObjects, 0);

     AddChildViewController(ContainerNavigationController);
     ContainerView.AddSubview(ContainerNavigationController.View);
     ContainerView.AddConstraint(NSLayoutConstraint.Create(ContainerNavigationController.View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0));
     ContainerView.AddConstraint(NSLayoutConstraint.Create(ContainerNavigationController.View, NSLayoutAttribute.Right, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Right, 1, 0));
     ContainerView.AddConstraint(NSLayoutConstraint.Create(ContainerNavigationController.View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0));
     ContainerView.AddConstraint(NSLayoutConstraint.Create(ContainerNavigationController.View, NSLayoutAttribute.Left, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Left, 1, 0));
            ContainerNavigationController.View.TranslatesAutoresizingMaskIntoConstraints = false;

            ContainerViewTopMarginConstraint.Constant = UIApplication.SharedApplication.StatusBarFrame.Height;

           
        }
Exemplo n.º 13
0
        protected void OnClosedContainer(ContainerView containerView)
        {
            var containerWindow = _containerWindows[containerView.Id];

            if (containerWindow)
            {
                containerWindow.CloseWithoutNotifying();
                _containerWindows[containerView.Id] = null;
            }
        }
Exemplo n.º 14
0
        protected void OnAddedObject(ContainerView _, int index, ObjectInstance @object)
        {
            index -= m_ContainerView.IndexOfFirstObject;

            var itemView = m_ItemViews[index];

            itemView.itemImage.enabled = true;
            itemView.showAmount        = @object.Data > 1;
            itemView.objectAmount      = (int)@object.Data;
        }
Exemplo n.º 15
0
        private void PopulateWorkspace()
        {
            Model model = _workspace.Model;

            model.Enterprise = new Enterprise("Some Enterprise");

            Person         user           = model.AddPerson(Location.Internal, "User", "");
            SoftwareSystem softwareSystem = model.AddSoftwareSystem(Location.Internal, "Software System", "");

            user.Uses(softwareSystem, "Uses");

            SoftwareSystem emailSystem = model.AddSoftwareSystem(Location.External, "E-mail System", "");

            softwareSystem.Uses(emailSystem, "Sends e-mail using");
            emailSystem.Delivers(user, "Delivers e-mails to");

            Container webApplication = softwareSystem.AddContainer("Web Application", "", "");
            Container database       = softwareSystem.AddContainer("Database", "", "");

            user.Uses(webApplication, "Uses", "HTTP");
            webApplication.Uses(database, "Reads from and writes to", "JDBC");
            webApplication.Uses(emailSystem, "Sends e-mail using");

            Component controller     = webApplication.AddComponent("SomeController", "", "Spring MVC Controller");
            Component emailComponent = webApplication.AddComponent("EmailComponent", "");
            Component repository     = webApplication.AddComponent("SomeRepository", "", "Spring Data");

            user.Uses(controller, "Uses", "HTTP");
            controller.Uses(repository, "Uses");
            controller.Uses(emailComponent, "Sends e-mail using");
            repository.Uses(database, "Reads from and writes to", "JDBC");
            emailComponent.Uses(emailSystem, "Sends e-mails using", "SMTP");

            EnterpriseContextView enterpriseContextView = _workspace.Views.CreateEnterpriseContextView("enterpriseContext", "");

            enterpriseContextView.AddAllElements();

            SystemContextView systemContextView = _workspace.Views.CreateSystemContextView(softwareSystem, "systemContext", "");

            systemContextView.AddAllElements();

            ContainerView containerView = _workspace.Views.CreateContainerView(softwareSystem, "containers", "");

            containerView.AddAllElements();

            ComponentView componentView = _workspace.Views.CreateComponentView(webApplication, "components", "");

            componentView.AddAllElements();

            DynamicView dynamicView = _workspace.Views.CreateDynamicView(webApplication, "dynamic", "");

            dynamicView.Add(user, "Requests /something", controller);
            dynamicView.Add(controller, repository);
            dynamicView.Add(repository, "select * from something", database);
        }
Exemplo n.º 16
0
        // before transition start
        public override void PresentationTransitionWillBegin()
        {
            if (!ContainerView.Subviews.Any())
            {
                ContainerView.InsertSubview(_overlayView, 0);
            }

            PresentingViewController.GetTransitionCoordinator()?.AnimateAlongsideTransition(
                obj => _overlayView.Alpha = 1f, obj => { }
                );
        }
Exemplo n.º 17
0
        public override void PresentationTransitionWillBegin()
        {
            base.PresentationTransitionWillBegin();

            ContainerView.AddSubview(DimmedBackgroundView);
            DimmedBackgroundView.Alpha = 0;

            var coordinator = PresentingViewController.GetTransitionCoordinator();

            coordinator.AnimateAlongsideTransition(_ => DimmedBackgroundView.Alpha = DimmedBackgroundTranslucentAlpha, null);
        }
Exemplo n.º 18
0
 protected void OnRemovedObject(ContainerView _, int index, ObjectInstance appendObject)
 {
     index -= _containerView.IndexOfFirstObject;
     for (int i = index; i < _containerView.NumberOfTotalObjects; i++)
     {
         var @object  = _containerView.GetObject(i + _containerView.IndexOfFirstObject);
         var itemView = _itemViews[i];
         itemView.itemImage.enabled = true;
         itemView.showAmount        = @object.Data > 1;
         itemView.objectAmount      = (int)@object.Data;
     }
 }
Exemplo n.º 19
0
    private void OnContainerSelectedEvent(ContainerView container)
    {
        m_hpBarTransform.gameObject.SetActive(true);

        if (selections.ContainsKey(container))
        {
            selections[container].SetActive(true);
            return;
        }

        GenerateNewSelection(container);
    }
        protected void OnAddedContainer(ContainerView containerView)
        {
            var containerWindow = Instantiate(ModulesManager.Instance.ContainerWindowPrefab);

            containerWindow.UpdateProperties(containerView);

            var gameWindowLayout = OpenTibiaUnity.GameManager.GetModule <GameWindow.GameInterface>();

            gameWindowLayout.AddMiniWindow(containerWindow);

            m_ContainerWindows[containerView.ID] = containerWindow;
        }
Exemplo n.º 21
0
        private void ViewModel_OnRotatedImage(object sender, EventArgs e)
        {
            NbRotations++;
            var degrees = NbRotations * 90 * (nfloat)Math.PI / 180;
            var frame   = _imageView.Frame;

            _imageView.RemoveFromSuperview();
            _imageView.Transform = CGAffineTransform.MakeRotation(degrees);
            _imageView.Frame     = new CGRect(frame.X, frame.Y, frame.Height, frame.Width);
            ContainerView.Add(_imageView);
            ContainerView.ContentSize = _imageView.Frame.Size;
        }
Exemplo n.º 22
0
        protected virtual void CoerceCurrentRowView(RowView oldValue)
        {
            Debug.Assert(ContainerViewList.Count > 0);
            Debug.Assert(oldValue != null);
            Debug.Assert(CurrentContainerView == GetContainerView(oldValue));

            var oldPlacement = CurrentContainerViewPlacement;
            var newPlacement = GetContainerViewPlacement(CurrentRow);

            if (IsIsolated(oldPlacement))
            {
                if (IsIsolated(newPlacement))
                {
                    CurrentContainerView.ReloadCurrentRow(oldValue.RowPresenter);
                    if (oldPlacement != newPlacement)
                    {
                        ContainerViewList.VirtualizeAll();
                        newPlacement = CurrentContainerViewPlacement.Alone;
                    }
                }
                else
                {
                    var newValue = CurrentRow.View;
                    Swap(oldValue, newValue);
                    var removalIndex = HeadScalarElementsCount;
                    if (CurrentContainerViewPlacement == CurrentContainerViewPlacement.AfterList)
                    {
                        removalIndex += ContainerViewList.Count;
                    }
                    Cleanup((ContainerView)Elements[removalIndex]);
                    ElementCollection.RemoveAt(removalIndex);
                }
            }
            else
            {
                if (IsIsolated(newPlacement))
                {
                    Debug.Assert(CurrentRow.View == null);
                    var containerView = Setup(CurrentRow);
                    Debug.Assert(CurrentRow.View != null);
                    var insertIndex = HeadScalarElementsCount;
                    if (newPlacement == CurrentContainerViewPlacement.AfterList)
                    {
                        insertIndex += ContainerViewList.Count;
                    }
                    ElementCollection.Insert(insertIndex, containerView);
                }
                Swap(oldValue, CurrentRow.View);
            }

            CurrentContainerView          = GetContainerView(CurrentRow.View);
            CurrentContainerViewPlacement = newPlacement;
        }
Exemplo n.º 23
0
        public void Test_AddSoftwareSystem_ThrowsAnException_WhenTheSoftwareSystemIsTheScopeOfTheView()
        {
            SoftwareSystem softwareSystem = Model.AddSoftwareSystem("Software System");

            view = new ContainerView(softwareSystem, "containers", "Description");
            try {
                view.Add(softwareSystem);
                throw new TestFailedException();
            } catch (ElementNotPermittedInViewException e) {
                Assert.Equal("The software system in scope cannot be added to a container view.", e.Message);
            }
        }
        void AddViewsToDimmingView()
        {
            if (TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Regular &&
                TraitCollection.VerticalSizeClass == UIUserInterfaceSizeClass.Regular)
            {
                dimmingView.AddSubviews(bigFlowerImageView, carlImageView);
            }

            dimmingView.AddSubviews(topJaguarPrintImageView,
                                    bottomJaguarPrintImageView, leftJaguarPrintImageView, rightJaguarPrintImageView);

            ContainerView.AddSubview(dimmingView);
        }
Exemplo n.º 25
0
        private double GetRelativePositionMain(ContainerView containerView, GridTrack gridTrack, double fraction)
        {
            Debug.Assert(gridTrack.IsContainer);
            Debug.Assert(fraction >= 0 && fraction <= 1);

            var result = GetRelativePositionMain(containerView, gridTrack);

            if (fraction > 0)
            {
                result += new LogicalMainTrack(gridTrack, containerView).Length *fraction;
            }
            return(result);
        }
        void ReleaseDesignerOutlets()
        {
            if (ImageLabel != null)
            {
                ImageLabel.Dispose();
                ImageLabel = null;
            }

            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }
        }
Exemplo n.º 27
0
        void ReleaseDesignerOutlets()
        {
            if (TabBarContainer != null)
            {
                TabBarContainer.Dispose();
                TabBarContainer = null;
            }

            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }
        }
Exemplo n.º 28
0
        protected void OnAddedObject(ContainerView _, int index, ObjectInstance @object)
        {
            index -= _containerView.IndexOfFirstObject;
            for (int i = index; i < _containerView.NumberOfTotalObjects; i++)
            {
                @object = _containerView.GetObject(i + _containerView.IndexOfFirstObject);
                var itemView = _itemViews[i];
                itemView.image.enabled = true;
                itemView.showAmount    = @object.Data > 1;
                itemView.objectAmount  = (int)@object.Data;
            }

            CalculatePreferedHeight(_containerView.NumberOfTotalObjects);
        }
Exemplo n.º 29
0
        void ReleaseDesignerOutlets()
        {
            if (SearchBar != null)
            {
                SearchBar.Dispose();
                SearchBar = null;
            }

            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }
        }
Exemplo n.º 30
0
        void ReleaseDesignerOutlets()
        {
            if (appraisalDate != null)
            {
                appraisalDate.Dispose();
                appraisalDate = null;
            }

            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }

            if (Mileage != null)
            {
                Mileage.Dispose();
                Mileage = null;
            }

            if (sacComment != null)
            {
                sacComment.Dispose();
                sacComment = null;
            }

            if (SacCommentsWidth != null)
            {
                SacCommentsWidth.Dispose();
                SacCommentsWidth = null;
            }

            if (Trim != null)
            {
                Trim.Dispose();
                Trim = null;
            }

            if (Vin != null)
            {
                Vin.Dispose();
                Vin = null;
            }

            if (YearMakeModel != null)
            {
                YearMakeModel.Dispose();
                YearMakeModel = null;
            }
        }
Exemplo n.º 31
0
        void ReleaseDesignerOutlets()
        {
            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }

            if (GroupName != null)
            {
                GroupName.Dispose();
                GroupName = null;
            }
        }
        public ActionResult Delete(long structureId, long id, ContainerView containerView, FormCollection formCollection)
        {
            try
            {
                var dataBaseManager = HttpContext.Items["DataBaseManager"] as DataBaseManager;

                dataBaseManager.Container.Delete(containerView);

                return RedirectToAction("Index", "Structure", new {id = structureId});
            }
            catch (Exception)
            {
                return View();
            }
        }
        public ActionResult Create(long structureId, long? parent, ContainerView container)
        {
            try
            {
                var dataBaseManager = HttpContext.Items["DataBaseManager"] as DataBaseManager;

                dataBaseManager.Container.Create(container, structureId, parent);

                return RedirectToAction("Index", "Structure", new {id = structureId});
            }
            catch (Exception)
            {
                //return View();
                throw;
            }
        }
Exemplo n.º 34
0
        public void Create(ContainerView containerView, long structure, long? parent)
        {
            if (containerView == null) throw new ArgumentNullException("containerView");

            var container = containerView.Convert();

            if (parent != null)
            {
                var parentobj = _dbContext.Containers.Find(parent);

                container.ContainerPrototype = parentobj.ContainerPrototype.Childs.First();
                container.ParentContainer = parentobj;
            }
            else
            {
                container.ContainerPrototype =
                    _dbContext.ContainerPrototypes.Where(cp => cp.StructureId == structure && cp.Parent == null).
                        SingleOrDefault();
            }

            _dbContext.Containers.Add(container);

            _dbContext.SaveChanges();

            //TODO return container view
            containerView.Id = container.Id;

            //TODO
            try
            {
                InvokeOnCreateContainer(container);
            }
            catch
            {
                //TODO ROLLBACK
                throw;
            }
        }
Exemplo n.º 35
0
        public void ShouldTestBasicFeatures()
        {
            DataBaseManager.Initializer();
            using (var dataBaseManager = new DataBaseManager())
            {
                #region CREATE_SERVICES

                var serviceManager = new ServiceManager(dataBaseManager);

                var serviceGit = new ServiceView()
                                     {
                                         Name = "Git",
                                         Description = "System Version Control (decentralized)"
                                     };

                serviceManager.Create(serviceGit, new[] {"r", "rw"});

                var serviceSvn = new ServiceView()
                                     {
                                         Name = "Svn",
                                         Description = "System Version Control (Centralized)"
                                     };

                serviceManager.Create(serviceSvn, new[] {"r", "rw"});

                #endregion

                #region CREATE_USERS

                var userManager = new UserManager(dataBaseManager);

                var userFaustino = new UserView()
                                       {
                                           Name = "FaustinoLeiras",
                                           Email = "*****@*****.**",
                                           Password = "******"
                                       };

                userManager.Create(userFaustino);

                var userSamir = new UserView()
                                    {
                                        Name = "SamirHafez",
                                        Email = "*****@*****.**",
                                        Password = "******"
                                    };

                userManager.Create(userSamir);

                var userRicardo = new UserView()
                                      {
                                          Name = "Ricardo",
                                          Email = "*****@*****.**",
                                          Password = "******"
                                      };

                userManager.Create(userRicardo);

                var userGeada = new UserView()
                                    {
                                        Name = "Gueada",
                                        Email = "*****@*****.**",
                                        Password = "******"
                                    };

                userManager.Create(userGeada);

                var userFelix = new UserView()
                                    {
                                        Name = "Felix",
                                        Email = "*****@*****.**",
                                        Password = "******"
                                    };

                userManager.Create(userFelix);

                var userGuedes = new UserView()
                                     {
                                         Name = "Guedes",
                                         Email = "*****@*****.**",
                                         Password = "******"
                                     };

                userManager.Create(userGuedes);

                #endregion

                #region CREATE_STRUCTURE

                var structureManager = new StructureManager(dataBaseManager);

                var structure = new StructureView()
                                    {
                                        Name = "AcademicStructure",
                                        Description = "My Academic Structure :)"
                                    };

                structureManager.Create(structure, userFaustino.Name);

                #endregion

                #region CREATE_WORKSPACE_TYPE

                var workspaceType = new WorkSpaceTypeManager(dataBaseManager);

                var workspacePublic = new WorkSpaceTypeView()
                                          {
                                              Name = "public"
                                          };

                workspaceType.Create(workspacePublic, structure.Id, new[] {serviceGit.Name, serviceSvn.Name});

                var workspacePrivate = new WorkSpaceTypeView()
                                           {
                                               Name = "private"
                                           };

                workspaceType.Create(workspacePrivate, structure.Id, new[] {serviceGit.Name, serviceSvn.Name});

                #endregion

                #region CREATE_CONTAINER_PROTOTYPE

                var containerPrototype = new ContainerPrototypeManager(dataBaseManager);

                var prototypeGraduation = new ContainerPrototypeView()
                                              {
                                                  Name = "Graduation"
                                              };

                containerPrototype.Create(prototypeGraduation, structure.Id);

                var prototypeCourse = new ContainerPrototypeView()
                                          {
                                              Name = "Course"
                                          };

                containerPrototype.Create(prototypeCourse, structure.Id, prototypeGraduation.Name);

                var prototypeClass = new ContainerPrototypeView()
                                         {
                                             Name = "Class"
                                         };

                containerPrototype.Create(prototypeClass, structure.Id, prototypeCourse.Name);

                var prototypeGroup = new ContainerPrototypeView()
                                         {
                                             Name = "Group"
                                         };

                containerPrototype.Create(prototypeGroup, structure.Id, prototypeClass.Name);

                #endregion

                #region ADD_WORKSPACE_TYPES_INTO_CONTAINER_PROTOTYPE

                containerPrototype.AddWorkSpaceType(structure.Id, prototypeGraduation.Name, workspacePublic.Name);

                containerPrototype.AddWorkSpaceType(structure.Id, prototypeCourse.Name, workspacePublic.Name);

                containerPrototype.AddWorkSpaceType(structure.Id, prototypeClass.Name, workspacePublic.Name);
                containerPrototype.AddWorkSpaceType(structure.Id, prototypeClass.Name, workspacePrivate.Name);

                containerPrototype.AddWorkSpaceType(structure.Id, prototypeGroup.Name, workspacePublic.Name);

                #endregion

                #region CREATE_ROLETYPE

                var roleType = new RoleTypeManager(dataBaseManager);

                var roleTypeTeacher = new RoleTypeView()
                                          {
                                              Name = "teacher"
                                          };

                roleType.Create(roleTypeTeacher, structure.Id);

                var roleTypeDirector = new RoleTypeView()
                                           {
                                               Name = "director"
                                           };

                roleType.Create(roleTypeDirector, structure.Id);

                var roleTypeStudant = new RoleTypeView()
                                          {
                                              Name = "studant"
                                          };

                roleType.Create(roleTypeStudant, structure.Id);

                #endregion

                #region CREATE_RULE

                var rule = new RuleManager(dataBaseManager);

                var ruleReaders = new RuleView()
                                      {
                                          Name = "readers"
                                      };

                rule.Create(ruleReaders, structure.Id, new[]
                                                           {
                                                               new KeyValuePair<string, string>(serviceGit.Name, "r"),
                                                               new KeyValuePair<string, string>(serviceSvn.Name, "r")
                                                           });

                var ruleReadersAndWriters = new RuleView()
                                                {
                                                    Name = "ReadersAndWriters"
                                                };

                rule.Create(ruleReadersAndWriters, structure.Id, new[]
                                                                     {
                                                                         new KeyValuePair<string, string>(
                                                                             serviceGit.Name,
                                                                             "rw"),
                                                                         new KeyValuePair<string, string>(
                                                                             serviceSvn.Name,
                                                                             "rw")
                                                                     });

                #endregion

                #region CREATE_ROLE

                var role = new RoleManager(dataBaseManager);

                #region ADD_ROLES_COURSE_WORKSPACE_PUBLIC

                role.Create(
                    structure.Id,
                    prototypeCourse.Name,
                    workspacePublic.Name,
                    roleTypeDirector.Name,
                    ruleReadersAndWriters.Name
                    );

                role.Create(
                    structure.Id,
                    prototypeCourse.Name,
                    workspacePublic.Name,
                    roleTypeTeacher.Name,
                    ruleReaders.Name
                    );

                role.Create(
                    structure.Id,
                    prototypeCourse.Name,
                    workspacePublic.Name,
                    roleTypeStudant.Name,
                    ruleReaders.Name
                    );

                #endregion

                #region ADD_ROLES_CLASS_WORKSPACE_PUBLIC

                role.Create(
                    structure.Id,
                    prototypeClass.Name,
                    workspacePublic.Name,
                    roleTypeDirector.Name,
                    ruleReaders.Name
                    );

                role.Create(
                    structure.Id,
                    prototypeClass.Name,
                    workspacePublic.Name,
                    roleTypeTeacher.Name,
                    ruleReadersAndWriters.Name
                    );

                role.Create(
                    structure.Id,
                    prototypeClass.Name,
                    workspacePublic.Name,
                    roleTypeStudant.Name,
                    ruleReaders.Name
                    );

                #endregion

                #region ADD_ROLES_CLASS_WORKSPACE_PRIVATE

                role.Create(
                    structure.Id,
                    prototypeClass.Name,
                    workspacePrivate.Name,
                    roleTypeDirector.Name,
                    ruleReaders.Name
                    );

                role.Create(
                    structure.Id,
                    prototypeClass.Name,
                    workspacePrivate.Name,
                    roleTypeTeacher.Name,
                    ruleReadersAndWriters.Name
                    );

                #endregion

                #region ADD_ROLES_GROUP_WORKSPACE_PUBLIC

                role.Create(
                    structure.Id,
                    prototypeGroup.Name,
                    workspacePublic.Name,
                    roleTypeDirector.Name,
                    ruleReaders.Name
                    );

                role.Create(
                    structure.Id,
                    prototypeGroup.Name,
                    workspacePublic.Name,
                    roleTypeTeacher.Name,
                    ruleReadersAndWriters.Name
                    );

                role.Create(
                    structure.Id,
                    prototypeGroup.Name,
                    workspacePublic.Name,
                    roleTypeStudant.Name,
                    ruleReadersAndWriters.Name
                    );

                #endregion

                #endregion

                #region CREATE_CONTAINERS

                var container = new ContainerManager(dataBaseManager);

                var containerLeic = new ContainerView()
                                        {
                                            Name = "LEIC",
                                            Description = "Licencitura Egenharia informatica e de computadores"
                                        };

                container.Create(containerLeic, structure.Id, prototypeGraduation.Name);

                #region CREATE_COURSE_MPD

                var containerMpd = new ContainerView()
                                       {
                                           Name = "MPD",
                                           Description = "Modelo de padoes de desenho"
                                       };

                container.Create(containerMpd, structure.Id, prototypeCourse.Name, containerLeic.Id);

                var containerMpdLi31D = new ContainerView()
                                            {
                                                Name = "LI31D",
                                                Description = "Turma 1 de terceiro semestre diurno"
                                            };

                container.Create(containerMpdLi31D, structure.Id, prototypeClass.Name, containerMpd.Id);

                var containerMpdG1 = new ContainerView()
                                         {
                                             Name = "Grupo1",
                                             Description = "Grupo de MPD"
                                         };

                container.Create(containerMpdG1, structure.Id, prototypeGroup.Name, containerMpdLi31D.Id);

                var containerMpdG2 = new ContainerView()
                                         {
                                             Name = "Grupo2",
                                             Description = "Grupo de MPD"
                                         };

                container.Create(containerMpdG2, structure.Id, prototypeGroup.Name, containerMpdLi31D.Id);

                #endregion

                #region CREATE_COURSE_SD

                var containerSd = new ContainerView()
                                      {
                                          Name = "SD",
                                          Description = "Sistemas distribuidos"
                                      };

                container.Create(containerSd, structure.Id, prototypeCourse.Name, containerLeic.Id);

                var containerSdLi31D = new ContainerView()
                                           {
                                               Name = "LI31D",
                                               Description = "Turma 1 de terceiro semestre diurno"
                                           };

                container.Create(containerSdLi31D, structure.Id, prototypeClass.Name, containerSd.Id);

                var containerSdG1 = new ContainerView()
                                        {
                                            Name = "Grupo1",
                                            Description = "Grupo de SD"
                                        };

                container.Create(containerSdG1, structure.Id, prototypeGroup.Name, containerSdLi31D.Id);

                var containerSdG2 = new ContainerView()
                                        {
                                            Name = "Grupo2",
                                            Description = "Grupo de SD"
                                        };

                container.Create(containerSdG2, structure.Id, prototypeGroup.Name, containerSdLi31D.Id);

                #endregion

                #endregion

                #region ENROLL_USER

                userManager.Enroll(userFelix.Name, structure.Id, containerLeic.Id, roleTypeDirector.Name);

                userManager.Enroll(userFelix.Name, structure.Id, containerMpd.Id, roleTypeDirector.Name);
                userManager.Enroll(userGuedes.Name, structure.Id, containerSd.Id, roleTypeDirector.Name);

                userManager.Enroll(userFelix.Name, structure.Id, containerSdLi31D.Id, roleTypeTeacher.Name);
                userManager.Enroll(userGuedes.Name, structure.Id, containerMpdLi31D.Id, roleTypeTeacher.Name);

                userManager.Enroll(userFaustino.Name, structure.Id, containerMpdG1.Id, roleTypeStudant.Name);
                userManager.Enroll(userSamir.Name, structure.Id, containerMpdG1.Id, roleTypeStudant.Name);

                userManager.Enroll(userRicardo.Name, structure.Id, containerMpdG2.Id, roleTypeStudant.Name);
                userManager.Enroll(userGeada.Name, structure.Id, containerMpdG2.Id, roleTypeStudant.Name);

                userManager.Enroll(userFaustino.Name, structure.Id, containerSdG1.Id, roleTypeStudant.Name);
                userManager.Enroll(userRicardo.Name, structure.Id, containerSdG1.Id, roleTypeStudant.Name);

                userManager.Enroll(userGeada.Name, structure.Id, containerSdG2.Id, roleTypeStudant.Name);
                userManager.Enroll(userSamir.Name, structure.Id, containerSdG2.Id, roleTypeStudant.Name);

                #endregion

                //AuthorizationTestes aut = new AuthorizationTestes();
                //AuthorizationManager authorizationManager = new AuthorizationManager(dataBaseManager);

                //authorizationManager.CreateServiceAuthorizationStruct(aut, serviceSvn.Name);
            }
        }
        public ActionResult Create(long structureId, long? parent)
        {
            var container = new ContainerView();

            return View(container);
        }
Exemplo n.º 37
0
        public void Delete(ContainerView containerView)
        {
            //_dbContext.Entry(_dbContext.Containers.Find(containerView.Id)).State = EntityState.Deleted;

            _dbContext.Containers.Remove(_dbContext.Containers.Find(containerView.Id));

            _dbContext.SaveChanges();
        }
Exemplo n.º 38
0
        public void Create(ContainerView containerView, long structure, string containerPrototype, long parentContainer)
        {
            if (containerView == null) throw new ArgumentNullException("containerView");

            var container = containerView.Convert();

            var containerPrototypeObj = ContainerPrototypeManager.Get(_dbContext, structure, containerPrototype);
            if (containerPrototypeObj == null) throw new ArgumentException("Invalid argument");

            var parentContainerObj = Get(_dbContext, parentContainer);
            if (containerPrototypeObj.Parent.Name != parentContainerObj.ContainerPrototype.Name) throw new Exception();

            container.ParentContainer = parentContainerObj;

            container.ContainerPrototype = containerPrototypeObj;

            _dbContext.Containers.Add(container);

            _dbContext.SaveChanges();

            //TODO return container view
            containerView.Id = container.Id;

            //TODO
            try
            {
                InvokeOnCreateContainer(container);
            }
            catch
            {
                //TODO ROLLBACK
                throw;
            }
        }