Esempio n. 1
0
 /// <summary>
 /// Add button click event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddRole_Activate(object sender, EventArgs e)
 {
     RoleEditor roleEditor = new RoleEditor(project);
     if (roleEditor.ShowDialog() == DialogResult.OK)
     {
         iCampaign.TACS.Data.RolesDs.RolesRow row =
             roleTable.NewRolesRow();
         row.AccessLevel = (int)roleEditor.Role.AccessLevel;
         row.RoleName = roleEditor.Role.Name;
         row.Project = project;
         roleTable.AddRolesRow(row);
         UpdateRoles();
         GetRoles();
     }
     roleEditor.Close();
 }
Esempio n. 2
0
        /// <summary>
        /// Open role in editor.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void roleView_DoubleClick(object sender, EventArgs e)
        {
            //  Get the list item and determine record to edit
            ListViewItem item = roleView.SelectedItems[0];
            long roleId = Convert.ToInt64(item.Name);
            iCampaign.TACS.Role role = new iCampaign.TACS.Role();
            int rowNum = -1;

            //  Find the record in the data table
            for (int x = 0; x < roleTable.Rows.Count; ++x)
            {
                iCampaign.TACS.Data.RolesDs.RolesRow row = roleTable[x];
                if (row.RoleId == roleId)
                {
                    role.Name = row.RoleName;
                    role.AccessLevel = (iCampaign.TACS.AccessLevelEnum)row.AccessLevel;
                    rowNum = x;
                }
            }

            //  Edit the role record
            RoleEditor roleEditor = new RoleEditor(project, role);
            if (roleEditor.ShowDialog() == DialogResult.OK)
            {
                iCampaign.TACS.Data.RolesDs.RolesRow row = roleTable[rowNum];
                row.RoleName = roleEditor.Role.Name;
                row.AccessLevel = (int)roleEditor.Role.AccessLevel;

                //  Save the changes and refresh the list view control
                UpdateRoles();
                GetRoles();
            }
            roleEditor.Close();
        }