public static PrgNORelativeCollection GetPrgNORelatives(string _prgNo, string _prgType) { SqlDataAdapter _sqldr = new SqlDataAdapter(string.Format("select prgnorelative.PrgRelative_No AS ProgramNo ,isnull(prgnorelative.AlternateName,'') AS AlternateName ,isNull(prgno.prg_nm,'') AS ProgramName,isnull(prgno.prg_url,'') AS ProgramURL , prgnorelative.id AS MenuDLId from prgno,prgnorelative where prgnorelative.PrgRelative_No = prgno.prg_no and prgnorelative.prg_no = '{0}' and prgnorelative.prg_ty = '{1}' order by prgnorelative.prg_Sr ", _prgNo, _prgType), SSoft.Data.MainDatabase.ConnectString); DataTable _dt = new DataTable(); _sqldr.Fill(_dt); PrgNORelativeCollection _collection = new PrgNORelativeCollection(); foreach (DataRow row in _dt.Rows) { PrgNORelative _item = new PrgNORelative(); _item.ProgramNo = (string)row[0]; _item.AlternateName = (string)row[1]; _item.ProgramName = (string)row[2]; _item.ProgramURL = (string)row[3]; _item.MenuDLId = Convert.ToInt32(row[4]); _collection.Add(_item); } return(_collection); }
public static PrgNORelative GetPrgNORelative(string _prgnorelative_id) { SqlDataAdapter _sqldr = new SqlDataAdapter(string.Format("select prgnorelative.PrgRelative_No AS ProgramNo ,isnull(prgnorelative.AlternateName,'') AS AlternateName ,isNull(prgno.prg_nm,'') AS ProgramName,isnull(prgno.prg_url,'') AS ProgramURL , prgnorelative.id AS MenuDLId from prgno,prgnorelative where prgnorelative.PrgRelative_No = prgno.prg_no and prgnorelative.id={0}", _prgnorelative_id), SSoft.Data.MainDatabase.ConnectString); DataTable _dt = new DataTable(); _sqldr.Fill(_dt); if ((_dt.Rows.Count) == 0) { return(null); } DataRow row = _dt.Rows[0]; PrgNORelative _item = new PrgNORelative(); _item.ProgramNo = (string)row[0]; _item.AlternateName = (string)row[1]; _item.ProgramName = (string)row[2]; _item.ProgramURL = (string)row[3]; _item.MenuDLId = Convert.ToInt32(row[4]); return(_item); }