public IList<Core.Business.SurveyTable> GetSurveyTableBySql(string sqlwhere)
        {
            IList<Core.Business.SurveyTable> surveyTablelist = new List<Core.Business.SurveyTable>();
            SqlServerUtility sql = new SqlServerUtility();
            string sqlstr = "SELECT [Id],[surveyID],[Type],[ApplicaiotnUser],[UnitID],[MACHINESETID],[GroupName],[GroupMember],[TEL],[ApplicationTime],[quarterTime],[serviceTime],[externalTime],[sampleNum],[externaSampleNum],[income],[itemCount],[externalItemCount],[enterpriseCount],[hasCollection],[CollectionStatus],[feedback],[feedbackTime],[advanced],[AuditDes],[Status],[Annex] FROM [dbo].[surveyTable]";
            sqlstr += sqlwhere;
            SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.SurveyTable surveyTable = new Core.Business.SurveyTable();

                    if (!reader.IsDBNull(0)) surveyTable.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) surveyTable.SurveyID = reader.GetGuid(1);
                    if (!reader.IsDBNull(2)) surveyTable.Type = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) surveyTable.ApplicaiotnUser = reader.GetGuid(3);
                    if (!reader.IsDBNull(4)) surveyTable.UnitID = reader.GetGuid(4);
                    if (!reader.IsDBNull(5)) surveyTable.MACHINESETID = reader.GetGuid(5);
                    if (!reader.IsDBNull(6)) surveyTable.GroupName = reader.GetString(6);
                    if (!reader.IsDBNull(7)) surveyTable.GroupMember = reader.GetString(7);
                    if (!reader.IsDBNull(8)) surveyTable.TEL = reader.GetString(8);
                    if (!reader.IsDBNull(9)) surveyTable.ApplicationTime = reader.GetDateTime(9);
                    if (!reader.IsDBNull(10)) surveyTable.QuarterTime = reader.GetInt32(10);
                    if (!reader.IsDBNull(11)) surveyTable.ServiceTime = reader.GetInt32(11);
                    if (!reader.IsDBNull(12)) surveyTable.ExternalTime = reader.GetInt32(12);
                    if (!reader.IsDBNull(13)) surveyTable.SampleNum = reader.GetInt32(13);
                    if (!reader.IsDBNull(14)) surveyTable.ExternaSampleNum = reader.GetInt32(14);
                    if (!reader.IsDBNull(15)) surveyTable.Income = reader.GetDouble(15);
                    if (!reader.IsDBNull(16)) surveyTable.ItemCount = reader.GetInt32(16);
                    if (!reader.IsDBNull(17)) surveyTable.ExternalItemCount = reader.GetInt32(17);
                    if (!reader.IsDBNull(18)) surveyTable.EnterpriseCount = reader.GetInt32(18);
                    if (!reader.IsDBNull(19)) surveyTable.HasCollection = reader.GetInt32(19);
                    if (!reader.IsDBNull(20)) surveyTable.CollectionStatus = reader.GetInt32(20);
                    if (!reader.IsDBNull(21)) surveyTable.Feedback = reader.GetInt32(21);
                    if (!reader.IsDBNull(22)) surveyTable.FeedbackTime = reader.GetString(22);
                    if (!reader.IsDBNull(23)) surveyTable.Advanced = reader.GetString(23);
                    if (!reader.IsDBNull(24)) surveyTable.AuditDes = reader.GetString(24);
                    if (!reader.IsDBNull(25)) surveyTable.Status = reader.GetInt32(25);
                    if (!reader.IsDBNull(26)) surveyTable.Annex = reader.GetInt32(26);

                    surveyTable.MarkOld();
                    surveyTablelist.Add(surveyTable);
                }
                reader.Close();
            }
            return surveyTablelist;
        }
        public IList<Core.Business.SurveyTable> GetAllSurveyTable()
        {
            IList<Core.Business.SurveyTable> surveyTablelist = new List<Core.Business.SurveyTable>();
            SqlServerUtility sql = new SqlServerUtility();

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

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.SurveyTable surveyTable = new Core.Business.SurveyTable();

                    if (!reader.IsDBNull(0)) surveyTable.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) surveyTable.SurveyID = reader.GetGuid(1);
                    if (!reader.IsDBNull(2)) surveyTable.Type = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) surveyTable.ApplicaiotnUser = reader.GetGuid(3);
                    if (!reader.IsDBNull(4)) surveyTable.UnitID = reader.GetGuid(4);
                    if (!reader.IsDBNull(5)) surveyTable.MACHINESETID = reader.GetGuid(5);
                    if (!reader.IsDBNull(6)) surveyTable.GroupName = reader.GetString(6);
                    if (!reader.IsDBNull(7)) surveyTable.GroupMember = reader.GetString(7);
                    if (!reader.IsDBNull(8)) surveyTable.TEL = reader.GetString(8);
                    if (!reader.IsDBNull(9)) surveyTable.ApplicationTime = reader.GetDateTime(9);
                    if (!reader.IsDBNull(10)) surveyTable.QuarterTime = reader.GetInt32(10);
                    if (!reader.IsDBNull(11)) surveyTable.ServiceTime = reader.GetInt32(11);
                    if (!reader.IsDBNull(12)) surveyTable.ExternalTime = reader.GetInt32(12);
                    if (!reader.IsDBNull(13)) surveyTable.SampleNum = reader.GetInt32(13);
                    if (!reader.IsDBNull(14)) surveyTable.ExternaSampleNum = reader.GetInt32(14);
                    if (!reader.IsDBNull(15)) surveyTable.Income = reader.GetDouble(15);
                    if (!reader.IsDBNull(16)) surveyTable.ItemCount = reader.GetInt32(16);
                    if (!reader.IsDBNull(17)) surveyTable.ExternalItemCount = reader.GetInt32(17);
                    if (!reader.IsDBNull(18)) surveyTable.EnterpriseCount = reader.GetInt32(18);
                    if (!reader.IsDBNull(19)) surveyTable.HasCollection = reader.GetInt32(19);
                    if (!reader.IsDBNull(20)) surveyTable.CollectionStatus = reader.GetInt32(20);
                    if (!reader.IsDBNull(21)) surveyTable.Feedback = reader.GetInt32(21);
                    if (!reader.IsDBNull(22)) surveyTable.FeedbackTime = reader.GetString(22);
                    if (!reader.IsDBNull(23)) surveyTable.Advanced = reader.GetString(23);
                    if (!reader.IsDBNull(24)) surveyTable.AuditDes = reader.GetString(24);
                    if (!reader.IsDBNull(25)) surveyTable.Status = reader.GetInt32(25);
                    if (!reader.IsDBNull(26)) surveyTable.Annex = reader.GetInt32(26);

                    surveyTable.MarkOld();
                    surveyTablelist.Add(surveyTable);
                }
                reader.Close();
            }
            return surveyTablelist;
        }
        public Core.Business.SurveyTable Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) surveyTable.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) surveyTable.SurveyID = reader.GetGuid(1);
                if (!reader.IsDBNull(2)) surveyTable.Type = reader.GetInt32(2);
                if (!reader.IsDBNull(3)) surveyTable.ApplicaiotnUser = reader.GetGuid(3);
                if (!reader.IsDBNull(4)) surveyTable.UnitID = reader.GetGuid(4);
                if (!reader.IsDBNull(5)) surveyTable.MACHINESETID = reader.GetGuid(5);
                if (!reader.IsDBNull(6)) surveyTable.GroupName = reader.GetString(6);
                if (!reader.IsDBNull(7)) surveyTable.GroupMember = reader.GetString(7);
                if (!reader.IsDBNull(8)) surveyTable.TEL = reader.GetString(8);
                if (!reader.IsDBNull(9)) surveyTable.ApplicationTime = reader.GetDateTime(9);
                if (!reader.IsDBNull(10)) surveyTable.QuarterTime = reader.GetInt32(10);
                if (!reader.IsDBNull(11)) surveyTable.ServiceTime = reader.GetInt32(11);
                if (!reader.IsDBNull(12)) surveyTable.ExternalTime = reader.GetInt32(12);
                if (!reader.IsDBNull(13)) surveyTable.SampleNum = reader.GetInt32(13);
                if (!reader.IsDBNull(14)) surveyTable.ExternaSampleNum = reader.GetInt32(14);
                if (!reader.IsDBNull(15)) surveyTable.Income = reader.GetDouble(15);
                if (!reader.IsDBNull(16)) surveyTable.ItemCount = reader.GetInt32(16);
                if (!reader.IsDBNull(17)) surveyTable.ExternalItemCount = reader.GetInt32(17);
                if (!reader.IsDBNull(18)) surveyTable.EnterpriseCount = reader.GetInt32(18);
                if (!reader.IsDBNull(19)) surveyTable.HasCollection = reader.GetInt32(19);
                if (!reader.IsDBNull(20)) surveyTable.CollectionStatus = reader.GetInt32(20);
                if (!reader.IsDBNull(21)) surveyTable.Feedback = reader.GetInt32(21);
                if (!reader.IsDBNull(22)) surveyTable.FeedbackTime = reader.GetString(22);
                if (!reader.IsDBNull(23)) surveyTable.Advanced = reader.GetString(23);
                if (!reader.IsDBNull(24)) surveyTable.AuditDes = reader.GetString(24);
                if (!reader.IsDBNull(25)) surveyTable.Status = reader.GetInt32(25);
                if (!reader.IsDBNull(26)) surveyTable.Annex = reader.GetInt32(26);

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

                return null;
            }
        }