コード例 #1
0
ファイル: RoleEditor.cs プロジェクト: cspot/TACS.NET-Manager
        /// <summary>
        /// Initialize instance of role editor form.
        /// </summary>
        /// <param name="project">string: Project name.</param>
        /// <param name="role">iCampaign.TACS.Role: object.</param>
        public RoleEditor(string project, iCampaign.TACS.Role role)
        {
            //  Initialize form controls
            InitializeComponent();
            this.Text = project + " - Role";

            //  Load the role object onto the form
            _Role = role;
            tbRole.Text = this.Role.Name;
            cbAccess.SelectedIndex = (int)this.Role.AccessLevel;
        }
コード例 #2
0
ファイル: Access.cs プロジェクト: cspot/TACS.NET-Manager
        /// <summary>
        /// Get requested TACS.NET user profile from server.
        /// </summary>
        /// <param name="user">string: Username of profile.</param>
        /// <param name="role">string: Caller role being used.</param>
        /// <param name="credentials">iCampaign.TACS.Client.Credentials: object.</param>
        /// <returns>iCampaign.TACS.UserProfile</returns>
        public iCampaign.TACS.UserProfile GetUserProfile(string user, string role,
            iCampaign.TACS.Client.Credentials credentials)
        {
            //  Instantiate objects we will need
            UserProfile profile = null;
            AccessServiceProxy.AccessService accessService =
                new iCampaign.TACS.AccessServiceProxy.AccessService();

            //  Call the service and request user profile
            try
            {
                profile = accessService.GetUserProfile(user, role, credentials);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            //  Check message for status
            if (profile.ErrorMessage != "OK")
            {
                throw new System.Exception(profile.ErrorMessage);
            }
            return profile;
        }
コード例 #3
0
ファイル: TacsSession.cs プロジェクト: cspot/TACS.NET-Manager
        /// <summary>
        /// Returns the access level description.
        /// </summary>
        /// <param name="access">iCampaign.TACS.AccessLevelEnum: enumeration.</param>
        /// <returns></returns>
        internal static string GetAccessLevel(iCampaign.TACS.AccessLevelEnum access)
        {
            string result = String.Empty;

            switch (access)
            {
                case iCampaign.TACS.AccessLevelEnum.Administrator:
                    result = "Administrator";
                    break;
                case iCampaign.TACS.AccessLevelEnum.DataReader:
                    result = "Data Reader";
                    break;
                case iCampaign.TACS.AccessLevelEnum.DataWriter:
                    result = "Data Writer";
                    break;
                case iCampaign.TACS.AccessLevelEnum.NoAccess:
                    result = "No Access";
                    break;
                case iCampaign.TACS.AccessLevelEnum.Owner:
                    result = "Database Owner";
                    break;
            }
            return result;
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: cspot/TACS.NET-Manager
 /// <summary>
 /// Display the contents of the data table in the users dockable window.
 /// </summary>
 /// <param name="dataTable"></param>
 private void RefreshUserNodes(iCampaign.TACS.Data.UserDs.UsersDataTable dataTable)
 {
     foreach (iCampaign.TACS.Data.UserDs.UsersRow row in dataTable)
     {
         TreeNode node = new TreeNode();
         node.Name = row.Username;
         node.Text = row.Username + " (" + row.FullName + ")";
         node.SelectedImageIndex = 2;
         node.ImageIndex = 2;
         treeUser.Nodes.Add(node);
     }
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: cspot/TACS.NET-Manager
 /// <summary>
 /// Display the contents of the data table in the projects dockable window.
 /// </summary>
 /// <param name="dataTable">iCampaign.TACS.Data.ProjectsDs.ProjectsDataTable</param>
 private void RefreshProjNodes(iCampaign.TACS.Data.ProjectsDs.ProjectsDataTable dataTable)
 {
     foreach (iCampaign.TACS.Data.ProjectsDs.ProjectsRow row in dataTable)
     {
         TreeNode node = new TreeNode();
         node.Name = row.Project;
         node.Text = row.Project;
         node.SelectedImageIndex = 3;
         node.ImageIndex = 3;
         treeProj.Nodes.Add(node);
     }
 }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: cspot/TACS.NET-Manager
 /// <summary>
 /// Display the contents of the data table in the applications dockable window.
 /// </summary>
 /// <param name="dataTable">iCampaign.TACS.Data.ApplicationsDs.ApplicationsDataTable</param>
 private void RefreshAppNodes(iCampaign.TACS.Data.ApplicationsDs.ApplicationsDataTable dataTable)
 {
     foreach (iCampaign.TACS.Data.ApplicationsDs.ApplicationsRow row in dataTable)
     {
         TreeNode node = new TreeNode();
         node.Name = row.AppCode;
         node.Text = row.AppName;
         node.SelectedImageIndex = 0;
         node.ImageIndex = 0;
         treeApps.Nodes.Add(node);
     }
 }
コード例 #7
0
ファイル: AccountsBox.cs プロジェクト: cspot/TACS.NET-Manager
 /// <summary>
 /// Initialize instance of accounts dialog box.
 /// </summary>
 /// <param name="dataTable">iCampaign.TACS.Data.AccountsDs.AccountsDataTable</param>
 public AccountsBox(iCampaign.TACS.Data.AccountsDs.AccountsDataTable dataTable)
 {
     //  Initialize the form controls
     InitializeComponent();
     accountsTable = dataTable;
 }
コード例 #8
0
        /// <summary>
        /// Get project profile from TACS.NET database for specified project.
        /// </summary>
        /// <param name="project">string: Project name.</param>
        /// <param name="role">string: Caller role being used.</param>
        /// <param name="credentials">iCampaign.TACS.Client.Credentials: object.</param>
        /// <returns>iCampaign.TACS.ProjectProfile: object.</returns>
        internal ProjectProfile GetProject(string project, string role, iCampaign.TACS.Client.Credentials credentials)
        {
            bool errorStatus = false;
            ProjectProfile result = new ProjectProfile();

            //  Check to see if user has sufficient access
            if (!credentials.HasAccess(role, AccessLevelEnum.Owner))
            {
                errorStatus = true;
                result.ErrorMessage = TacsSession.MSG_INSUFPRIV;
            }

            //  Check for valid session token
            if (!TacsSession.IsTokenValid(credentials.Username, credentials.SessionToken))
            {
                errorStatus = true;
                result.ErrorMessage = TacsSession.MSG_INVALSESS;
            }

            //  Check to see if project is valid
            if (!errorStatus)
            {
                if (!TacsSession.IsProjectValid(credentials.ApplicationCode, project))
                {
                    errorStatus = true;
                    result.ErrorMessage = TacsSession.MSG_UNKPROJECT;
                }
            }

            //  If no error exists, go ahead and get project profile
            if (!errorStatus)
            {
                Data.ProjectsDs.ProjectsDataTable projectTable = new ProjectsDs.ProjectsDataTable();
                Data.ProjectsDsTableAdapters.ProjectsTableAdapter tableAdapter =
                    new iCampaign.TACS.Data.ProjectsDsTableAdapters.ProjectsTableAdapter();
                Data.ProjectsDs.ProjectsRow row = null;
                tableAdapter.Connection = new SqlConnection(TacsSession.ConnectionString);
                try
                {
                    tableAdapter.Connection.Open();
                    tableAdapter.FillByProject(projectTable, project);
                    row = projectTable[0];
                }
                catch (Exception ex)
                {
                    result.ErrorMessage = ex.Message;
                    errorStatus = true;
                }
                finally
                {
                    tableAdapter.Connection.Close();
                }
                if (!errorStatus)
                {
                    result.Project = row.Project;
                    result.ConnectorType = TacsSession.GetConnectorType(row.ConnectorType);
                    result.DataSource = row.DataSource;
                    result.Database = row.Database;
                    result.Username = row.Username;
                    result.Password = row.Password;
                    result.CreatedOn = row.CreatedOn;
                    result.ApplicationCode = row.AppCode;
                    result.AccountId = row.AcctId;
                    result.ErrorMessage = TacsSession.MSG_SUCCESS;
                }
            }

            return result;
        }