예제 #1
0
        public MyZilla.BusinessEntities.Catalogues GetCataloguesForConnection(int connectionId)
        {
            MyZilla.BusinessEntities.Catalogues result = null;

            for (int i = 0; i < globalCataloguesCollection.Count; i++)
            {
                if (globalCataloguesCollection[i].ConnectionId == connectionId)
                {
                    result = globalCataloguesCollection[i];

                    break;
                }
            }

            return(result);
        }
예제 #2
0
        private static Catalogues LoadMainCatalogues(TDSettings.ConnectionRow connectionRow, BackgroundWorker backgroudWorker)
        {
            #if DEBUG
            string methodName = "LoadMainCatalogues";
            #endif
            #if DEBUG
                System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew();
            #endif

            backgroudWorker.ReportProgress(0);

            backgroudWorker.ReportProgress(10);

            // when refresh catalogues, it is no need to verify login.

            IUser user = (IUser)BLControllerFactory.GetRegisteredConcreteFactory(connectionRow.ConnectionId );

            string userIsLogged = user.LogOnToBugzilla(connectionRow.UserName, connectionRow.Password);

            #if DEBUG
                watch.Stop();
                MyLogger.Write(watch.ElapsedMilliseconds.ToString(), methodName, LoggingCategory.Debug);
                watch.Start();
            #endif

            if (userIsLogged.Length > 0)
            {
                // this could happen because a wrong password was saved.

                backgroudWorker.ReportProgress(100);

                return null;

            }

            IUtilities catalogue = (IUtilities)BLControllerFactory.GetRegisteredConcreteFactory(connectionRow.ConnectionId );

            string[] catalogNames = new string[] { "classification", "product", "bug_status", "resolution", "bug_severity", "priority", "rep_platform", "op_sys", "short_desc_type", "field0-0-0", "type0-0-0" };

            // get all the main catalogues (catalogues without dependencies) used in the application
            // request
            ArrayList collCatalogues = catalogue.GetCatalogues(catalogNames);

            #if DEBUG
            watch.Stop();
            MyLogger.Write(watch.ElapsedMilliseconds.ToString(), methodName, LoggingCategory.Debug);
            watch.Start();
            #endif
            // get the connection/user information

            MyZilla.BusinessEntities.Catalogues cataloguesPerUser = new MyZilla.BusinessEntities.Catalogues(connectionRow.ConnectionId);

            #region Main Catalogues

            // get the product catalogue
            List<string> lstProduct = collCatalogues[1] as List<string>;

            cataloguesPerUser.catalogueProduct = new NameValueCollection();

            foreach (string strProduct in lstProduct)
            {
                cataloguesPerUser.catalogueProduct.Add(strProduct, string.Empty);
            }

            backgroudWorker.ReportProgress(80);

            // get the rest of the main catalogues and populate the corresponding controls.
            // string[] catalogNames = new string[] {"product",
            // "bug_status",
            // "resolution",
            // "bug_severity",
            // "priority",
            // "rep_platform",
            // "op_sys",
            // "short_desc_type"};

            cataloguesPerUser.catalogueStatus = collCatalogues[2] as List<string>;

            cataloguesPerUser.catalogueResolution = collCatalogues[3] as List<string>;

            cataloguesPerUser.catalogueSeverity = collCatalogues[4] as List<string>;

            cataloguesPerUser.cataloguePriority = collCatalogues[5] as List<string>;

            cataloguesPerUser.catalogueHardware = collCatalogues[6] as List<string>;

            cataloguesPerUser.catalogueOS = collCatalogues[7] as List<string>;

            cataloguesPerUser.catalogueStringOperators = collCatalogues[8] as List<string>;

            cataloguesPerUser.catalogueFields = collCatalogues[9] as List<string>;

            cataloguesPerUser.catalogueOperators = collCatalogues[10] as List<string>;

            #endregion

            backgroudWorker.ReportProgress(100);

            #if DEBUG
            watch.Stop();
            MyLogger.Write(watch.ElapsedMilliseconds.ToString(), methodName, LoggingCategory.Debug);
            #endif

            return cataloguesPerUser;
        }
예제 #3
0
        private static Catalogues GetCataloguesForUser(TDSettings.ConnectionRow currentConnection, BackgroundWorker bkgWork)
        {
            MyZilla.BusinessEntities.Catalogues cataloguesPerUser = null;

            string connInfo = _appSettings.GetConnectionInfo(currentConnection.ConnectionId);

            try
            {
            #if DEBUG
                System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew();
            #endif

                bkgWork.ReportProgress(0, connInfo);
                bkgWork.ReportProgress(10, connInfo);

                // when refresh catalogues, it is no need to verify login.

                IUser user = (IUser)BLControllerFactory.GetRegisteredConcreteFactory(currentConnection.ConnectionId);

                // TO DO: eliminate the last param.
                string loggedUser = user.LogOnToBugzilla(currentConnection.UserName, currentConnection.Password);

                if (loggedUser.Length > 0)
                {
                    // this could happen if a wrong password was saved.

                    bkgWork.ReportProgress(100, connInfo);

                    throw new Exception(loggedUser);
                }

                IUtilities catalogue = (IUtilities)BLControllerFactory.GetRegisteredConcreteFactory(currentConnection.ConnectionId);

                string[] catalogNames = new string[] { "classification", "product", "bug_status", "resolution", "bug_severity", "priority", "rep_platform", "op_sys", "short_desc_type", "field0-0-0", "type0-0-0" };

                // get all the main catalogues (catalogues without dependencies) used in the application
                // request

                ArrayList collCatalogues = catalogue.GetCatalogues(catalogNames);

                // get the connection/user information

                cataloguesPerUser = new MyZilla.BusinessEntities.Catalogues(currentConnection.ConnectionId);

                #region Main Catalogues

                // get the product catalogue
                List<string> lstProduct = collCatalogues[1] as List<string>;

                cataloguesPerUser.catalogueProduct = new NameValueCollection();

                foreach (string strProduct in lstProduct)
                {
                    cataloguesPerUser.catalogueProduct.Add(strProduct, string.Empty);
                }

                // get the rest of the main catalogues and populate the corresponding controls.
                // string[] catalogNames = new string[] {"product",
                // "bug_status",
                // "resolution",
                // "bug_severity",
                // "priority",
                // "rep_platform",
                // "op_sys",
                // "short_desc_type"};

                cataloguesPerUser.catalogueStatus = collCatalogues[2] as List<string>;

                cataloguesPerUser.catalogueResolution = collCatalogues[3] as List<string>;

                cataloguesPerUser.catalogueSeverity = collCatalogues[4] as List<string>;

                cataloguesPerUser.cataloguePriority = collCatalogues[5] as List<string>;

                cataloguesPerUser.catalogueHardware = collCatalogues[6] as List<string>;

                cataloguesPerUser.catalogueOS = collCatalogues[7] as List<string>;

                cataloguesPerUser.catalogueStringOperators = collCatalogues[8] as List<string>;

                cataloguesPerUser.catalogueFields = collCatalogues[9] as List<string>;

                cataloguesPerUser.catalogueOperators = collCatalogues[10] as List<string>;

                #endregion

                bkgWork.ReportProgress(40, connInfo);

                #region Dependent catalogues

                // component and version catalogues

                // request
                ArrayList al = catalogue.GetValuesForDependentCatalogues(0, cataloguesPerUser.catalogueProduct);

                cataloguesPerUser.catalogueComponent = al[0] as NameValueCollection;

                cataloguesPerUser.catalogueVersion = al[1] as NameValueCollection;

                cataloguesPerUser.catalogueTargetMilestone = al[2] as NameValueCollection;

                #endregion

                bkgWork.ReportProgress(80, connInfo);

            #if DEBUG
                watch.Stop();

                MyLogger.Write(watch.ElapsedMilliseconds.ToString(), "GetCataloguesForUser", LoggingCategory.Debug);
            #endif

            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "GetCataloguesForUser", LoggingCategory.Exception);

                throw;

            }
            finally
            {
                bkgWork.ReportProgress(100, connInfo);

               }
               return cataloguesPerUser;
        }
예제 #4
0
        public void LoadCompAndVersionCatalogues(Catalogues cataloguesPerUser)
        {
            // start a new thread for Component and Version catalogues

            BackgroundWorker bkgDepCatalogues1 = new BackgroundWorker();
            bkgDepCatalogues1.DoWork += new DoWorkEventHandler(bkgDepCatalogues1_DoWork);
            bkgDepCatalogues1.ProgressChanged += new ProgressChangedEventHandler(bkgDepCatalogues1_ProgressChanged);
            bkgDepCatalogues1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bkgDepCatalogues1_RunWorkerCompleted);
            bkgDepCatalogues1.WorkerReportsProgress = true;
            bkgDepCatalogues1.WorkerSupportsCancellation = true;
            bkgDepCatalogues1.RunWorkerAsync(cataloguesPerUser);
        }
예제 #5
0
        private void EditBug_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.DesignMode)
                {

                    _appSettings = MyZillaSettingsDataSet.GetInstance();

                    _asyncOpManager = AsyncOperationManagerList.GetInstance();

                    // disable the control until de bug details are loaded and
                    // all the controls are populated accordingly.

                    ShowConnectionInfo();

                    this.Enabled = false;

                    _catalogues = CatalogueManager.Instance();

                    //if (_catalogues.DependentCataloguesLoadedCompleted!=null)
                        _catalogues.DependentCataloguesLoadedCompleted += new EventHandler(this._catalogues_DependentCataloguesLoadedCompleted);

                    cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId);

                    if (cataloguesPerUser.catalogueComponent == null || cataloguesPerUser.catalogueVersion == null || cataloguesPerUser.catalogueTargetMilestone == null )
                    {
                        cmbComponent.Enabled = false;

                        cmbVersion.Enabled = false;

                        cmbMilestone.Enabled = false;

                        _catalogues.CompAndVersionCataloguesLoadedCompleted += new EventHandler(_catalogues_CompAndVersionCataloguesLoadedCompleted);

                        _catalogues.LoadCompAndVersionCatalogues(cataloguesPerUser);
                    }
                    else
                    {

                        PopulateControls();

                        // asyn op
                        GetBugDetailsAndSetControls(this.bugId, true);
                    }

                    if (_appSettings.GetConnectionById(connectionId).Version.StartsWith("2.18"))
                        GetLastUpdated();
                }
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "EditBug_Load", LoggingCategory.Exception);

                MessageBox.Show(this, ex.Message, Messages.Error , MessageBoxButtons.OK, MessageBoxIcon.Error     );
            }
        }
예제 #6
0
        private static Catalogues GetCataloguesForUser(TDSettings.ConnectionRow currentConnection, BackgroundWorker bkgWork)
        {
            MyZilla.BusinessEntities.Catalogues cataloguesPerUser = null;

            string connInfo = _appSettings.GetConnectionInfo(currentConnection.ConnectionId);

            try
            {
#if DEBUG
                System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew();
#endif


                bkgWork.ReportProgress(0, connInfo);
                bkgWork.ReportProgress(10, connInfo);


                // when refresh catalogues, it is no need to verify login.

                IUser user = (IUser)BLControllerFactory.GetRegisteredConcreteFactory(currentConnection.ConnectionId);

                // TO DO: eliminate the last param.
                string loggedUser = user.LogOnToBugzilla(currentConnection.UserName, currentConnection.Password);


                if (loggedUser.Length > 0)
                {
                    // this could happen if a wrong password was saved.

                    bkgWork.ReportProgress(100, connInfo);

                    throw new Exception(loggedUser);
                }


                IUtilities catalogue = (IUtilities)BLControllerFactory.GetRegisteredConcreteFactory(currentConnection.ConnectionId);

                string[] catalogNames = new string[] { "classification", "product", "bug_status", "resolution", "bug_severity", "priority", "rep_platform", "op_sys", "short_desc_type", "field0-0-0", "type0-0-0" };

                // get all the main catalogues (catalogues without dependencies) used in the application
                // request

                ArrayList collCatalogues = catalogue.GetCatalogues(catalogNames);

                // get the connection/user information

                cataloguesPerUser = new MyZilla.BusinessEntities.Catalogues(currentConnection.ConnectionId);

                #region Main Catalogues

                // get the product catalogue
                List <string> lstProduct = collCatalogues[1] as List <string>;

                cataloguesPerUser.catalogueProduct = new NameValueCollection();

                foreach (string strProduct in lstProduct)
                {
                    cataloguesPerUser.catalogueProduct.Add(strProduct, string.Empty);
                }


                // get the rest of the main catalogues and populate the corresponding controls.
                // string[] catalogNames = new string[] {"product",
                // "bug_status",
                // "resolution",
                // "bug_severity",
                // "priority",
                // "rep_platform",
                // "op_sys",
                // "short_desc_type"};

                cataloguesPerUser.catalogueStatus = collCatalogues[2] as List <string>;

                cataloguesPerUser.catalogueResolution = collCatalogues[3] as List <string>;

                cataloguesPerUser.catalogueSeverity = collCatalogues[4] as List <string>;

                cataloguesPerUser.cataloguePriority = collCatalogues[5] as List <string>;

                cataloguesPerUser.catalogueHardware = collCatalogues[6] as List <string>;

                cataloguesPerUser.catalogueOS = collCatalogues[7] as List <string>;

                cataloguesPerUser.catalogueStringOperators = collCatalogues[8] as List <string>;

                cataloguesPerUser.catalogueFields = collCatalogues[9] as List <string>;

                cataloguesPerUser.catalogueOperators = collCatalogues[10] as List <string>;

                #endregion

                bkgWork.ReportProgress(40, connInfo);

                #region Dependent catalogues


                // component and version catalogues

                // request
                ArrayList al = catalogue.GetValuesForDependentCatalogues(0, cataloguesPerUser.catalogueProduct);

                cataloguesPerUser.catalogueComponent = al[0] as NameValueCollection;

                cataloguesPerUser.catalogueVersion = al[1] as NameValueCollection;

                cataloguesPerUser.catalogueTargetMilestone = al[2] as NameValueCollection;

                #endregion

                bkgWork.ReportProgress(80, connInfo);

#if DEBUG
                watch.Stop();

                MyLogger.Write(watch.ElapsedMilliseconds.ToString(), "GetCataloguesForUser", LoggingCategory.Debug);
#endif
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "GetCataloguesForUser", LoggingCategory.Exception);

                throw;
            }
            finally
            {
                bkgWork.ReportProgress(100, connInfo);
            }
            return(cataloguesPerUser);
        }
예제 #7
0
        private static Catalogues LoadMainCatalogues(TDSettings.ConnectionRow connectionRow, BackgroundWorker backgroudWorker)
        {
#if DEBUG
            string methodName = "LoadMainCatalogues";
#endif
            #if DEBUG
            System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew();
            #endif

            backgroudWorker.ReportProgress(0);

            backgroudWorker.ReportProgress(10);

            // when refresh catalogues, it is no need to verify login.

            IUser user = (IUser)BLControllerFactory.GetRegisteredConcreteFactory(connectionRow.ConnectionId);

            string userIsLogged = user.LogOnToBugzilla(connectionRow.UserName, connectionRow.Password);


            #if DEBUG
            watch.Stop();
            MyLogger.Write(watch.ElapsedMilliseconds.ToString(), methodName, LoggingCategory.Debug);
            watch.Start();
            #endif

            if (userIsLogged.Length > 0)
            {
                // this could happen because a wrong password was saved.

                backgroudWorker.ReportProgress(100);

                return(null);
            }

            IUtilities catalogue = (IUtilities)BLControllerFactory.GetRegisteredConcreteFactory(connectionRow.ConnectionId);

            string[] catalogNames = new string[] { "classification", "product", "bug_status", "resolution", "bug_severity", "priority", "rep_platform", "op_sys", "short_desc_type", "field0-0-0", "type0-0-0" };

            // get all the main catalogues (catalogues without dependencies) used in the application
            // request
            ArrayList collCatalogues = catalogue.GetCatalogues(catalogNames);



#if DEBUG
            watch.Stop();
            MyLogger.Write(watch.ElapsedMilliseconds.ToString(), methodName, LoggingCategory.Debug);
            watch.Start();
#endif
            // get the connection/user information

            MyZilla.BusinessEntities.Catalogues cataloguesPerUser = new MyZilla.BusinessEntities.Catalogues(connectionRow.ConnectionId);

            #region Main Catalogues

            // get the product catalogue
            List <string> lstProduct = collCatalogues[1] as List <string>;

            cataloguesPerUser.catalogueProduct = new NameValueCollection();

            foreach (string strProduct in lstProduct)
            {
                cataloguesPerUser.catalogueProduct.Add(strProduct, string.Empty);
            }

            backgroudWorker.ReportProgress(80);


            // get the rest of the main catalogues and populate the corresponding controls.
            // string[] catalogNames = new string[] {"product",
            // "bug_status",
            // "resolution",
            // "bug_severity",
            // "priority",
            // "rep_platform",
            // "op_sys",
            // "short_desc_type"};

            cataloguesPerUser.catalogueStatus = collCatalogues[2] as List <string>;

            cataloguesPerUser.catalogueResolution = collCatalogues[3] as List <string>;

            cataloguesPerUser.catalogueSeverity = collCatalogues[4] as List <string>;

            cataloguesPerUser.cataloguePriority = collCatalogues[5] as List <string>;

            cataloguesPerUser.catalogueHardware = collCatalogues[6] as List <string>;

            cataloguesPerUser.catalogueOS = collCatalogues[7] as List <string>;

            cataloguesPerUser.catalogueStringOperators = collCatalogues[8] as List <string>;

            cataloguesPerUser.catalogueFields = collCatalogues[9] as List <string>;

            cataloguesPerUser.catalogueOperators = collCatalogues[10] as List <string>;

            #endregion

            backgroudWorker.ReportProgress(100);

#if DEBUG
            watch.Stop();
            MyLogger.Write(watch.ElapsedMilliseconds.ToString(), methodName, LoggingCategory.Debug);
#endif

            return(cataloguesPerUser);
        }
예제 #8
0
        private void InsertBug_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.DesignMode)
                {

                    MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.GetInstance();

                    _catalogues = CatalogueManager.Instance();

                    this.txtReporter.Text = _appSettings.GetConnectionById(this.connectionId).UserName;

                    asyncOpManager = AsyncOperationManagerList.GetInstance();

                    cmbConnections.SelectedValueChanged -=new EventHandler(cmbConnections_SelectedValueChanged);

                    LoadConnectionInfo();

                    cmbConnections.Text = _appSettings.GetConnectionInfo(this.connectionId);

                    cmbConnections.SelectedValueChanged += new EventHandler(cmbConnections_SelectedValueChanged);

                    // verify if all catalogues have been added and populate the controls properly

                    cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId);

                    if (cataloguesPerUser.catalogueComponent == null || cataloguesPerUser.catalogueVersion == null || cataloguesPerUser.catalogueTargetMilestone == null )
                    {
                        cmbComponent.Enabled = false;

                        cmbVersion.Enabled = false;

                        cmbMilestone.Enabled = false;

                        btnInsertBug.Enabled = false;

                        _catalogues.CompAndVersionCataloguesLoadedCompleted += new EventHandler(_catalogues_CompAndVersionCataloguesLoadedCompleted);

                        _catalogues.LoadCompAndVersionCatalogues(cataloguesPerUser);
                    }
                    else
                    {

                        _catalogues.DependentCataloguesLoadedCompleted += new EventHandler(this._catalogues_DependentCataloguesLoadedCompletedInsertBug);

                        PopulateControls();

                    }
                }
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "InsertBug_Load", LoggingCategory.Exception);

                MessageBox.Show(this, ex.Message, Messages.Error , MessageBoxButtons.OK, MessageBoxIcon.Error     );
            }
        }
예제 #9
0
        private void cmbConnections_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmbConnections.SelectedValue != null)
                {
                    int selUser = int.Parse(cmbConnections.SelectedValue.ToString());

                    if (selUser != this.connectionId)
                    {
                        this.connectionId = selUser;

                        this.Enabled = false;

                        cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId);

                        // load the catalogues from the new selected user
                        // and populate the controls accordingly
                        PopulateControls();

                        this.Enabled = true;

                    }
                }
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "cmbConnections_SelectedValueChanged", LoggingCategory.Exception);

                MessageBox.Show(this, ex.Message, Messages.Error , MessageBoxButtons.OK, MessageBoxIcon.Error     );
            }
        }