private void btnSave_Click(object sender, EventArgs e) { var model = new GroupModel(); int.TryParse(txtID.Text, out int id); model.ID = id; model.GROUP_NAME = txtGROUP_NAME.Text; model.GROUP_DESC = txtGROUP_DESC.Text; if (model.Validate() == false) { MessageBox.Show(this, "All values are required", "Save Action failed !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } model.Save(); var grmodel = new GroupRoleModel(); grmodel.GROUP_NAME = model.GROUP_NAME; grmodel.DeleteByGROUP_NAME(); foreach (CheckBox role in flpRoles.Controls) { grmodel.ROLE_NAME = role.Text; grmodel.ID = -1; grmodel.Save(); } txtID.Text = model.ID.ToString(); txtGROUP_NAME.Focus(); txtGROUP_NAME.Select(); }
private void btnFind_Click(object sender, EventArgs e) { Form frm = new Form() { Text = "Search Groups", Size = new Size(500, 300), StartPosition = FormStartPosition.CenterParent }; frm.Controls.Add(new Common.CommonPickUpValueListUC() { Dock = DockStyle.Fill, Data = new GroupModel().All(), DisplayMember = "GROUP_NAME", OnSelected = delegate(object value) { frm.Close(); var model = (GroupModel)value; model.Select(); txtGROUP_NAME.Text = model.GROUP_NAME; txtGROUP_DESC.Text = model.GROUP_DESC; txtID.Text = model.ID.ToString(); var cmodel = new GroupRoleModel(); cmodel.GROUP_NAME = model.GROUP_NAME; var roles = cmodel.SearchByGROUP_NAME(); btnSelectNone_Click(null, null); foreach (var role in roles) { ((CheckBox)flpRoles.Controls[role.ROLE_NAME]).Checked = true; } } }); frm.ShowDialog(); }
public HttpResponseMessage GetGroup(HttpRequestMessage request, long groupId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; var groupModel = new GroupRoleModel(); Group group = _CoreService.GetGroup(groupId); GroupRoleData[] groupRoles = _CoreService.GetGroupRoles(groupId); groupModel.Group = group; groupModel.GroupRoles = groupRoles; // notice no need to create a seperate model object since Group entity will do just fine response = request.CreateResponse <GroupRoleModel>(HttpStatusCode.OK, groupModel); return response; })); }
private void MainForm_Load(object sender, EventArgs e) { var login = new LoginForm(); login.ShowDialog(); if (login.DialogResult == DialogResult.Abort) { Application.Exit(); } this.lstMenu.Items.Clear(); if (login.DialogResult == DialogResult.OK) { Session.Instance.CurrentUser = login.User; var roles = new GroupRoleModel() { GROUP_NAME = Session.Instance.CurrentUser.GROUP_NAME }.SearchByGROUP_NAME(); foreach (var role in roles) { this.lstMenu.Items.Add(role.ROLE_NAME); } } }
public IActionResult AddGroupRole([FromBody] GroupRoleModel model) { _user.AddGroupRole(model.RoleId, model.GroupId); return(Ok()); }