public List<DevT> getWRs(string PID) { SqlDataReader rdr = null; SqlConnection con = null; SqlCommand cmd = null; //List<string> WRs = new List<string>(); List<DevT> dis = new List<DevT>(); try { con = new SqlConnection(String.Format("redacted"));//update to run con.Open(); string qryStr = "SELECT Bug.ProblemID as WR, ProgressStatusTypes.ProgressStatusName as WRStatus, Bug2.ProblemID as VAR, ProgressStatusTypes2.ProgressStatusName as VARStatus " + "FROM SWISEDB.dbo.Bug, SWISEDB.dbo.Bug Bug2, SWISEDB.dbo.BugLinks, SWISEDB.dbo.Project, SWISEDB.dbo.ProgressStatusTypes, SWISEDB.dbo.ProgressStatusTypes ProgressStatusTypes2 " + "WHERE " + "Bug.ProjectID = 17 and Bug2.ProjectID = Project.ProjectID and " + "BugLinks.LinkedBugID = Bug.BugID and " + "BugLinks.LinkedProjectID = Bug.ProjectID and " + "BugLinks.ProjectID = Project.ProjectID and " + "Bug2.BugID = BugLinks.BugID and " + "Bug2.ProjectID = BugLinks.ProjectID and " + "Bug.ProgressStatusID = ProgressStatusTypes.ProgressStatusID and " + "Bug.ProjectID = ProgressStatusTypes.ProjectID and " + "Bug2.ProgressStatusID = ProgressStatusTypes2.ProgressStatusID and "+ "Bug2.ProjectID = ProgressStatusTypes2.ProjectID and "+ "Project.ProjectName like '" + PID + "%' " + "UNION " + "SELECT Bug.ProblemID as WR, ProgressStatusTypes.ProgressStatusName as WRStatus, Bug2.ProblemID as VAR, ProgressStatusTypes2.ProgressStatusName as VARStatus " + "FROM SWISEDB.dbo.Bug, SWISEDB.dbo.Bug Bug2, SWISEDB.dbo.BugLinks, SWISEDB.dbo.Project, SWISEDB.dbo.ProgressStatusTypes, SWISEDB.dbo.ProgressStatusTypes ProgressStatusTypes2 " + "WHERE " + "Bug.ProjectID = 17 and Bug2.ProjectID = Project.ProjectID and " + "BugLinks.BugID = Bug.BugID and " + "BugLinks.ProjectID = Bug.ProjectID and " + "BugLinks.LinkedProjectID = Project.ProjectID and " + "Bug2.BugID = BugLinks.LinkedBugID and " + "Bug2.ProjectID = BugLinks.LinkedProjectID and " + "Bug.ProgressStatusID = ProgressStatusTypes.ProgressStatusID and " + "Bug.ProjectID = ProgressStatusTypes.ProjectID and " + "Bug2.ProgressStatusID = ProgressStatusTypes2.ProgressStatusID and " + "Bug2.ProjectID = ProgressStatusTypes2.ProjectID and " + "Project.ProjectName like '" + PID + "%' "; #region OldString //string qryStr = "SELECT Bug.ProblemID as WR, Bug2.ProblemID as VAR " + // "FROM SWISEDB.dbo.Bug, SWISEDB.dbo.Bug Bug2, SWISEDB.dbo.BugLinks, SWISEDB.dbo.Project " + // "WHERE " + // "Bug.ProjectID = 17 and Bug2.ProjectID = Project.ProjectID and " + // "BugLinks.LinkedBugID = Bug.BugID and " + // "BugLinks.LinkedProjectID = Bug.ProjectID and " + // "BugLinks.ProjectID = Project.ProjectID and " + // "Bug2.BugID = BugLinks.BugID and " + // "Bug2.ProjectID = BugLinks.ProjectID and " + // "Project.ProjectName like '" ID + "%' " + // "UNION " + // "SELECT Bug.ProblemID as WR, Bug2.ProblemID as VAR " + // "FROM SWISEDB.dbo.Bug, SWISEDB.dbo.Bug Bug2, SWISEDB.dbo.BugLinks, SWISEDB.dbo.Project " + // "WHERE " + // "Bug.ProjectID = 17 and Bug2.ProjectID = Project.ProjectID and " + // "BugLinks.BugID = Bug.BugID and " + // "BugLinks.ProjectID = Bug.ProjectID and " + // "BugLinks.LinkedProjectID = Project.ProjectID and " + // "Bug2.BugID = BugLinks.LinkedBugID and " + // "Bug2.ProjectID = BugLinks.LinkedProjectID and " + // "Project.ProjectName like '" ID + "%' "; #endregion cmd = new SqlCommand(qryStr); cmd.Connection = con; rdr = cmd.ExecuteReader(); while (rdr.HasRows) { while (rdr.Read()) { string IVt = ""; string WRt = ""; string RDt = ""; string IVs = ""; try { WRt = rdr[0].ToString().Substring(3, rdr[0].ToString().Length - 3); } catch { } try { IVt = rdr[1].ToString(); } catch { } try { RDt = rdr[2].ToString(); } catch { } try { IVs = rdr[3].ToString(); } catch { } DevT d = new DevT(WRt, IVt, RDt,IVs,"",""); dis.Add(d); } rdr.NextResult(); } } catch (Exception e) { string m = e.Message; rdr = null; } finally { if (rdr != null) { rdr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } } return dis; }
public List<DevT> getWRplus(string PID) { SqlDataReader rdr = null; SqlConnection con = null; SqlCommand cmd = null; List<DevT> dis = new List<DevT>(); try { con = new SqlConnection(String.Format("redacted"));//update ot run con.Open(); #region QueryString string qryStr = "Select WR, WRStatus, VAR, VARStatus, VARNeedByDate, ForwardTypes.ForwardTypeName as Priority from (" + "SELECT Bug.ProblemID as WR, ProgressStatusTypes.ProgressStatusName as WRStatus, Bug2.ProblemID as VAR, ProgressStatusTypes2.ProgressStatusName as VARStatus, Bug2.TaskPlannedStartDate as VARNeedByDate, Bug2.CrntForwardTypeID as VARPriority " + "FROM SWISEDB.dbo.Bug, SWISEDB.dbo.Bug Bug2, SWISEDB.dbo.BugLinks, SWISEDB.dbo.Project, SWISEDB.dbo.ProgressStatusTypes, SWISEDB.dbo.ProgressStatusTypes ProgressStatusTypes2 " + "WHERE " + "Bug.ProjectID = 17 and Bug2.ProjectID = Project.ProjectID and " + "BugLinks.LinkedBugID = Bug.BugID and " + "BugLinks.LinkedProjectID = Bug.ProjectID and " + "BugLinks.ProjectID = Project.ProjectID and " + "Bug2.BugID = BugLinks.BugID and " + "Bug2.ProjectID = BugLinks.ProjectID and " + "Bug.ProgressStatusID = ProgressStatusTypes.ProgressStatusID and " + "Bug.ProjectID = ProgressStatusTypes.ProjectID and " + "Bug2.ProgressStatusID = ProgressStatusTypes2.ProgressStatusID and " + "Bug2.ProjectID = ProgressStatusTypes2.ProjectID and " + "Project.ProjectName like '" + PID + "%' " + "UNION " + "SELECT Bug.ProblemID as WR, ProgressStatusTypes.ProgressStatusName as WRStatus, Bug2.ProblemID as VAR, ProgressStatusTypes2.ProgressStatusName as VARStatus, Bug2.TaskPlannedStartDate as VARNeedByDate, Bug2.CrntForwardTypeID as VARPriority " + "FROM SWISEDB.dbo.Bug, SWISEDB.dbo.Bug Bug2, SWISEDB.dbo.BugLinks, SWISEDB.dbo.Project, SWISEDB.dbo.ProgressStatusTypes, SWISEDB.dbo.ProgressStatusTypes ProgressStatusTypes2 " + "WHERE " + "Bug.ProjectID = 17 and Bug2.ProjectID = Project.ProjectID and " + "BugLinks.BugID = Bug.BugID and " + "BugLinks.ProjectID = Bug.ProjectID and " + "BugLinks.LinkedProjectID = Project.ProjectID and " + "Bug2.BugID = BugLinks.LinkedBugID and " + "Bug2.ProjectID = BugLinks.LinkedProjectID and " + "Bug.ProgressStatusID = ProgressStatusTypes.ProgressStatusID and " + "Bug.ProjectID = ProgressStatusTypes.ProjectID and " + "Bug2.ProgressStatusID = ProgressStatusTypes2.ProgressStatusID and " + "Bug2.ProjectID = ProgressStatusTypes2.ProjectID and " + "Project.ProjectName like '" + PID + "%' ) q" + "Left Join ForwardTypes on ForwardTypes.ProjectID = 1450 and ForwardTypes.OrderNo+1 = VARPriority"; #endregion cmd = new SqlCommand(qryStr); cmd.Connection = con; rdr = cmd.ExecuteReader(); while (rdr.HasRows) { while (rdr.Read()) { string dWR = ""; string dWRstatus = ""; string dIVnum = ""; string dIVstatus = ""; string dNBD = "Date Not Set";//need by date string dNBE = "Event Not Set";//need by event try { dWR = rdr[0].ToString().Substring(3, rdr[0].ToString().Length - 3); } catch { } try { dWRstatus = rdr[1].ToString(); } catch { } try { dIVnum = rdr[2].ToString(); } catch { } try { dIVstatus = rdr[3].ToString(); } catch { } try { dNBD = rdr[4].ToString(); if (dNBD == "") dNBD = "Date Not Set"; } catch { dNBD = "Date Not Set"; } try { dNBE = rdr[5].ToString(); } catch { dNBE = "Event Not Set"; } DevT d = new DevT(dWR, dWRstatus, dIVnum, dIVstatus,dNBD,dNBE); dis.Add(d); } rdr.NextResult(); } } catch (Exception e) { string m = e.Message; rdr = null; } finally { if (rdr != null) { rdr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } } return dis; }