public IEnumerable<Field> GetFields(Guid id) { if (id == Guid.Empty) { return null; } IList<Core.Business.Field> fieldlist = new List<Core.Business.Field>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSqlReader(Sql_GetFields); if (reader != null) { while (reader.Read()) { Core.Business.Field field = new Core.Business.Field(); if (!reader.IsDBNull(0)) field.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) field.FieldName = reader.GetString(1); field.MarkOld(); fieldlist.Add(field); } reader.Close(); } return fieldlist; }
public IList<Core.Business.Field> GetFieldByPage(int pagenumber,int pagesize) { IList<Core.Business.Field> fieldlist = new List<Core.Business.Field>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Tables", SqlDbType.VarChar, "Field"); sql.AddParameter("@PK", SqlDbType.VarChar, "FieldID"); sql.AddParameter("@PageNumber", SqlDbType.Int, pagenumber); sql.AddParameter("@PageSize", SqlDbType.Int, pagesize); //sql.AddParameter("@LawSortID", SqlDbType.UniqueIdentifier, sortId); SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount"); if (reader != null) { while (reader.Read()) { Core.Business.Field field = new Core.Business.Field(); if (!reader.IsDBNull(0)) field.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) field.FieldName = reader.GetString(1); field.MarkOld(); fieldlist.Add(field); } reader.Close(); } return fieldlist; }
public IList<Core.Business.Field> GetAllField() { IList<Core.Business.Field> fieldlist = new List<Core.Business.Field>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectFieldsAll"); if(reader != null) { while(reader.Read()) { Core.Business.Field field = new Core.Business.Field(); if (!reader.IsDBNull(0)) field.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) field.FieldName = reader.GetString(1); field.MarkOld(); fieldlist.Add(field); } reader.Close(); } return fieldlist; }
public Core.Business.Field Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@FieldID", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectField"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Field field = new Core.Business.Field(); if (!reader.IsDBNull(0)) field.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) field.FieldName = reader.GetString(1); reader.Close(); return field; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }