Exemplo n.º 1
0
        public IList<Core.Business.Note> GetAllLawRepositoryByPage(string sqlwhere, int pagenumber, int pagesize)
        {
            IList<Core.Business.Note> lawRepositorylist = new List<Core.Business.Note>();

            SqlServerUtility sql = new SqlServerUtility();

            int lowband = (pagenumber - 1) * pagesize;

            int highband = pagenumber * pagesize + 1;

            sql.AddParameter("@lowband", SqlDbType.Int, lowband);

            sql.AddParameter("@highband", SqlDbType.Int, highband);

            SqlDataReader reader = sql.ExecuteSqlReader(string.Format(Sql_ContentPaged, sqlwhere));

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Note note = new Core.Business.Note();

                    if (!reader.IsDBNull(0)) note.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) note.NoteTitle = reader.GetString(1);
                    if (!reader.IsDBNull(2)) note.NoteContent = reader.GetString(2);
                    if (!reader.IsDBNull(3)) note.NoteDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) note.NoteTimes = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) note.NoteType = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) note.PulisherKey = reader.GetInt32(6);
                    if (!reader.IsDBNull(7)) note.PulishModule = reader.GetInt32(7);
                    if (!reader.IsDBNull(8)) note.IsFront = reader.GetBoolean(8);
                    note.MarkOld();
                    lawRepositorylist.Add(note);
                }
                reader.Close();
            }
            return lawRepositorylist;
            //return lawRepositorylist.OrderBy(item => item.Index).Reverse().OrderBy(item => item.PublishTime).Reverse().OrderBy(item => item.SortTime).Reverse().ToList();
        }
Exemplo n.º 2
0
        public IList<Core.Business.Note> GetAllNote()
        {
            IList<Core.Business.Note> notelist = new List<Core.Business.Note>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllNote);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Note note = new Core.Business.Note();

                    if (!reader.IsDBNull(0)) note.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) note.NoteTitle = reader.GetString(1);
                    if (!reader.IsDBNull(2)) note.NoteContent = reader.GetString(2);
                    if (!reader.IsDBNull(3)) note.NoteDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) note.NoteTimes = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) note.NoteType = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) note.PulisherKey = reader.GetInt32(6);
                    if (!reader.IsDBNull(7)) note.PulishModule = reader.GetInt32(7);
                    if (!reader.IsDBNull(8)) note.IsFront = reader.GetBoolean(8);

                    note.MarkOld();
                    notelist.Add(note);
                }
                reader.Close();
            }
            return notelist;
        }
Exemplo n.º 3
0
        public IEnumerable<Note> Search(NoteSearchJson json, PagingInfo pageinfo)
        {
            if (json == null || pageinfo == null)
            {
                throw new ArgumentNullException("the pageinfo is null ");
            }

            IList<Core.Business.Note> notelist = new List<Core.Business.Note>();

            SqlServerUtility sql = new SqlServerUtility();

            if (!string.IsNullOrEmpty(json.Title))
            {
                sql.AddParameter("@title", SqlDbType.NVarChar, json.Title);
            }
            if (json.Reciever != null && json.Reciever.Value > 0)
            {
                sql.AddParameter("@reciever", SqlDbType.NVarChar, json.Reciever.Value);
            }

            if (json.Sender != null && json.Sender.Value > 0)
            {
                sql.AddParameter("@sender", SqlDbType.Int, json.Sender.Value);
            }

            if (!string.IsNullOrEmpty(json.Depart))
            {
                sql.AddParameter("@depart", SqlDbType.NVarChar, json.Depart);
            }

            if (json.Status != null)
            {
                sql.AddParameter("@status", SqlDbType.Int, json.Status.Value);
            }
            if (json.Type != null && json.Type.HasValue)
            {
                sql.AddParameter("@type", SqlDbType.Int, json.Type.Value);
            }

            sql.AddParameter("@deletestatus", SqlDbType.Int, json.DeleteStatus.Value);

            int lowBand = (pageinfo.CurrentPage - 1) * pageinfo.PageSize;

            int highBand = pageinfo.PageSize * pageinfo.PageSize;

            sql.AddParameter("@lowband", SqlDbType.Int, lowBand);

            sql.AddParameter("@highband", SqlDbType.Int, highBand);

            SqlDataReader reader = sql.ExecuteSPReader("Search_NotePaged");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Note note = new Core.Business.Note();

                    if (!reader.IsDBNull(0)) note.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) note.NoteTitle = reader.GetString(1);
                    if (!reader.IsDBNull(2)) note.NoteContent = reader.GetString(2);
                    if (!reader.IsDBNull(3)) note.NoteDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) note.NoteTimes = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) note.NoteType = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) note.PulisherKey = reader.GetInt32(6);
                    if (!reader.IsDBNull(7)) note.PulishModule = reader.GetInt32(7);
                    if (!reader.IsDBNull(8)) note.IsFront = reader.GetBoolean(8);

                    note.MarkOld();
                    notelist.Add(note);
                }
                reader.Close();
            }
            return notelist;
        }
Exemplo n.º 4
0
        public Core.Business.Note Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectNote);

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

                if (!reader.IsDBNull(0)) note.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) note.NoteTitle = reader.GetString(1);
                if (!reader.IsDBNull(2)) note.NoteContent = reader.GetString(2);
                if (!reader.IsDBNull(3)) note.NoteDate = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) note.NoteTimes = reader.GetInt32(4);
                if (!reader.IsDBNull(5)) note.NoteType = reader.GetInt32(5);
                if (!reader.IsDBNull(6)) note.PulisherKey = reader.GetInt32(6);
                if (!reader.IsDBNull(7)) note.PulishModule = reader.GetInt32(7);
                if (!reader.IsDBNull(8)) note.IsFront = reader.GetBoolean(8);
                reader.Close();
                return note;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Exemplo n.º 5
0
        public IList<Core.Business.Note> Search(string title, int cate)
        {
            IList<Core.Business.Note> notelist = new List<Core.Business.Note>();
            SqlServerUtility sql = new SqlServerUtility();
            string sqlstr = String.Empty;
            if (title == string.Empty || title == "" || (String.IsNullOrEmpty(title)))
            {
                sqlstr = SqlSearchByCate;
                sql.AddParameter("@NoteType", SqlDbType.Int, cate);
            }
            else if (cate == 3)
            {
                sqlstr = SqlSearchByTitle;
                sql.AddParameter("@NoteTitle", SqlDbType.NVarChar, title);
            }
            else
            {
                sqlstr = SqlSearchByCateAndTitle;
                sql.AddParameter("@NoteTitle", SqlDbType.NVarChar, title);
                sql.AddParameter("@NoteType", SqlDbType.Int, cate);
            }

            SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);

            if (reader != null && !reader.IsClosed)
            {
                while (reader.Read())
                {
                    Core.Business.Note note = new Core.Business.Note();

                    if (!reader.IsDBNull(0)) note.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) note.NoteTitle = reader.GetString(1);
                    if (!reader.IsDBNull(2)) note.NoteContent = reader.GetString(2);
                    if (!reader.IsDBNull(3)) note.NoteDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) note.NoteTimes = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) note.NoteType = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) note.PulisherKey = reader.GetInt32(6);
                    if (!reader.IsDBNull(7)) note.PulishModule = reader.GetInt32(7);
                    if (!reader.IsDBNull(8)) note.IsFront = reader.GetBoolean(8);

                    note.MarkOld();
                    notelist.Add(note);
                }
                reader.Close();
            }
            return notelist;
        }