Ejemplo n.º 1
0
        /// <summary>
        /// gets latest bugs in chains
        /// </summary>
        /// <param name="DeveloperID"></param>
        /// <param name="openOnly">parameter to show only open if true, else show open and close</param>
        /// <returns>list of bugs that Assigned user's ID = Developer ID</returns>
        public static new List <DeveloperBug> GetAssignedDevloperBugs(long DeveloperID, Boolean openOnly)
        {
            List <DeveloperBug> BugList = new List <DeveloperBug>();
            DataSet             ds      = new DataSet();
            SqlConnection       sqlCon  = new SqlConnection(Settings.AzureBugTrackingConnectionString);
            SqlCommand          sqlCom  = new SqlCommand("SELECT dbo.Bugs.id, dbo.Bugs.Title, dbo.Bugs.Comment, dbo.Bugs.LocationID, dbo.DeveloperBug.BugOpen,dbo.Bugs.CreatedDate,dbo.DeveloperBug.Code, dbo.Bugs.Archived, dbo.DeveloperBug.NextBugId, dbo.Bugs.CreatedById, dbo.DeveloperBug.previousBugID, dbo.DeveloperBug.Priority, dbo.Bugs.AssignedUserID FROM dbo.DeveloperBug LEFT OUTER JOIN dbo.Bugs ON dbo.DeveloperBug.BugID = dbo.Bugs.id where (AssignedUserID = @Id or CreatedByID = @Id ) and dbo.DeveloperBug.NextBugId is null", sqlCon);

            sqlCom.Parameters.Add(new SqlParameter("@Id", DeveloperID));
            if (openOnly == true)
            {
                sqlCom.Parameters.Add(new SqlParameter("@open", true));
                sqlCom.CommandText += " AND BugOpen = @open";
            }



            try
            {
                sqlCon.Open();

                SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCom);

                sqlDa.Fill(ds);
            }
            finally
            {
                sqlCon.Close();
            }


            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    long        Id            = (long)row["Id"];
                    String      Title         = (String)row["Title"];
                    String      Comment       = (String)row["Comment"];
                    long        previousBugId = (long)Settings.iif(Convert.IsDBNull(row["previousBugId"]), 0, (long)row["previousBugId"]);
                    long        locationID    = (long)Settings.iif(Convert.IsDBNull(row["locationID"]), (long)row["locationID"], (long)0);
                    BugLocation bugLocation   = new BugLocation(locationID);


                    DateTime CreatedDate = (DateTime)row["CreatedDate"];
                    bool     BugOpen;

                    if ((bool)row["BugOpen"] == true)
                    {
                        BugOpen = true;
                    }
                    else
                    {
                        BugOpen = false;
                    }
                    bugLocation.Get();

                    long priority = (long)row["priority"];



                    String code = "";

                    if (row["Code"] != DBNull.Value)
                    {
                        code = (String)row["Code"];
                    }



                    DeveloperBug newBug = new DeveloperBug(Id, Title, Comment, bugLocation, previousBugId, priority, BugOpen, code);

                    newBug.CreatedDate = CreatedDate;
                    Developer developer = Developer.Get((long)row["CreatedById"]);



                    BugList.Add(newBug);
                }
            }
            else
            {
                //throw exeption
                return(null);
            }

            return(BugList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Lists all Developer Bugs
        /// </summary>
        /// <returns>List of Developer Bugs</returns>
        public static new List <DeveloperBug> Get()
        {
            List <DeveloperBug> BugList = new List <DeveloperBug>();
            DataSet             ds      = new DataSet();
            SqlConnection       sqlCon  = new SqlConnection(Settings.AzureBugTrackingConnectionString);
            SqlCommand          sqlCom  = new SqlCommand("SELECT dbo.Bugs.id, dbo.Bugs.Title, dbo.Bugs.Comment, dbo.Bugs.LocationID, dbo.DeveloperBug.BugOpen, dbo.Bugs.Archived, dbo.DeveloperBug.NextBugId, dbo.Bugs.CreatedById, dbo.Bugs.previousBugID, dbo.Bugs.Priority, dbo.Bugs.AssignedUserID FROM dbo.DeveloperBug LEFT OUTER JOIN dbo.Bugs ON dbo.DeveloperBug.BugID = dbo.Bugs.id", sqlCon);

            try
            {
                sqlCon.Open();

                SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCom);

                sqlDa.Fill(ds);
            }
            finally
            {
                sqlCon.Close();
            }


            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    long   Id            = (long)row["Id"];
                    String Title         = (String)row["Title"];
                    String Comment       = (String)row["Comment"];
                    long   previousBugId = (long)Settings.iif(Convert.IsDBNull(row["previousBugId"]), 0, (long)row["previousBugId"]);
                    String code          = (String)row["Code"];

                    Boolean isNull    = Convert.IsDBNull(row["NextBugID"]);
                    long    NextBugId = (long)0;
                    if (!isNull)
                    {
                        NextBugId = (long)row["NextBugID"];
                    }


                    long        locationID  = (long)Settings.iif(Convert.IsDBNull(row["locationID"]), (long)row["locationID"], (long)0);
                    BugLocation bugLocation = new BugLocation(locationID);


                    bool BugOpen;

                    if ((bool)row["BugOpen"] == true)
                    {
                        BugOpen = true;
                    }
                    else
                    {
                        BugOpen = false;
                    }
                    bugLocation.Get();

                    long priority = (long)row["priority"];


                    DeveloperBug newBug = new DeveloperBug(Id, Title, Comment, bugLocation, previousBugId, priority, BugOpen, code);

                    Developer developer = Developer.Get((long)row["CreatedById"]);



                    BugList.Add(newBug);
                }
            }
            else
            {
                //throw exeption
                return(null);
            }

            return(BugList);
        }