Rev | Line | |
---|
[4590] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.ComponentModel;
|
---|
| 4 | using System.Data;
|
---|
| 5 | using System.Drawing;
|
---|
| 6 | using System.Linq;
|
---|
| 7 | using System.Text;
|
---|
| 8 | using System.Windows.Forms;
|
---|
| 9 | using HeuristicLab.Services.Authentication.DataTransfer;
|
---|
| 10 |
|
---|
| 11 | namespace HeuristicLab.Services.Authentication.TestClient
|
---|
| 12 | {
|
---|
| 13 |
|
---|
| 14 | public enum RoleDetailMode
|
---|
| 15 | {
|
---|
| 16 | Insert,
|
---|
| 17 | Update
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | public partial class RoleDetail : Form
|
---|
| 21 | {
|
---|
| 22 |
|
---|
| 23 | private RoleDetailMode mode;
|
---|
| 24 | private AuthenticationService service;
|
---|
| 25 | private Role role;
|
---|
| 26 |
|
---|
| 27 | public RoleDetail(RoleDetailMode mode, AuthenticationService service,Role role)
|
---|
| 28 | {
|
---|
| 29 | InitializeComponent();
|
---|
| 30 |
|
---|
| 31 | this.mode = mode;
|
---|
| 32 | this.service = service;
|
---|
| 33 |
|
---|
| 34 | if (role == null)
|
---|
| 35 | {
|
---|
| 36 | role = new Role();
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | this.role = role;
|
---|
| 40 | this.bsRole.DataSource = role;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | private void btnSave_Click(object sender, EventArgs e)
|
---|
| 45 | {
|
---|
| 46 | if (mode == RoleDetailMode.Insert)
|
---|
| 47 | {
|
---|
| 48 | if (this.service.InsertRole(role))
|
---|
| 49 | {
|
---|
| 50 | this.Close();
|
---|
| 51 | }
|
---|
| 52 | }
|
---|
| 53 | else if (mode == RoleDetailMode.Update)
|
---|
| 54 | {
|
---|
| 55 | if(this.service.UpdateRole(role)){
|
---|
| 56 | this.Close();
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.