示例#1
0
        public IList<Core.Business.NoteRange> GetAllNoteRange()
        {
            IList<Core.Business.NoteRange> noteRangelist = new List<Core.Business.NoteRange>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllNoteRange);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.NoteRange noteRange = new Core.Business.NoteRange();

                    if (!reader.IsDBNull(0)) noteRange.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) noteRange.NoteKey = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) noteRange.ModuleKey = reader.GetString(2);
                    if (!reader.IsDBNull(3)) noteRange.ReciverType = reader.GetInt32(3);
                    if (!reader.IsDBNull(4)) noteRange.ReciverKey = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) noteRange.NoteState = reader.GetInt32(5);

                    noteRange.MarkOld();
                    noteRangelist.Add(noteRange);
                }
                reader.Close();
            }
            return noteRangelist;
        }
示例#2
0
        public Core.Business.NoteRange GetNoteRangeByNoteAndReciver(int notekey, int reciverkey)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@NoteKey", SqlDbType.Int, notekey);
            sql.AddParameter("@ReciverKey", SqlDbType.Int, reciverkey);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetNoteRangeByNoteAndReciver);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.NoteRange noteRange = new Core.Business.NoteRange();

                if (!reader.IsDBNull(0)) noteRange.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) noteRange.NoteKey = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) noteRange.ModuleKey = reader.GetString(2);
                if (!reader.IsDBNull(3)) noteRange.ReciverType = reader.GetInt32(3);
                if (!reader.IsDBNull(4)) noteRange.ReciverKey = reader.GetInt32(4);
                if (!reader.IsDBNull(5)) noteRange.NoteState = reader.GetInt32(5);
                noteRange.MarkOld();
                return noteRange;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }