Beispiel #1
0
 public DeveloperBug(String title, String comment, BugLocation location, long PreviousBugId, long Priority, Boolean BugOpen, String Code) : base(title, comment, location)
 {
     this.PreviousBugID = PreviousBugId;
     this.Priority      = Priority;
     this.BugOpen       = BugOpen;
     this.Code          = Code;
 }
Beispiel #2
0
 public Bug(long Id, String Title, String Comment, BugLocation location)
 {
     this.Title    = Title;
     this.Comment  = Comment;
     this.Id       = Id;
     this.Location = location;
 }
Beispiel #3
0
        /// <summary>
        /// gets latest bugs in chains
        /// </summary>
        /// <param name="DeveloperID"></param>
        /// <param name="notArchived">parameter to show only not Archived Bugs, that do not have a new version</param>
        /// <returns>list of bugs that Assigned user's ID = Developer ID</returns>
        public static List <Bug> GetAssignedBugs(long DeveloperID, Boolean notArchived)
        {
            List <Bug>    BugList = new List <Bug>();
            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.Bugs.CreatedDate, dbo.Bugs.CreatedById, dbo.Bugs.AssignedUserID FROM Bugs where AssignedUserID = @Id", sqlCon);

            sqlCom.Parameters.Add(new SqlParameter("@Id", DeveloperID));

            if (notArchived)
            {
                sqlCom.CommandText += " AND Bugs.Archived = @Archived";
                sqlCom.Parameters.Add(new SqlParameter("@Archived", false));
            }

            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        locationID  = (long)Settings.iif(Convert.IsDBNull(row["locationID"]), (long)row["locationID"], (long)0);
                    BugLocation bugLocation = new BugLocation(locationID);


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


                    Bug newBug = new Bug(Id, Title, Comment, bugLocation);

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

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

            return(BugList);
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Boolean Get(long id)
        {
            //retreives information about bug with ID
            DataSet       ds     = new DataSet();
            SqlConnection sqlCon = new SqlConnection(Settings.AzureBugTrackingConnectionString);
            SqlCommand    sqlCom = new SqlCommand("Select * From Bugs where Id = @ID", sqlCon);

            sqlCom.Parameters.Add(new SqlParameter("@ID", id));

            try
            {
                sqlCon.Open();

                SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCom);

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                this.Id             = id;
                this.Title          = (String)ds.Tables[0].Rows[0]["Title"];
                this.Comment        = (String)ds.Tables[0].Rows[0]["Comment"];
                this.Location       = new BugLocation((long)ds.Tables[0].Rows[0]["LocationID"]);
                this.AssignedUserID = (long)ds.Tables[0].Rows[0]["AssignedUserID"];
                this.CreatedDate    = (DateTime)ds.Tables[0].Rows[0]["CreatedDate"];
                this.createdByID    = (long)ds.Tables[0].Rows[0]["CreatedByID"];

                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
 public DeveloperBug(long Id, String title, String comment, BugLocation location, long PreviousBugId, long Priority, Boolean BugOpen, String Code) : this(title, comment, location, PreviousBugId, Priority, BugOpen, Code)
 {
     this.Id = Id;
 }
Beispiel #6
0
        /// <summary>
        /// Get single developer Bug details
        /// </summary>
        /// <param name="id">Id of developer bug</param>
        /// <returns>returns bug</returns>
        public static new DeveloperBug Get(long id)
        {
            //retreives information about bug with ID
            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.Bugs.CreatedDate, dbo.DeveloperBug.BugOpen,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 Id = @ID", sqlCon);

            sqlCom.Parameters.Add(new SqlParameter("@ID", id));
            try
            {
                sqlCon.Open();

                SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCom);

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                long Id = id;

                String Title = (String)ds.Tables[0].Rows[0]["Title"];

                String Comment = (String)ds.Tables[0].Rows[0]["Comment"];

                BugLocation Location = new BugLocation((long)ds.Tables[0].Rows[0]["LocationID"]);


                DateTime CreatedDate = (DateTime)ds.Tables[0].Rows[0]["CreatedDate"];


                long PreviousBugId = 0;
                if (ds.Tables[0].Rows[0]["PreviousBugID"] != DBNull.Value)
                {
                    PreviousBugId = (long)ds.Tables[0].Rows[0]["PreviousBugID"];
                }

                long NextBugID = 0;
                if (ds.Tables[0].Rows[0]["NextBugId"] != DBNull.Value)
                {
                    NextBugID = (long)ds.Tables[0].Rows[0]["NextBugId"];
                }


                List <Bug> UserBugs;


                long Priority = (long)ds.Tables[0].Rows[0]["Priority"];


                Boolean BugOpen = (Boolean)ds.Tables[0].Rows[0]["BugOpen"];

                String code = "";
                if (ds.Tables[0].Rows[0]["Code"] != DBNull.Value)
                {
                    code = (String)ds.Tables[0].Rows[0]["Code"];
                }

                long assignedUserID = 0;

                if (ds.Tables[0].Rows[0]["Code"] != DBNull.Value)
                {
                    assignedUserID = (long)ds.Tables[0].Rows[0]["AssignedUserID"];
                }



                DeveloperBug bug = new DeveloperBug(Id, Title, Comment, Location, PreviousBugId, Priority, BugOpen, code);
                bug.CreatedDate    = CreatedDate;
                bug.NextBugId      = NextBugID;
                bug.AssignedUserID = assignedUserID;



                return(bug);
            }
            else
            {
                return(null);
            }
        }
Beispiel #7
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);
        }
Beispiel #8
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);
        }
Beispiel #9
0
 public Bug(string Title, string Comment, BugLocation location) : this(Title, Comment)
 {
     Location = location;
 }
Beispiel #10
0
 /// <summary>
 /// gets defaulted user based on location
 /// </summary>
 /// <returns>defaulted user to attend this bug</returns>
 public static User GetDefaultedUser(BugLocation location)
 {
     return(null);
 }