static private Session LoginToMantis(string ALoginURL, string AUsername, string APassword)
        {
            Session session = new Session(ALoginURL, AUsername, APassword, null);

            session.Connect();

            return session;
        }
 /// <summary>
 /// Connects to Mantis installation and creates a session which can be accessed through the
 /// <see cref="Session"/> property.
 /// </summary>
 protected void Connect()
 {
     session = new Session( Url, Username, Password, null );
     session.Connect();
 }
        private void MantisFiltersForm_Load(object sender, System.EventArgs e)
        {
            NetworkCredential nc = null;

            NameValueCollection appSettings = ConfigurationManager.AppSettings;
            string basicHttpAuthUserName = appSettings["BasicHttpAuthUserName"];
            string basicHttpAuthPassword = appSettings["BasicHttpAuthPassword"];
            if (!String.IsNullOrEmpty(basicHttpAuthUserName) && basicHttpAuthPassword != null)
            {
                nc = new NetworkCredential(basicHttpAuthUserName, basicHttpAuthPassword);
            }

            string mantisConnectUrl = appSettings["MantisConnectUrl"];
            string mantisUserName = appSettings["MantisUserName"];
            string mantisPassword = appSettings["MantisPassword"];

            session = new Session(mantisConnectUrl, mantisUserName, mantisPassword, nc);
            session.Connect();

            populating = true;
            filtersComboBox.DataSource = session.Request.UserGetFilters( 0 );
            filtersComboBox.DisplayMember = "Name";
            filtersComboBox.ValueMember = "Id";
            populating = false;

            UpdateGrid();
        }
Beispiel #4
0
        private void SubmitIssue_Load(object sender, System.EventArgs e)
        {
            try
            {
                NetworkCredential nc = null;

                NameValueCollection appSettings = ConfigurationManager.AppSettings;

                string basicHttpAuthUserName = appSettings["BasicHttpAuthUserName"];
                string basicHttpAuthPassword = appSettings["BasicHttpAuthPassword"];
                if (!String.IsNullOrEmpty(basicHttpAuthUserName) && basicHttpAuthPassword != null)
                {
                    nc = new NetworkCredential(basicHttpAuthUserName, basicHttpAuthPassword);
                }

                string mantisConnectUrl = appSettings["MantisConnectUrl"];
                string mantisUserName = appSettings["MantisUserName"];
                string mantisPassword = appSettings["MantisPassword"];

                session = new Session(mantisConnectUrl, mantisUserName, mantisPassword, nc);

                session.Connect();

                populating = true;
                int i = 0;
                foreach (Project project in session.Request.UserGetAccessibleProjects())
                {
                    TreeNode Node = new TreeNode(project.Name);
                    Node.Tag = project.Id;
                    treeView1.Nodes.Add(Node);
                    if (project.Subprojects.Count > 0)
                    {
                        TreeNode customerNode = new TreeNode(project.Name);
                        customerNode.Tag = project.Id;
                        walkNode(project.Subprojects, ref customerNode);
                        treeView1.Nodes[i].Nodes.Add(customerNode);
                     }
                    if (i == 1)
                        treeView1.SelectedNode=Node;
                    i++;
                }

                this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeView1_AfterSelect);
                populating = false;

                PopulateProjectDependentFields();

                priorityComboBox.DataSource = session.Config.PriorityEnum.GetLabels();
                severityComboBox.DataSource = session.Config.SeverityEnum.GetLabels();
                reproducibilityComboBox.DataSource = session.Config.ReproducibilityEnum.GetLabels();
            }
            catch( Exception ex )
            {
                MessageBox.Show( ex.Message, "Webservice Error", MessageBoxButtons.OK, MessageBoxIcon.Stop );
            }
        }
        private bool Connect()
        {
            if ( session == null )
            {
                try
                {
                    NetworkCredential nc = null;

                    NameValueCollection appSettings = ConfigurationManager.AppSettings;
                    string basicHttpAuthUserName = appSettings["BasicHttpAuthUserName"];
                    string basicHttpAuthPassword = appSettings["BasicHttpAuthPassword"];
                    if (!String.IsNullOrEmpty(basicHttpAuthUserName) && basicHttpAuthPassword != null)
                    {
                        nc = new NetworkCredential(basicHttpAuthUserName, basicHttpAuthPassword);
                    }

                    string mantisConnectUrl = appSettings["MantisConnectUrl"];
                    string mantisUserName = appSettings["MantisUserName"];
                    string mantisPassword = appSettings["MantisPassword"];

                    session = new Session( mantisConnectUrl, mantisUserName, mantisPassword, nc );
                    session.Connect();

                    notifyIcon.Text = "Mantis Notifier";
                }
                catch( System.Net.WebException )
                {
                    Disconnect();
                }
            }

            return session != null;
        }
        private void SubmitIssue_Load(object sender, System.EventArgs e)
        {
            try
            {
                NetworkCredential nc = null;

                NameValueCollection appSettings = ConfigurationManager.AppSettings;

                string basicHttpAuthUserName = appSettings["BasicHttpAuthUserName"];
                string basicHttpAuthPassword = appSettings["BasicHttpAuthPassword"];
                if (!String.IsNullOrEmpty(basicHttpAuthUserName) && basicHttpAuthPassword != null)
                {
                    nc = new NetworkCredential(basicHttpAuthUserName, basicHttpAuthPassword);
                }

                string mantisConnectUrl = appSettings["MantisConnectUrl"];
                string mantisUserName = appSettings["MantisUserName"];
                string mantisPassword = appSettings["MantisPassword"];

                session = new Session(mantisConnectUrl, mantisUserName, mantisPassword, nc);

                session.Connect();

                populating = true;
                projectComboBox.DataSource = session.Request.UserGetAccessibleProjects();
                projectComboBox.DisplayMember = "Name";
                projectComboBox.ValueMember = "Id";
                populating = false;

                projectComboBox.SelectedIndex = 0;
                PopulateProjectDependentFields();

                priorityComboBox.DataSource = session.Config.PriorityEnum.GetLabels();
                severityComboBox.DataSource = session.Config.SeverityEnum.GetLabels();
                reproducibilityComboBox.DataSource = session.Config.ReproducibilityEnum.GetLabels();
            }
            catch( Exception ex )
            {
                MessageBox.Show( ex.Message, "Webservice Error", MessageBoxButtons.OK, MessageBoxIcon.Stop );
            }
        }