public void AddHttpPost_ForGroup_ReturnActionResult() { // Arrange InitializeHttpAdd(); var controller = new GroupController(); var group = new Models.Group() { CustomerID = GroupId, UpdatedUserID = GroupId, FolderID = GroupId, GroupName = FolderName, MasterSupression = 0, CreatedUserID = GroupId, PublicFolder = 1, AllowUDFHistory = UdfHistory, IsSeedList = false }; // Act var result = controller.Add(group) as JsonResult; // Assert result.ShouldSatisfyAllConditions( () => result.ShouldNotBeNull(), () => result.Data.ShouldNotBeNull()); }
public void Add_ForAccessedUser_ReturnActionResult() { // Arrange InitializeAdd(); var controller = new GroupController(); // Act var result = controller.Add() as ViewResult; // Assert result.ShouldSatisfyAllConditions( () => result.ShouldNotBeNull(), () => result.View.ShouldBeNull(), () => result.MasterName.ShouldBe(string.Empty)); }
private void 添加分组ToolStripMenuItem_Click(object sender, EventArgs e) { frmGroup frm = new frmGroup(); if (frm.ShowDialog() == DialogResult.OK) { TreeNode _tr = tv_menu.Nodes["node_xxdy"]; TreeNode _newGroupNode = new TreeNode(); _newGroupNode.Text = frm.GetGroupName(); _newGroupNode.Name = frm.GetGroupName(); _tr.Nodes.Add(_newGroupNode); Group _group = new Group(frm.GetGroupName()); GroupController _controller = new GroupController(_group); _controller.Add(); } }
public int? SaveGroup( int groupTypeId, string name, int? parentGroupId = null, bool isSystem = false, int? campusId = null, string description = null, bool isSecurityRole = false, bool isActive = true, int order = 0, string foreignId = null, int? groupId = null ) { Group group = null; GroupController controller = new GroupController( Service ); if ( groupId != null ) { group = controller.GetById( (int)groupId ); if ( groupId == null ) { return null; } } else { group = new Group(); } group.IsSystem = isSystem; group.ParentGroupId = parentGroupId; group.GroupTypeId = groupTypeId; group.CampusId = campusId; group.Name = name; group.Description = description; group.IsSecurityRole = isSecurityRole; group.IsActive = isActive; group.Order = order; group.ForeignId = foreignId; if ( groupId == null ) { group.CreatedByPersonAliasId = Service.LoggedInPerson.PrimaryAliasId; controller.Add( group ); } else { group.ModifiedByPersonAliasId = Service.LoggedInPerson.PrimaryAliasId; controller.Update( group ); } group = controller.GetByGuid( group.Guid ); return group.Id; }
private void buttonAdd_Click(object sender, EventArgs e) { Controller.Add(textBoxName.Text, Convert.ToInt16(comboBoxYear.SelectedItem.ToString())); refreshForm(dataGridView, TextBoxes); }