public static List <Dal.Models.Specialty> GetSpecialtyList(int iActivityID, bool bJustTop, OleDbConnection conn, OleDbTransaction tran = null) { string strSql = " SELECT * FROM V_SPECIALTY WHERE ACTIVITYID = ? AND PARENTID IS NULL ORDER BY ORDINAL "; List <Dal.Models.Specialty> lstSpecialty = Dal.OleDbHlper.GetList <Dal.Models.Specialty>( strSql, conn, CommandType.Text, tran, new OleDbParameter("@ActivityID", OleDbType.Integer) { Value = iActivityID }); if (bJustTop) { return(lstSpecialty); } else { List <Dal.Models.Specialty> lstAllSpecialty = new List <Dal.Models.Specialty>(); foreach (Dal.Models.Specialty item in lstSpecialty) { lstAllSpecialty.Add(item); List <Dal.Models.Specialty> lstChild = Specialty.GetChildList(item.SpecialtyID.Value, conn, tran); if (lstChild.Count > 0) { lstAllSpecialty.AddRange(lstChild); } } return(lstAllSpecialty); } }
public static List <Dal.Models.Specialty> GetSpecialtyDropList(int iActivityID, string strUserType, int iUserID, bool bJustTop, OleDbConnection conn, OleDbTransaction tran = null) { string strSql = " SELECT s.* FROM V_SPECIALTY s WHERE ACTIVITYID = ? "; strSql += " and s.SpecialtyID not in (SELECT SpecialtyID FROM Prize)"; if (strUserType == "0804") { strSql += " and s.SpecialtyID in (SELECT u.SpecialtyID FROM UserSpecialty u where UserID = " + iUserID + ") "; } strSql += " AND PARENTID IS NULL ORDER BY ORDINAL"; List <Dal.Models.Specialty> lstSpecialty = Dal.OleDbHlper.GetList <Dal.Models.Specialty>( strSql, conn, CommandType.Text, tran, new OleDbParameter("@ActivityID", OleDbType.Integer) { Value = iActivityID }); if (bJustTop) { return(lstSpecialty); } else { List <Dal.Models.Specialty> lstAllSpecialty = new List <Dal.Models.Specialty>(); foreach (Dal.Models.Specialty item in lstSpecialty) { lstAllSpecialty.Add(item); List <Dal.Models.Specialty> lstChild = Specialty.GetChildList(item.SpecialtyID.Value, conn, tran); if (lstChild.Count > 0) { lstAllSpecialty.AddRange(lstChild); } } return(lstAllSpecialty); } }