public ActionResult CreateGroupTemplate(Guid id)
        {
            try
            {
                LcpsAdsGroup ou = new LcpsAdsGroup(id);
                GroupTemplate t = new GroupTemplate();
                t.GroupId = id;
                t.TemplateName = ou.Name;

                if (string.IsNullOrEmpty(ou.Description))
                    t.Description = "No aescription available";
                else
                    t.Description = ou.Description;

                DbContext.GroupTemplates.Add(t);
                DbContext.SaveChanges();

                return Content("Success", "text/html");
            }
            catch (Exception ex)
            {
                AnvilExceptionCollector ec = new AnvilExceptionCollector(ex);
                return Content(ec.ToUL(), "text/html");
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdgroupTemplate,FkGroup,FkTemplate,Priority,Active,FkRoutingGroup")] GroupTemplate groupTemplate)
        {
            if (id != groupTemplate.IdgroupTemplate)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(groupTemplate);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GroupTemplateExists(groupTemplate.IdgroupTemplate))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(groupTemplate));
        }
        public GroupTemplateViewModel(LcpsDbContext context, Guid id)
        {
            _dbContext = context;
            _currentTemplate = _dbContext.GroupTemplates.Find(id);

            LcpsAdsDomain dom = LcpsAdsDomain.Default;
            string d = dom.Name;
        }
Esempio n. 4
0
        public void InitTemplate()
        {
            int i = 0;

            foreach (Skill templateSkill in Template.TemplateSkills)
            {
                // vytvorit novy objekt skillu
                Skill newSkill = SkillTable.Instance.CreateSkill(templateSkill.GetSkillId());
                newSkill.SetOwner(this);

                Skills.AddSkill(newSkill);

                i++;
                //Debug.Log("adding to monster skill to " + i + ": " + newSkill.GetVisibleName());
            }

            if (Template.MeleeSkill != null)
            {
                Skill newSkill = SkillTable.Instance.CreateSkill(Template.MeleeSkill.GetSkillId());
                newSkill.SetOwner(this);

                MeleeSkill = (ActiveSkill)newSkill;
            }

            Template.InitSkillsOnMonster(Skills, MeleeSkill, Level);

            Template.InitMonsterStats(this, Level);

            Template.InitAppearanceData(this, GetData());

            HealMe();

            GroupTemplate gt = Template.GetGroupTemplate();

            if (!isMinion && gt != null)
            {
                AI.CreateGroup();
                foreach (KeyValuePair <MonsterId, int> e in gt.MembersToSpawn)
                {
                    for (i = 0; i < e.Value; i++)
                    {
                        Vector3 rndPos = Utils.GenerateRandomPositionAround(GetData().GetBody().transform.position, GetData().distanceToFollowLeader / 2f);

                        //TODO cannot change level of minions - add a parameter
                        Monster mon = GameSystem.Instance.SpawnMonster(e.Key, rndPos, true, 1);
                        mon.AI.JoinGroup(this);
                    }
                }
            }

            AI.InitModules();
            AI.AnalyzeSkills();

            if (Template.ShowNameInGame)
            {
                GetData().showObjectName = true;
            }
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("IdgroupTemplate,FkGroup,FkTemplate,Priority,Active,FkRoutingGroup")] GroupTemplate groupTemplate)
        {
            if (ModelState.IsValid)
            {
                _context.Add(groupTemplate);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(groupTemplate));
        }
Esempio n. 6
0
 protected override void visitGroupTemplateDeclaration(GroupTemplate declaration)
 {
     writer.Append(KeywordEnum.GROUP.ToString()).Append(' ');
     writer.AppendIdentifier(declaration).Append(' ');
     writer.Append(KeywordEnum.IS.ToString()).Append(" (");
     writer.AppendOutputEnums(declaration.EntityClasses, ", ");
     if (declaration.RepeatLast)
     {
         writer.Append(" <>");
     }
     writer.Append(");").NewLine();
 }
        public string RenderBoxedGroups(IEnumerable <IGrouping <int, Framework.Domain.MenuPrincipal> > groupedMenus, Framework.Domain.MenuPrincipal rootMenu)
        {
            StringBuilder boxedGroupshtml = new StringBuilder();

            IGrouping <int, Framework.Domain.MenuPrincipal> groupsNode = groupedMenus.FirstOrDefault(group => group.Key == rootMenu.ID);

            if (groupsNode == null)
            {
                return(string.Empty);
            }

            int boxCount = (int)Math.Ceiling((double)groupsNode.Count() / GroupsPerBox);

            for (int i = 0; i < boxCount; i++)
            {
                StringBuilder groupshtml = new StringBuilder();

                foreach (Framework.Domain.MenuPrincipal currentGroup in groupsNode.Skip(i * GroupsPerBox).Take(GroupsPerBox))
                {
                    string destino = string.Empty;

                    if (currentGroup.Destino == Core.Domain.Destino.Fancybox)
                    {
                        currentGroup.ClassedeEstiloCSS += " fancybox";
                        destino = "data-fancybox-type=\"iframe\"";
                    }
                    else if (currentGroup.Destino != Core.Domain.Destino.Invalido)
                    {
                        destino = string.Format("target=\"{0}\"", currentGroup.Destino.ToString());
                    }

                    IGrouping <int, Framework.Domain.MenuPrincipal> subitems = groupedMenus
                                                                               .FirstOrDefault(group => group.Key == currentGroup.ID);

                    string subitemsHtml = RenderSubMenus(groupedMenus, subitems);

                    groupshtml.Append(
                        GroupTemplate
                        .Replace("[Title]", currentGroup.Title)
                        .Replace("[Url]", currentGroup.URL)
                        .Replace("[ClassedeEstiloCSS]", currentGroup.ClassedeEstiloCSS)
                        .Replace("[Destino]", destino)
                        .Replace("{subitems}", subitemsHtml));
                }

                boxedGroupshtml.Append(
                    GroupBoxTemplate
                    .Replace("{groups}", groupshtml.ToString()));
            }

            return(boxedGroupshtml.ToString());
        }
Esempio n. 8
0
        public string RenderTemplate(DisplayGroup subject, HtmlRenderContext context)
        {
            // var self = context.Serializer.PortAsExpression(subject.Context.BindingLambda, "svm");

            var data = new GroupRenderData
            {
                Group = subject,
                StyleScript = (subject.Style == null) ? "null" : context.Serializer.RenderInstance(subject.Style),
                RenderContext = context
            };

            var tt = new GroupTemplate
            {
                Session = new Dictionary<string, object> { { "Data", data } }
            };
            tt.Initialize();
            return tt.TransformText();
        }
 public void Setup()
 {
     _sut = GroupTemplate.Create("MyGroupTemplate");
 }
Esempio n. 10
0
 public IEnumerable <IResourceGroup> GetGroups(IEnumerable <IResource> allResources, ResourceMode mode)
 {
     return(GroupTemplate.GetGroups(allResources.Exclude(_excludeFilter), mode));
 }
        public ActionResult EditTemplate(GroupTemplate m)
        {
            GroupTemplateViewModel oum = new GroupTemplateViewModel(DbContext);

            try
            {
                if (ModelState.IsValid)
                {
                    DbContext.Entry(m).State = System.Data.Entity.EntityState.Modified;
                    DbContext.SaveChanges();

                    return RedirectToAction("Index");
                }
                else
                {
                    return View();
                }
            }
            catch (Exception ex)
            {
                oum.Exception = ex;
                return View(oum);

            }
        }