public Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit FindUnitNewestAppforSub_Coop(Guid stimtype, Guid UnitID)
        {
            SqlServerUtility sql = new SqlServerUtility();
            string sqlstr = "SELECT [dbo].[StimulationApplicationForSubCenterAndCollaborateUnit].* FROM [StimulationApplicationForSubCenterAndCollaborateUnit] JOIN [dbo].[StimulationAppliction] ON [dbo].[StimulationApplicationForSubCenterAndCollaborateUnit].Id=[dbo].[StimulationAppliction].Id and [dbo].[StimulationAppliction].StimulationAndTypeId='";
            sqlstr += stimtype + "' Where UintId='";
            sqlstr += UnitID + "'";
            SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);

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

                if (!reader.IsDBNull(0)) stimulationApplicationForSubCenterAndCollaborateUnit.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) stimulationApplicationForSubCenterAndCollaborateUnit.FieldType = reader.GetGuid(1);
                if (!reader.IsDBNull(2)) stimulationApplicationForSubCenterAndCollaborateUnit.UintId = reader.GetGuid(2);
                if (!reader.IsDBNull(3)) stimulationApplicationForSubCenterAndCollaborateUnit.StimulationContentType = reader.GetInt32(3);
                if (!reader.IsDBNull(4)) stimulationApplicationForSubCenterAndCollaborateUnit.DraftWriter = reader.GetString(4);
                if (!reader.IsDBNull(5)) stimulationApplicationForSubCenterAndCollaborateUnit.DetailWriter = reader.GetString(5);
                if (!reader.IsDBNull(6)) stimulationApplicationForSubCenterAndCollaborateUnit.FillDate = reader.GetDateTime(6);
                if (!reader.IsDBNull(7)) stimulationApplicationForSubCenterAndCollaborateUnit.State = reader.GetInt32(7);
                if (!reader.IsDBNull(8)) stimulationApplicationForSubCenterAndCollaborateUnit.WorkingHourPerEquipment = reader.GetInt32(8);
                if (!reader.IsDBNull(9)) stimulationApplicationForSubCenterAndCollaborateUnit.ProjectPerEquipment = reader.GetString(9);
                if (!reader.IsDBNull(10)) stimulationApplicationForSubCenterAndCollaborateUnit.WebSiteCondition = reader.GetString(10);
                if (!reader.IsDBNull(11)) stimulationApplicationForSubCenterAndCollaborateUnit.ShareCondition = reader.GetString(11);
                if (!reader.IsDBNull(12)) stimulationApplicationForSubCenterAndCollaborateUnit.Notice = reader.GetString(12);
                if (!reader.IsDBNull(13)) stimulationApplicationForSubCenterAndCollaborateUnit.Conclusion = reader.GetString(13);
                if (!reader.IsDBNull(14)) stimulationApplicationForSubCenterAndCollaborateUnit.PaperNbr = reader.GetString(14);
                if (!reader.IsDBNull(15)) stimulationApplicationForSubCenterAndCollaborateUnit.FunctionDevelopNbr = reader.GetString(15);
                if (!reader.IsDBNull(16)) stimulationApplicationForSubCenterAndCollaborateUnit.DynamicInfoCollectingBoxNbr = reader.GetString(16);
                if (!reader.IsDBNull(17)) stimulationApplicationForSubCenterAndCollaborateUnit.DynamicInfoCollectingBoxCondition = reader.GetString(17);
                if (!reader.IsDBNull(18)) stimulationApplicationForSubCenterAndCollaborateUnit.WorkInfoNub = reader.GetString(18);
                if (!reader.IsDBNull(19)) stimulationApplicationForSubCenterAndCollaborateUnit.Score = reader.GetInt32(19);

                reader.Close();
                stimulationApplicationForSubCenterAndCollaborateUnit.MarkOld();
                return stimulationApplicationForSubCenterAndCollaborateUnit;

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

                return null;
            }
        }
        public IList<Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit> GetAllStimulationApplicationForSubCenterAndCollaborateUnit()
        {
            IList<Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit> stimulationApplicationForSubCenterAndCollaborateUnitlist = new List<Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit>();
            SqlServerUtility sql = new SqlServerUtility();

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit stimulationApplicationForSubCenterAndCollaborateUnit = new Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit();

                    if (!reader.IsDBNull(0)) stimulationApplicationForSubCenterAndCollaborateUnit.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) stimulationApplicationForSubCenterAndCollaborateUnit.FieldType = reader.GetGuid(1);
                    if (!reader.IsDBNull(2)) stimulationApplicationForSubCenterAndCollaborateUnit.UintId = reader.GetGuid(2);
                    if (!reader.IsDBNull(3)) stimulationApplicationForSubCenterAndCollaborateUnit.StimulationContentType = reader.GetInt32(3);
                    if (!reader.IsDBNull(4)) stimulationApplicationForSubCenterAndCollaborateUnit.DraftWriter = reader.GetString(4);
                    if (!reader.IsDBNull(5)) stimulationApplicationForSubCenterAndCollaborateUnit.DetailWriter = reader.GetString(5);
                    if (!reader.IsDBNull(6)) stimulationApplicationForSubCenterAndCollaborateUnit.FillDate = reader.GetDateTime(6);
                    if (!reader.IsDBNull(7)) stimulationApplicationForSubCenterAndCollaborateUnit.State = reader.GetInt32(7);
                    if (!reader.IsDBNull(8)) stimulationApplicationForSubCenterAndCollaborateUnit.WorkingHourPerEquipment = reader.GetInt32(8);
                    if (!reader.IsDBNull(9)) stimulationApplicationForSubCenterAndCollaborateUnit.ProjectPerEquipment = reader.GetString(9);
                    if (!reader.IsDBNull(10)) stimulationApplicationForSubCenterAndCollaborateUnit.WebSiteCondition = reader.GetString(10);
                    if (!reader.IsDBNull(11)) stimulationApplicationForSubCenterAndCollaborateUnit.ShareCondition = reader.GetString(11);
                    if (!reader.IsDBNull(12)) stimulationApplicationForSubCenterAndCollaborateUnit.Notice = reader.GetString(12);
                    if (!reader.IsDBNull(13)) stimulationApplicationForSubCenterAndCollaborateUnit.Conclusion = reader.GetString(13);
                    if (!reader.IsDBNull(14)) stimulationApplicationForSubCenterAndCollaborateUnit.PaperNbr = reader.GetString(14);
                    if (!reader.IsDBNull(15)) stimulationApplicationForSubCenterAndCollaborateUnit.FunctionDevelopNbr = reader.GetString(15);
                    if (!reader.IsDBNull(16)) stimulationApplicationForSubCenterAndCollaborateUnit.DynamicInfoCollectingBoxNbr = reader.GetString(16);
                    if (!reader.IsDBNull(17)) stimulationApplicationForSubCenterAndCollaborateUnit.DynamicInfoCollectingBoxCondition = reader.GetString(17);
                    if (!reader.IsDBNull(18)) stimulationApplicationForSubCenterAndCollaborateUnit.WorkInfoNub = reader.GetString(18);
                    if (!reader.IsDBNull(19)) stimulationApplicationForSubCenterAndCollaborateUnit.Score = reader.GetInt32(19);

                    stimulationApplicationForSubCenterAndCollaborateUnit.MarkOld();
                    stimulationApplicationForSubCenterAndCollaborateUnitlist.Add(stimulationApplicationForSubCenterAndCollaborateUnit);
                }
                reader.Close();
            }
            return stimulationApplicationForSubCenterAndCollaborateUnitlist;
        }
        public Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) stimulationApplicationForSubCenterAndCollaborateUnit.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) stimulationApplicationForSubCenterAndCollaborateUnit.FieldType = reader.GetGuid(1);
                if (!reader.IsDBNull(2)) stimulationApplicationForSubCenterAndCollaborateUnit.UintId = reader.GetGuid(2);
                if (!reader.IsDBNull(3)) stimulationApplicationForSubCenterAndCollaborateUnit.StimulationContentType = reader.GetInt32(3);
                if (!reader.IsDBNull(4)) stimulationApplicationForSubCenterAndCollaborateUnit.DraftWriter = reader.GetString(4);
                if (!reader.IsDBNull(5)) stimulationApplicationForSubCenterAndCollaborateUnit.DetailWriter = reader.GetString(5);
                if (!reader.IsDBNull(6)) stimulationApplicationForSubCenterAndCollaborateUnit.FillDate = reader.GetDateTime(6);
                if (!reader.IsDBNull(7)) stimulationApplicationForSubCenterAndCollaborateUnit.State = reader.GetInt32(7);
                if (!reader.IsDBNull(8)) stimulationApplicationForSubCenterAndCollaborateUnit.WorkingHourPerEquipment = reader.GetInt32(8);
                if (!reader.IsDBNull(9)) stimulationApplicationForSubCenterAndCollaborateUnit.ProjectPerEquipment = reader.GetString(9);
                if (!reader.IsDBNull(10)) stimulationApplicationForSubCenterAndCollaborateUnit.WebSiteCondition = reader.GetString(10);
                if (!reader.IsDBNull(11)) stimulationApplicationForSubCenterAndCollaborateUnit.ShareCondition = reader.GetString(11);
                if (!reader.IsDBNull(12)) stimulationApplicationForSubCenterAndCollaborateUnit.Notice = reader.GetString(12);
                if (!reader.IsDBNull(13)) stimulationApplicationForSubCenterAndCollaborateUnit.Conclusion = reader.GetString(13);
                if (!reader.IsDBNull(14)) stimulationApplicationForSubCenterAndCollaborateUnit.PaperNbr = reader.GetString(14);
                if (!reader.IsDBNull(15)) stimulationApplicationForSubCenterAndCollaborateUnit.FunctionDevelopNbr = reader.GetString(15);
                if (!reader.IsDBNull(16)) stimulationApplicationForSubCenterAndCollaborateUnit.DynamicInfoCollectingBoxNbr = reader.GetString(16);
                if (!reader.IsDBNull(17)) stimulationApplicationForSubCenterAndCollaborateUnit.DynamicInfoCollectingBoxCondition = reader.GetString(17);
                if (!reader.IsDBNull(18)) stimulationApplicationForSubCenterAndCollaborateUnit.WorkInfoNub = reader.GetString(18);
                if (!reader.IsDBNull(19)) stimulationApplicationForSubCenterAndCollaborateUnit.Score = reader.GetInt32(19);

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

                return null;
            }
        }