Beispiel #1
0
        public IList<Core.Business.Survey> GetAllSurvey()
        {
            IList<Core.Business.Survey> surveylist = new List<Core.Business.Survey>();
            SqlServerUtility sql = new SqlServerUtility();

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

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.Survey survey = new Core.Business.Survey();

                    if (!reader.IsDBNull(0)) survey.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) survey.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) survey.Des = reader.GetString(2);
                    if (!reader.IsDBNull(3)) survey.AddPerson = reader.GetString(3);
                    if (!reader.IsDBNull(4)) survey.AddTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) survey.Status = reader.GetInt32(5);

                    survey.MarkOld();
                    surveylist.Add(survey);
                }
                reader.Close();
            }
            return surveylist;
        }
Beispiel #2
0
        public Core.Business.Survey Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectSurvey");

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

                if (!reader.IsDBNull(0)) survey.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) survey.Name = reader.GetString(1);
                if (!reader.IsDBNull(2)) survey.Des = reader.GetString(2);
                if (!reader.IsDBNull(3)) survey.AddPerson = reader.GetString(3);
                if (!reader.IsDBNull(4)) survey.AddTime = reader.GetDateTime(4);
                if (!reader.IsDBNull(5)) survey.Status = reader.GetInt32(5);

                reader.Close();
                return survey;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Beispiel #3
0
        public Core.Business.Survey SelectByStatus(int status)
        {
            SqlServerUtility sql = new SqlServerUtility();
            string sqlstr = "SELECT [Id],[Name],[Des],[AddPerson],[AddTime],[Status] FROM [dbo].[survey] WHERE [Status] = '"+status+"'";
            SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);
            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.Survey survey = new Core.Business.Survey();

                if (!reader.IsDBNull(0)) survey.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) survey.Name = reader.GetString(1);
                if (!reader.IsDBNull(2)) survey.Des = reader.GetString(2);
                if (!reader.IsDBNull(3)) survey.AddPerson = reader.GetString(3);
                if (!reader.IsDBNull(4)) survey.AddTime = reader.GetDateTime(4);
                if (!reader.IsDBNull(5)) survey.Status = reader.GetInt32(5);

                reader.Close();
                survey.MarkOld();
                return survey;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }