private void Start() { monitor_game = GameObject.FindWithTag("MonitorGame").GetComponent <MonitorGame>(); GameObject gameovercontroller = GameObject.FindWithTag("GameOverController"); beginGame = begin_gameObj.GetComponent <BeginGame>(); createMenu = gameovercontroller.GetComponent <CreateMenu>(); }
private List <Sprite> CreateSelectButton() { CreateMenu createMenu = new CreateMenu(); List <Sprite> listSelectButton = new List <Sprite>(); listSelectButton.Add(createMenu.NewButton("Orange").Item2); return(listSelectButton); }
private void Awake() { monitor_game = GameObject.FindWithTag("MonitorGame").GetComponent <MonitorGame>(); droneMovement = GetComponent <DroneMovement>(); currentHealth = startingHealth; GameObject gameovercontroller = GameObject.FindWithTag("GameOverController"); createMenu = gameovercontroller.GetComponent <CreateMenu>(); }
private Menu(CreateMenu cmd) : base(cmd.Id) { AddEvent(new MenuCreated { SiteId = cmd.SiteId, AggregateRootId = Id, Name = cmd.Name, Status = MenuStatus.Active }); }
private List <Sprite> CreateButton() { CreateMenu createMenu = new CreateMenu(); List <Sprite> listButton = new List <Sprite>(); listButton.Add(createMenu.NewButton("White").Item1); listButton[0].Scale = new Vector2f(3f, 2f); listButton[0].Position = new Vector2f(100f, 300f); return(listButton); }
public static Menu Menu(Guid siteId, Guid id, string name, string itemText, string itemTextLocalised, Guid menuItemId = new Guid(), Guid languageId = new Guid()) { if (menuItemId == Guid.Empty) { menuItemId = Guid.NewGuid(); } if (languageId == Guid.Empty) { languageId = Guid.NewGuid(); } var createCommand = new CreateMenu { SiteId = siteId, Id = id, Name = name }; var createValidatorMock = new Mock <IValidator <CreateMenu> >(); createValidatorMock.Setup(x => x.Validate(createCommand)).Returns(new ValidationResult()); var menu = Domain.Menus.Menu.CreateNew(createCommand, createValidatorMock.Object); var addItemCommand = new AddMenuItem { SiteId = menu.SiteId, MenuId = menu.Id, MenuItemId = menuItemId, Type = MenuItemType.Link, PageId = Guid.NewGuid(), Link = "link", Text = itemText, Title = "Title", MenuItemLocalisations = new List <MenuItemLocalisation> { new MenuItemLocalisation { LanguageId = languageId, Text = itemTextLocalised, Title = "Title 1" } } }; var addItemValidatorMock = new Mock <IValidator <AddMenuItem> >(); addItemValidatorMock.Setup(x => x.Validate(addItemCommand)).Returns(new ValidationResult()); menu.AddMenuItem(addItemCommand, addItemValidatorMock.Object); return(menu); }
public static MvcHtmlString GerarMenu(this HtmlHelper htmlHelper) { var menu = new CreateMenu().MontarMenu(); var html = new StringBuilder(); foreach (var item in menu) { html.AppendLine(GerarHtmlMenu(item, htmlHelper)); } return(MvcHtmlString.Create(html.ToString())); }
public void Setup() { _command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; _validatorMock = new Mock <IValidator <CreateMenu> >(); _validatorMock.Setup(x => x.Validate(_command)).Returns(new ValidationResult()); _menu = Menu.CreateNew(_command, _validatorMock.Object); _event = _menu.Events.OfType <MenuCreated>().SingleOrDefault(); }
public void CreateNewRoom() { if (RoomName.text == "") { PopupBackWindow.SetActive(true); ChangePopupBackText("You need to add a room name"); } else { CreateMenu.SetActive(false); CreateSettingMenu.SetActive(false); Scenario.SetActive(true); CreateMode.SetActive(true); } }
public void Should_throw_exception_when_deleting_main_menu() { var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "Main" }; var validatorMock = new Mock <IValidator <CreateMenu> >(); validatorMock.Setup(x => x.Validate(command)).Returns(new ValidationResult()); var menu = Menu.CreateNew(command, validatorMock.Object); Assert.Throws <Exception>(() => menu.Delete()); }
public void Should_have_validation_error_when_menu_name_is_empty() { var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "" }; var menuRulesMock = new Mock <IMenuRules>(); var siteRulesMock = new Mock <ISiteRules>(); var validator = new CreateMenuValidator(menuRulesMock.Object, siteRulesMock.Object); validator.ShouldHaveValidationErrorFor(x => x.Name, command); }
public void Should_set_menu_status_to_deleted() { var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; var validatorMock = new Mock <IValidator <CreateMenu> >(); validatorMock.Setup(x => x.Validate(command)).Returns(new ValidationResult()); var menu = Menu.CreateNew(command, validatorMock.Object); menu.Delete(); Assert.AreEqual(true, menu.Status == MenuStatus.Deleted); }
public static void Main(string[] args) { while (true) { try { Console.WriteLine("***********************************"); Console.WriteLine("---------------Main Menu-----------"); Console.WriteLine("***********************************"); Console.WriteLine("#1: Employee Management System"); Console.WriteLine("#2: Company Mangement System"); Console.WriteLine("#3: Client Mangement System"); Console.WriteLine("#4: Exit"); switch (Convert.ToInt32(Console.ReadLine())) { case 1: CreateMenu employeeMenu = new CreateMenu(); employeeMenu.EMSMenu(); break; case 2: CompanyMangementSystem displayCompany = new CompanyMangementSystem(); displayCompany.CompanyMangement(); break; case 3: ClientManagementSystem clientMangement = new ClientManagementSystem(); clientMangement.ClientMangement(); break; case 4: Environment.Exit(0); break; default: Console.WriteLine("Option not available"); break; } } catch (Exception) { Console.WriteLine("Invalid input"); } } }
public void Should_have_validation_error_when_site_does_not_exist() { var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; var menuRulesMock = new Mock <IMenuRules>(); var siteRulesMock = new Mock <ISiteRules>(); siteRulesMock.Setup(x => x.DoesSiteExist(command.SiteId)).Returns(false); var validator = new CreateMenuValidator(menuRulesMock.Object, siteRulesMock.Object); validator.ShouldHaveValidationErrorFor(x => x.SiteId, command); }
public void Should_have_validation_error_when_menu_id_already_exists() { var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; var menuRulesMock = new Mock <IMenuRules>(); menuRulesMock.Setup(x => x.IsMenuIdUnique(command.Id)).Returns(false); var siteRulesMock = new Mock <ISiteRules>(); var validator = new CreateMenuValidator(menuRulesMock.Object, siteRulesMock.Object); validator.ShouldHaveValidationErrorFor(x => x.Id, command); }
public void Should_have_validation_error_when_menu_name_is_not_valid() { var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My@Menu" }; var menuRulesMock = new Mock <IMenuRules>(); menuRulesMock.Setup(x => x.IsMenuNameValid(command.Name)).Returns(false); var siteRulesMock = new Mock <ISiteRules>(); var validator = new CreateMenuValidator(menuRulesMock.Object, siteRulesMock.Object); validator.ShouldHaveValidationErrorFor(x => x.Name, command); }
public IApiResult Create(CreateMenu operation) { var result = operation.ExecuteAsync().Result; if (result is ValidationsOutput) { return(new ApiResult <List <ValidationItem> >() { Data = ((ValidationsOutput)result).Errors }); } else { return(new ApiResult <object>() { Status = ApiResult <object> .ApiStatus.Success }); } }
public void Should_set_id_in_menu_deleted_event() { var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; var validatorMock = new Mock <IValidator <CreateMenu> >(); validatorMock.Setup(x => x.Validate(command)).Returns(new ValidationResult()); var menu = Menu.CreateNew(command, validatorMock.Object); menu.Delete(); var @event = menu.Events.OfType <MenuDeleted>().SingleOrDefault(); Assert.AreEqual(menu.Id, @event.AggregateRootId); }
public override void OnInspectorGUI() { Node node = target as Node; CreateMenu menuItem = (CreateMenu)node.GetType().GetCustomAttributes(typeof(CreateMenu), false)[0]; base.OnInspectorGUI(); node.OnCustomInspectorGUI(); if (menuItem.description != null) { GUILayout.Label(new GUIContent("Description: " + menuItem.description), EditorStyles.boldLabel); } if (Application.isPlaying) { if (GUILayout.Button(new GUIContent("Execute", "Will fire this node manually. This is great for testing."), GUILayout.Height(22.0f))) { node.Execute(); } } }
public void Should_throw_validation_exception_when_validation_fails() { var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; var menuRepositoryMock = new Mock <IMenuRepository>(); var validatorMock = new Mock <IValidator <CreateMenu> >(); validatorMock.Setup(x => x.Validate(command)).Returns(new ValidationResult(new List <ValidationFailure> { new ValidationFailure("Id", "Id Error") })); var createMenuHandler = new CreateMenuHandler(menuRepositoryMock.Object, validatorMock.Object); Assert.Throws <Exception>(() => createMenuHandler.Handle(command)); }
static void Main(string[] args) { // Lab_08.Composite е вмъкнат итератор var menu = CreateMenu.Get(); menu.Print(); var breakfast = menu.GetChild("Закуска"); var dinner = menu.GetChild("Вечеря"); var pankakes = (breakfast as Menu).GetChild("Палачинки"); var burgerT = (dinner as Menu).GetChild("Телешки бургер"); var order = new List <IMenuComponent> { pankakes, burgerT }; var waiter = new Client(order); waiter.PrintMenu(); }
/// <summary> /// Finds all types that have the CreateMenu /// attribute. These should be type of Node. /// </summary> /// <returns></returns> public static List <CreateMenu> FindNodeTypes() { List <CreateMenu> menuItems = new List <CreateMenu>(); foreach (Assembly assembly in System.AppDomain.CurrentDomain.GetAssemblies()) { foreach (System.Type type in assembly.GetTypes()) { if (type.GetCustomAttributes(typeof(CreateMenu), false).Length > 0) { CreateMenu menuItem = (CreateMenu)type.GetCustomAttributes(typeof(CreateMenu), false)[0]; menuItem.type = type; menuItems.Add(menuItem); } } } menuItems.Sort(NodifyEditorUtilities.CreateMenuSort); return(menuItems); }
public void Should_have_validation_error_when_menu_name_is_too_long() { var name = ""; for (int i = 0; i < 101; i++) { name += i; } var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = name }; var menuRulesMock = new Mock <IMenuRules>(); var siteRulesMock = new Mock <ISiteRules>(); var validator = new CreateMenuValidator(menuRulesMock.Object, siteRulesMock.Object); validator.ShouldHaveValidationErrorFor(x => x.Name, command); }
public void Should_validate_command_and_save_new_menu() { var command = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; var menuRepositoryMock = new Mock <IMenuRepository>(); menuRepositoryMock.Setup(x => x.Create(It.IsAny <Menu>())); var validatorMock = new Mock <IValidator <CreateMenu> >(); validatorMock.Setup(x => x.Validate(command)).Returns(new ValidationResult()); var createMenuHandler = new CreateMenuHandler(menuRepositoryMock.Object, validatorMock.Object); createMenuHandler.Handle(command); validatorMock.Verify(x => x.Validate(command)); menuRepositoryMock.Verify(x => x.Create(It.IsAny <Menu>())); }
public void Should_save_menu_when_reorder_menu_items() { var createMenuCommand = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; var createMenuValidatorMock = new Mock <IValidator <CreateMenu> >(); createMenuValidatorMock.Setup(x => x.Validate(createMenuCommand)).Returns(new ValidationResult()); var menu = Menu.CreateNew(createMenuCommand, createMenuValidatorMock.Object); var reorderMenuItemsCommand = new ReorderMenuItems { Id = Guid.NewGuid(), MenuItems = new List <ReorderMenuItems.MenuItem>() }; var menuRepositoryMock = new Mock <IMenuRepository>(); menuRepositoryMock.Setup(x => x.GetById(It.IsAny <Guid>())).Returns(menu); menuRepositoryMock.Setup(x => x.Update(It.IsAny <Menu>())); var validatorMock = new Mock <IValidator <ReorderMenuItems> >(); validatorMock.Setup(x => x.Validate(reorderMenuItemsCommand)).Returns(new ValidationResult()); var createMenuHandler = new ReorderMenuItemsHandler(menuRepositoryMock.Object, validatorMock.Object); createMenuHandler.Handle(reorderMenuItemsCommand); menuRepositoryMock.Verify(x => x.Update(It.IsAny <Menu>())); }
public void Setup() { var createMenuCommand = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; var createMenuValidatorMock = new Mock <IValidator <CreateMenu> >(); createMenuValidatorMock.Setup(x => x.Validate(createMenuCommand)).Returns(new ValidationResult()); _menu = Menu.CreateNew(createMenuCommand, createMenuValidatorMock.Object); var addMenuItem1 = new AddMenuItem { SiteId = _menu.SiteId, MenuId = _menu.Id, MenuItemId = Guid.NewGuid(), MenuItemType = MenuItemType.Page, PageId = Guid.NewGuid(), Text = "Menu Item 1" }; var addMenuItem2 = new AddMenuItem { SiteId = _menu.SiteId, MenuId = _menu.Id, MenuItemId = Guid.NewGuid(), MenuItemType = MenuItemType.Page, PageId = Guid.NewGuid(), Text = "Menu Item 2" }; var addMenuItem3 = new AddMenuItem { SiteId = _menu.SiteId, MenuId = _menu.Id, MenuItemId = Guid.NewGuid(), MenuItemType = MenuItemType.Page, PageId = Guid.NewGuid(), Text = "Menu Item 3" }; var addMenuItemValidatorMock = new Mock <IValidator <AddMenuItem> >(); addMenuItemValidatorMock.Setup(x => x.Validate(addMenuItem1)).Returns(new ValidationResult()); addMenuItemValidatorMock.Setup(x => x.Validate(addMenuItem2)).Returns(new ValidationResult()); addMenuItemValidatorMock.Setup(x => x.Validate(addMenuItem3)).Returns(new ValidationResult()); _menu.AddMenuItem(addMenuItem1, addMenuItemValidatorMock.Object); _menu.AddMenuItem(addMenuItem2, addMenuItemValidatorMock.Object); _menu.AddMenuItem(addMenuItem3, addMenuItemValidatorMock.Object); _command = new ReorderMenuItems { Id = _menu.Id, MenuItems = new List <ReorderMenuItems.MenuItem> { new ReorderMenuItems.MenuItem { Id = addMenuItem1.MenuItemId }, new ReorderMenuItems.MenuItem { Id = addMenuItem3.MenuItemId, ParentId = addMenuItem1.MenuItemId }, new ReorderMenuItems.MenuItem { Id = addMenuItem2.MenuItemId, ParentId = addMenuItem1.MenuItemId } } }; var validatorMock = new Mock <IValidator <ReorderMenuItems> >(); validatorMock.Setup(x => x.Validate(_command)).Returns(new ValidationResult()); _menu.ReorderMenuItems(_command, validatorMock.Object); _menuItem1 = _menu.MenuItems.FirstOrDefault(x => x.Id == addMenuItem1.MenuItemId); _menuItem2 = _menu.MenuItems.FirstOrDefault(x => x.Id == addMenuItem2.MenuItemId); _menuItem3 = _menu.MenuItems.FirstOrDefault(x => x.Id == addMenuItem3.MenuItemId); }
public void Should_update_menu_when_remove_menu_item() { var createMenuCommand = new CreateMenu { SiteId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "My Menu" }; var createMenuValidatorMock = new Mock <IValidator <CreateMenu> >(); createMenuValidatorMock.Setup(x => x.Validate(createMenuCommand)).Returns(new ValidationResult()); var menu = Menu.CreateNew(createMenuCommand, createMenuValidatorMock.Object); var addMenuItemCommand = new AddMenuItem { SiteId = menu.SiteId, MenuId = menu.Id, MenuItemId = Guid.NewGuid(), MenuItemType = MenuItemType.Link, PageId = Guid.NewGuid(), Link = "link", Text = "Text", Title = "Title", MenuItemLocalisations = new List <MenuItemDetails.MenuItemLocalisation> { new MenuItemDetails.MenuItemLocalisation { LanguageId = Guid.NewGuid(), Text = "Text 1", Title = "Title 1" }, new MenuItemDetails.MenuItemLocalisation { LanguageId = Guid.NewGuid(), Text = "Text 2", Title = "Title 2" } } }; var addMenuItemValidatorMock = new Mock <IValidator <AddMenuItem> >(); addMenuItemValidatorMock.Setup(x => x.Validate(addMenuItemCommand)).Returns(new ValidationResult()); menu.AddMenuItem(addMenuItemCommand, addMenuItemValidatorMock.Object); var command = new RemoveMenuItem { MenuId = menu.Id, MenuItemId = menu.MenuItems.FirstOrDefault().Id }; var menuRepositoryMock = new Mock <IMenuRepository>(); menuRepositoryMock.Setup(x => x.GetById(It.IsAny <Guid>())).Returns(menu); menuRepositoryMock.Setup(x => x.Update(It.IsAny <Menu>())); var validatorMock = new Mock <IValidator <RemoveMenuItem> >(); validatorMock.Setup(x => x.Validate(command)).Returns(new ValidationResult()); var createMenuHandler = new RemoveMenuItemHandler(menuRepositoryMock.Object, validatorMock.Object); createMenuHandler.Handle(command); menuRepositoryMock.Verify(x => x.Update(It.IsAny <Menu>())); }
public void ActiveMenus(bool _menu, bool _create, bool _play) { MainMenu.SetActive(_menu); CreateMenu.SetActive(_create); PlayMenu.SetActive(_play); }
public GetMenuExampleTests(BaseSetup fixture) { fixtures = fixture; steps = new CreateMenu(fixture.SeleniumWrapper); }
/// <summary> /// Sorts the create menu using the Uri scheme. /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> public static int CreateMenuSort(CreateMenu a, CreateMenu b) { Uri p1 = new Uri(Uri.EscapeUriString("file://" + a.path.Replace(" ", string.Empty))); Uri p2 = new Uri(Uri.EscapeUriString("file://" + b.path.Replace(" ", string.Empty))); return Uri.Compare(p1, p2, UriComponents.Path, UriFormat.Unescaped, StringComparison.OrdinalIgnoreCase); }
public static Menu CreateNew(CreateMenu cmd, IValidator <CreateMenu> validator) { validator.ValidateCommand(cmd); return(new Menu(cmd)); }
public async Task<ActionResult> Index() { serviceId = "AC"; serviceSort = 10000; if (serviceDao.Entities.Where(m => m.Id == serviceId).Count() > 0) { return Content("数据库中已经存在数据库,不需要重新生成。"); } //部门 CreateDepartment(); var service = new CreateService(serviceId, "统一授权中心", 1, "http://int.zhongyi-itl.com/"); await this.commandService.Execute(service); var user = new CreateUser("sysadmin", "系统管理员", "Sysadmin", "*****@*****.**", "15817439909", "系统管理员"); await this.commandService.Execute(user); var role = new CreateRole("系统管理员", 0); await this.commandService.Execute(role); await this.commandService.Execute(new SetUserRoles(user.AggregateRootId, new string[] { role.AggregateRootId })); var menu = new CreateMenu("统一授权中心", (int)MenuType.Web, "", "", serviceSort); await this.commandService.Execute(menu); var menuRoot = menu.AggregateRootId; var module = new CreateModule(serviceId, "System", "系统管理", serviceSort); await this.commandService.Execute(module); var moduleId = module.AggregateRootId; menu = new CreateMenu("系统管理", (int)MenuType.Web, "", "", serviceSort + 10, menuRoot); await this.commandService.Execute(menu); var menuId = menu.AggregateRootId; string moduleId2 = await QuickModule("Sys", "Department", "部门信息", moduleId, menuId, 11); var permission = new CreatePermission("DepartmentUser", "设置用户", moduleId2); await this.commandService.Execute(permission); //角色管理 module = new CreateModule(serviceId, "Role", "角色管理", serviceSort + 16, moduleId); await this.commandService.Execute(module); permission = new CreatePermission("ViewRole", "查看", module.AggregateRootId); await this.commandService.Execute(permission); var viewRolePermissionId = permission.AggregateRootId; menu = new CreateMenu("角色管理", (int)MenuType.Web, "Sys/RoleList.aspx", "", serviceSort + 16, menuId, permission.AggregateRootId); await this.commandService.Execute(menu); permission = new CreatePermission("NewRole", "新增", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("ModifyRole", "编辑", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("DeleteRole", "删除", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("PermissionRole", "分配权限", module.AggregateRootId); await this.commandService.Execute(permission); await this.commandService.Execute(new SetRolePermissions(role.AggregateRootId, new string[] { viewRolePermissionId, permission.AggregateRootId })); //用户管理 moduleId2 = await QuickModule("Sys", "User", "用户管理", moduleId, menuId, 21); await this.commandService.Execute(permission); permission = new CreatePermission("ChangePwdUser", "修改密码", moduleId2); await this.commandService.Execute(permission); permission = new CreatePermission("RoleUser", "分配角色", moduleId2); await this.commandService.Execute(permission); await QuickModule("Sys", "Service", "服务管理", moduleId, menuId, 26); await QuickModule("Sys", "Module", "模块管理", moduleId, menuId, 31); await QuickModule("Sys", "Menu", "菜单管理", moduleId, menuId, 36); await QuickModule("Sys", "Authority", "权限管理", moduleId, menuId, 41); CreateRole(); return Content(""); }
private async void QuickFileModule(string moduleCode, string moduleName, string moduleParentId, string menuParentId, int sort) { var module = new CreateModule(serviceId, moduleCode, moduleName, serviceSort + sort, moduleParentId); await this.commandService.Execute(module); var permission = new CreatePermission("Use" + moduleCode, "使用", module.AggregateRootId); await this.commandService.Execute(permission); var menu = new CreateMenu(moduleName, (int)MenuType.Web, "HardDisk/" + moduleCode + "aspx", "", serviceSort + sort, menuParentId, permission.AggregateRootId); await this.commandService.Execute(menu); permission = new CreatePermission("Upload" + moduleCode, "上传文件", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("ModifyFile" + moduleCode, "编辑文件名", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("DeleteFile" + moduleCode, "删除文件", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("MoveFile" + moduleCode, "移动文件", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("NewFolder" + moduleCode, "新建文件夹", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("ModifyFolder" + moduleCode, "编辑文件夹", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("DeleteFolder" + moduleCode, "删除文件夹", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("MoveFolder" + moduleCode, "移动文件夹", module.AggregateRootId); await this.commandService.Execute(permission); }
//private async void QuickModuleGroup(string moduleCode, string moduleName, string moduleParentId, string menuParentId, int sort, out string moduleId, out string menuId) //{ // var module = new CreateModule(serviceId, moduleCode, moduleName, serviceSort + sort, moduleParentId); // await this.commandService.Execute(module); // moduleId = module.AggregateRootId; // var menu = new CreateMenu(moduleName, (int)MenuType.Web, "", "", serviceSort + sort, menuParentId); // await this.commandService.Execute(menu); // menuId = menu.AggregateRootId; //} private async Task<string> QuickModule(string folder, string moduleCode, string moduleName, string moduleParentId, string menuParentId, int sort, bool canExport = false) { var module = new CreateModule(serviceId, moduleCode, moduleName, serviceSort + sort, moduleParentId); var result = await this.commandService.Execute(module); if (result.Status == CommandStatus.Success) { var permission = new CreatePermission("View" + moduleCode, "查看", module.AggregateRootId); result = await this.commandService.Execute(permission); if (result.Status == CommandStatus.Success) { var menu = new CreateMenu(moduleName, (int)MenuType.Web, folder + "/" + moduleCode + "List.aspx", "", serviceSort + sort, menuParentId, permission.AggregateRootId); await this.commandService.Execute(menu); } permission = new CreatePermission("New" + moduleCode, "新增", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("Modify" + moduleCode, "编辑", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("Delete" + moduleCode, "删除", module.AggregateRootId); await this.commandService.Execute(permission); if (canExport) { permission = new CreatePermission("Upload" + moduleCode, "上传", module.AggregateRootId); await this.commandService.Execute(permission); permission = new CreatePermission("Download" + moduleCode, "下载", module.AggregateRootId); await this.commandService.Execute(permission); } } return module.AggregateRootId; }