public IList<CY.CYWebsite.Core.Business.Web_News> GetByModuleCode(string strModuleCode) { IList<CY.CYWebsite.Core.Business.Web_News> list_news = new List<CY.CYWebsite.Core.Business.Web_News>(); SqlServerUtility sqlhelper = new SqlServerUtility(); SqlDataReader reader; if (!strModuleCode.Trim().Equals("")) { sqlhelper.AddParameter("@Module_Code", SqlDbType.VarChar, strModuleCode, 10); reader = sqlhelper.ExecuteSqlReader(strSQLSelectByModuleCode.ToString()); } else { reader = sqlhelper.ExecuteSqlReader(SqlGetAllWeb_News.ToString()); } if (reader != null && !reader.IsClosed) { while (reader.Read()) { CY.CYWebsite.Core.Business.Web_News news = new CY.CYWebsite.Core.Business.Web_News(); if (!reader.IsDBNull(0)) { news.Id = reader.GetInt32(0); } if (!reader.IsDBNull(1)) { news.News_Content = reader.GetString(1); } if (!reader.IsDBNull(2)) { news.News_PubDate = reader.GetDateTime(2); } if (!reader.IsDBNull(3)) { news.News_Title = reader.GetString(3); } if (!reader.IsDBNull(4)) { news.Module_Code = reader.GetString(4); } if (!reader.IsDBNull(5)) { news.Manager_Code = reader.GetString(5); } list_news.Add(news); } reader.Close(); return list_news; } return null; }
public IList<Core.Business.WishingComment> GetAllWishingComment() { IList<Core.Business.WishingComment> wishingCommentlist = new List<Core.Business.WishingComment>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); SqlDataReader reader = sql.ExecuteSqlReader(""); if (reader != null) { while (reader.Read()) { Core.Business.WishingComment wishingComment = new Core.Business.WishingComment(); if (!reader.IsDBNull(0)) wishingComment.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) wishingComment.DateCreated = reader.GetDateTime(1); if (!reader.IsDBNull(2)) wishingComment.InstanceId = reader.GetInt64(2); if (!reader.IsDBNull(3)) wishingComment.AuthorId = reader.GetInt64(3); if (!reader.IsDBNull(4)) wishingComment.Content = reader.GetString(4); wishingComment.MarkOld(); wishingCommentlist.Add(wishingComment); } reader.Close(); } return wishingCommentlist; }
public Core.Business.StudentPass GetPassByStdID(int id) { SqlServerUtility sql = new SqlServerUtility(); string sqlwhere = "SELECT [ID], [StuID],[Pass] from [StudentPass] where StuID="+id+""; SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.StudentPass studentPass = new Core.Business.StudentPass(); if (!reader.IsDBNull(0)) studentPass.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) studentPass.StuID = reader.GetInt32(1); if (!reader.IsDBNull(2)) studentPass.Pass = reader.GetString(2); reader.Close(); return studentPass; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<Core.Business.Messages> GetAllMessages() { IList<Core.Business.Messages> messageslist = new List<Core.Business.Messages>(); SqlServerUtility sql = new SqlServerUtility(connectionString); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllMessages); if (reader != null) { while (reader.Read()) { Core.Business.Messages messages = new Core.Business.Messages(); if (!reader.IsDBNull(0)) messages.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) messages.Content = reader.GetString(1); if (!reader.IsDBNull(2)) messages.Type = reader.GetInt32(2); if (!reader.IsDBNull(3)) messages.DateCreated = reader.GetDateTime(3); if (!reader.IsDBNull(4)) messages.SendDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) messages.IsRead = reader.GetInt32(5); if (!reader.IsDBNull(6)) messages.AuthorId = reader.GetInt64(6); if (!reader.IsDBNull(7)) messages.AccountId = reader.GetInt64(7); if (!reader.IsDBNull(8)) messages.Title = reader.GetString(8); if (!reader.IsDBNull(9)) messages.Attachments = reader.GetString(9); if (!reader.IsDBNull(10)) messages.AuthorName = reader.GetString(10); if (!reader.IsDBNull(11)) messages.AccountName = reader.GetString(11); messages.MarkOld(); messageslist.Add(messages); } reader.Close(); } return messageslist; }
public void Delete(Core.Business.FavoritesComment favoritesComment) { SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@Id", SqlDbType.BigInt, favoritesComment.Id); sql.ExecuteSqlReader(SqlDeleteFavoritesComment); }
public void Insert(Core.Business.Asset asset) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@AssetType", SqlDbType.NVarChar, asset.AssetType); sql.AddParameter("@AssetItemName", SqlDbType.NVarChar, asset.AssetItemName); sql.AddParameter("@UnitValue", SqlDbType.Decimal, asset.UnitValue); sql.AddParameter("@PurchasingDate", SqlDbType.DateTime, asset.PurchasingDate); sql.AddParameter("@RegisterDate", SqlDbType.DateTime, asset.RegisterDate); sql.AddParameter("@Num", SqlDbType.Int, asset.Num); SqlDataReader reader = sql.ExecuteSqlReader(SqlInsertAsset); if (reader != null && !reader.IsClosed && reader.Read()) { if (!reader.IsDBNull(0)) asset.Id = int.Parse(reader.GetDecimal(0).ToString()); reader.Close(); } else { if (reader != null && !reader.IsClosed) reader.Close(); } }
public IList<Core.Business.UserAnswer> GetUserAnswerByVoteItemList(IList<CY.CSTS.Core.Business.VoteItem> vIList) { IList<Core.Business.UserAnswer> userAnswerlist = new List<Core.Business.UserAnswer>(); foreach (Core.Business.VoteItem vI in vIList ) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@voteItemID", SqlDbType.Int, vI.Id); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetUserAnswerByVoteItemID); if (reader != null) { while (reader.Read()) { Core.Business.UserAnswer userAnswer = new Core.Business.UserAnswer(); if (!reader.IsDBNull(0)) userAnswer.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) userAnswer.VoteRecordID = reader.GetInt32(1); if (!reader.IsDBNull(2)) userAnswer.VoteItemID = reader.GetInt32(2); if (!reader.IsDBNull(3)) userAnswer.AnswerContent = reader.GetString(3); userAnswer.MarkOld(); userAnswerlist.Add(userAnswer); } reader.Close(); } } return userAnswerlist; }
public IList<Core.Business.PlanCourse> GetAllPlanCourse() { IList<Core.Business.PlanCourse> planCourselist = new List<Core.Business.PlanCourse>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllPlanCourse); if (reader != null) { while (reader.Read()) { Core.Business.PlanCourse planCourse = new Core.Business.PlanCourse(); if (!reader.IsDBNull(0)) planCourse.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) planCourse.PlanCode = reader.GetString(1); if (!reader.IsDBNull(2)) planCourse.CourseCode = reader.GetString(2); if (!reader.IsDBNull(3)) planCourse.TeacherCode = reader.GetString(3); if (!reader.IsDBNull(4)) planCourse.CourseNum = reader.GetInt32(4); if (!reader.IsDBNull(5)) planCourse.CourseScore = reader.GetInt32(5); planCourse.MarkOld(); planCourselist.Add(planCourse); } reader.Close(); } return planCourselist; }
public IList<Core.Business.AccountRecommend> GetAllAccountRecommend() { IList<Core.Business.AccountRecommend> accountRecommendlist = new List<Core.Business.AccountRecommend>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllAccountRecommend); if(reader != null) { while(reader.Read()) { Core.Business.AccountRecommend accountRecommend = new Core.Business.AccountRecommend(); if (!reader.IsDBNull(0)) accountRecommend.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) accountRecommend.RecommendDate = reader.GetDateTime(1); if (!reader.IsDBNull(2)) accountRecommend.AccountId = reader.GetInt64(2); if (!reader.IsDBNull(3)) accountRecommend.RecommendId = reader.GetInt64(3); if (!reader.IsDBNull(4)) accountRecommend.AccountName = reader.GetString(4); accountRecommend.MarkOld(); accountRecommendlist.Add(accountRecommend); } reader.Close(); } return accountRecommendlist; }
public IList<Core.Business.TRGoupArrange> GetAllTRGoupArrange() { IList<Core.Business.TRGoupArrange> tRGoupArrangelist = new List<Core.Business.TRGoupArrange>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllTRGoupArrange); if (reader != null) { while (reader.Read()) { Core.Business.TRGoupArrange tRGoupArrange = new Core.Business.TRGoupArrange(); if (!reader.IsDBNull(0)) tRGoupArrange.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) tRGoupArrange.ArrangeCode = reader.GetString(1); if (!reader.IsDBNull(2)) tRGoupArrange.Term = reader.GetInt32(2); if (!reader.IsDBNull(3)) tRGoupArrange.YearNum = reader.GetString(3); if (!reader.IsDBNull(4)) tRGoupArrange.MakeDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) tRGoupArrange.CheckerCode = reader.GetString(5); if (!reader.IsDBNull(6)) tRGoupArrange.TRGroupCode = reader.GetString(6); if (!reader.IsDBNull(7)) tRGoupArrange.ArrangeNames = reader.GetString(7); tRGoupArrange.MarkOld(); tRGoupArrangelist.Add(tRGoupArrange); } reader.Close(); } return tRGoupArrangelist; }
public IList<Core.Business.ISOItem> GetAllISOItem() { IList<Core.Business.ISOItem> iSOItemlist = new List<Core.Business.ISOItem>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllISOItem); if (reader != null && !reader.IsClosed) { while (reader.Read()) { Core.Business.ISOItem iSOItem = new Core.Business.ISOItem(); if (!reader.IsDBNull(0)) iSOItem.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) iSOItem.Score = reader.GetInt32(1); if (!reader.IsDBNull(2)) iSOItem.FileName = reader.GetString(2); if (!reader.IsDBNull(3)) iSOItem.Content = reader.GetString(3); if (!reader.IsDBNull(4)) iSOItem.CheckMethod = reader.GetString(4); if (!reader.IsDBNull(5)) iSOItem.Summary = reader.GetString(5); if (!reader.IsDBNull(6)) iSOItem.Inputter = reader.GetString(6); if (!reader.IsDBNull(7)) iSOItem.CheckCode = reader.GetString(7); iSOItem.MarkOld(); iSOItemlist.Add(iSOItem); } reader.Close(); } return iSOItemlist; }
public IList<Core.Business.ScoreInPratise> GetScoreInPratiseByTime(string strWhere) { StringBuilder sb = new StringBuilder(); sb.Append(SqlGetAllScoreInPratise); if (!string.IsNullOrEmpty(strWhere)) sb.Append(" where " + strWhere); IList<Core.Business.ScoreInPratise> scoreInPratiselist = new List<Core.Business.ScoreInPratise>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(sb.ToString()); if (reader != null) { while (reader.Read()) { Core.Business.ScoreInPratise scoreInPratise = new Core.Business.ScoreInPratise(); if (!reader.IsDBNull(0)) scoreInPratise.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) scoreInPratise.StudentCode = reader.GetString(1); if (!reader.IsDBNull(2)) scoreInPratise.YearNum = reader.GetString(2); if (!reader.IsDBNull(3)) scoreInPratise.Term = reader.GetInt32(3); if (!reader.IsDBNull(4)) scoreInPratise.ScoreNum = reader.GetDecimal(4); if (!reader.IsDBNull(5)) scoreInPratise.ScoreCate = reader.GetString(5); if (!reader.IsDBNull(6)) scoreInPratise.PracticeId = reader.GetInt32(6); scoreInPratise.MarkOld(); scoreInPratiselist.Add(scoreInPratise); } reader.Close(); } return scoreInPratiselist; }
public IList<Core.Business.ScoreInPratise> GetAllScoreInPratise() { IList<Core.Business.ScoreInPratise> scoreInPratiselist = new List<Core.Business.ScoreInPratise>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllScoreInPratise); if(reader != null) { while(reader.Read()) { Core.Business.ScoreInPratise scoreInPratise = new Core.Business.ScoreInPratise(); if (!reader.IsDBNull(0)) scoreInPratise.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) scoreInPratise.StudentCode = reader.GetString(1); if (!reader.IsDBNull(2)) scoreInPratise.YearNum = reader.GetString(2); if (!reader.IsDBNull(3)) scoreInPratise.Term = reader.GetInt32(3); if (!reader.IsDBNull(4)) scoreInPratise.ScoreNum = reader.GetDecimal(4); if (!reader.IsDBNull(5)) scoreInPratise.ScoreCate = reader.GetString(5); if (!reader.IsDBNull(6)) scoreInPratise.PracticeId = reader.GetInt32(6); scoreInPratise.MarkOld(); scoreInPratiselist.Add(scoreInPratise); } reader.Close(); } return scoreInPratiselist; }
public void Insert(Core.Business.AccidentRcd accidentRcd) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@DevCode", SqlDbType.NVarChar, accidentRcd.DevCode); sql.AddParameter("@DevUnitCode", SqlDbType.NVarChar, accidentRcd.DevUnitCode); sql.AddParameter("@ClsRoomCode", SqlDbType.NVarChar, accidentRcd.ClsRoomCode); sql.AddParameter("@AccidentDate", SqlDbType.DateTime, accidentRcd.AccidentDate); sql.AddParameter("@ReportDate", SqlDbType.DateTime, accidentRcd.ReportDate); sql.AddParameter("@Reason", SqlDbType.NVarChar, accidentRcd.Reason); sql.AddParameter("@AccinenterName", SqlDbType.NVarChar, accidentRcd.AccinenterName); sql.AddParameter("@ReporterName", SqlDbType.NVarChar, accidentRcd.ReporterName); sql.AddParameter("@LeaderName", SqlDbType.NVarChar, accidentRcd.LeaderName); SqlDataReader reader = sql.ExecuteSqlReader(SqlInsertAccidentRcd); if (reader != null && !reader.IsClosed && reader.Read()) { if (!reader.IsDBNull(0)) accidentRcd.Id = int.Parse(reader.GetDecimal(0).ToString()); reader.Close(); } else { if (reader != null && !reader.IsClosed) reader.Close(); } }
public IList<Core.Business.AccidentRcd> GetAllAccidentRcd() { IList<Core.Business.AccidentRcd> accidentRcdlist = new List<Core.Business.AccidentRcd>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllAccidentRcd); if(reader != null) { while(reader.Read()) { Core.Business.AccidentRcd accidentRcd = new Core.Business.AccidentRcd(); if (!reader.IsDBNull(0)) accidentRcd.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) accidentRcd.DevCode = reader.GetString(1); if (!reader.IsDBNull(2)) accidentRcd.DevUnitCode = reader.GetString(2); if (!reader.IsDBNull(3)) accidentRcd.ClsRoomCode = reader.GetString(3); if (!reader.IsDBNull(4)) accidentRcd.AccidentDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) accidentRcd.ReportDate = reader.GetDateTime(5); if (!reader.IsDBNull(6)) accidentRcd.Reason = reader.GetString(6); if (!reader.IsDBNull(7)) accidentRcd.AccinenterName = reader.GetString(7); if (!reader.IsDBNull(8)) accidentRcd.ReporterName = reader.GetString(8); if (!reader.IsDBNull(9)) accidentRcd.LeaderName = reader.GetString(9); accidentRcd.MarkOld(); accidentRcdlist.Add(accidentRcd); } reader.Close(); } return accidentRcdlist; }
bool CY.GFive.Core.Providers.DALProvider.IDeviceInfoProvider.IsExist(string deviceCode) { bool flag = false; SqlServerUtility utility = new SqlServerUtility(); if (deviceCode != null) utility.AddParameter("DeviceCode", SqlDbType.VarChar, deviceCode); SqlDataReader reader = utility.ExecuteSqlReader(SQL_GET_DEVICE_BY_DEVICE_CODE); if (reader != null && !reader.IsClosed) { if (reader.Read()) flag = true; reader.Close(); } else { flag = false; } return flag; }
public IList<PlanCourse> Fill(CoursePlan plan) { if (plan == null) return null; IList<Core.Business.PlanCourse> planCourselist = new List<Core.Business.PlanCourse>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@PlanCode", SqlDbType.NVarChar, plan.PlanCode, 30); SqlDataReader reader = sql.ExecuteSqlReader(SqlFillPlanCourse); if (reader != null) { while (reader.Read()) { Core.Business.PlanCourse planCourse = new Core.Business.PlanCourse(); if (!reader.IsDBNull(0)) planCourse.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) planCourse.PlanCode = reader.GetString(1); if (!reader.IsDBNull(2)) planCourse.CourseCode = reader.GetString(2); if (!reader.IsDBNull(3)) planCourse.TeacherCode = reader.GetString(3); if (!reader.IsDBNull(4)) planCourse.CourseNum = reader.GetInt32(4); if (!reader.IsDBNull(5)) planCourse.CourseScore = reader.GetInt32(5); planCourse.MarkOld(); planCourselist.Add(planCourse); } reader.Close(); } return planCourselist; }
public IList<Core.Business.VirtualLabDataBigClass> GetBySql(string sqlwhere) { IList<Core.Business.VirtualLabDataBigClass> virtualLabDataBigClasslist = new List<Core.Business.VirtualLabDataBigClass>(); SqlServerUtility sql = new SqlServerUtility(); string sqlstr = "SELECT * FROM [dbo].[VirtualLabDataBigClass] where "; sqlstr += sqlwhere; SqlDataReader reader = sql.ExecuteSqlReader(sqlstr); if (reader != null) { while (reader.Read()) { Core.Business.VirtualLabDataBigClass virtualLabDataBigClass = new Core.Business.VirtualLabDataBigClass(); if (!reader.IsDBNull(0)) virtualLabDataBigClass.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) virtualLabDataBigClass.Name = reader.GetString(1); if (!reader.IsDBNull(2)) virtualLabDataBigClass.VirturlLabID = reader.GetGuid(2); virtualLabDataBigClass.MarkOld(); virtualLabDataBigClasslist.Add(virtualLabDataBigClass); } reader.Close(); } return virtualLabDataBigClasslist; }
public IList<Core.Business.UserAnswer> GetAllUserAnswer() { IList<Core.Business.UserAnswer> userAnswerlist = new List<Core.Business.UserAnswer>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllUserAnswer); if(reader != null) { while(reader.Read()) { Core.Business.UserAnswer userAnswer = new Core.Business.UserAnswer(); if (!reader.IsDBNull(0)) userAnswer.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) userAnswer.VoteRecordID = reader.GetInt32(1); if (!reader.IsDBNull(2)) userAnswer.VoteItemID = reader.GetInt32(2); if (!reader.IsDBNull(3)) userAnswer.AnswerContent = reader.GetString(3); userAnswer.MarkOld(); userAnswerlist.Add(userAnswer); } reader.Close(); } return userAnswerlist; }
public IList<Core.Business.Meterial> GetAllMeterial() { IList<Core.Business.Meterial> meteriallist = new List<Core.Business.Meterial>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllMeterial); if (reader != null) { while (reader.Read()) { Core.Business.Meterial meterial = new Core.Business.Meterial(); if (!reader.IsDBNull(0)) meterial.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) meterial.ISBN = reader.GetString(1); if (!reader.IsDBNull(2)) meterial.Name = reader.GetString(2); if (!reader.IsDBNull(3)) meterial.Publish = reader.GetString(3); if (!reader.IsDBNull(4)) meterial.MeterialCate = reader.GetString(4); if (!reader.IsDBNull(5)) meterial.Des = reader.GetString(5); if (!reader.IsDBNull(6)) meterial.Price = reader.GetDecimal(6); if (!reader.IsDBNull(7)) meterial.Vision = reader.GetInt32(7); meterial.MarkOld(); meteriallist.Add(meterial); } reader.Close(); } return meteriallist; }
public IList<Core.Business.Asset> GetAllAsset() { IList<Core.Business.Asset> assetlist = new List<Core.Business.Asset>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllAsset); if (reader != null) { while (reader.Read()) { Core.Business.Asset asset = new Core.Business.Asset(); if (!reader.IsDBNull(0)) asset.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) asset.AssetType = reader.GetString(1); if (!reader.IsDBNull(2)) asset.AssetItemName = reader.GetString(2); if (!reader.IsDBNull(3)) asset.UnitValue = reader.GetDecimal(3); if (!reader.IsDBNull(4)) asset.PurchasingDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) asset.RegisterDate = reader.GetDateTime(5); if (!reader.IsDBNull(6)) asset.Num = reader.GetInt32(6); if (!reader.IsDBNull(7)) asset.TotalValue = reader.GetDecimal(7); asset.MarkOld(); assetlist.Add(asset); } reader.Close(); } return assetlist; }
public Meterial getByCode(string code) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@code", SqlDbType.NVarChar, code); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectByCode); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Meterial meterial = new Core.Business.Meterial(); if (!reader.IsDBNull(0)) meterial.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) meterial.ISBN = reader.GetString(1); if (!reader.IsDBNull(2)) meterial.Name = reader.GetString(2); if (!reader.IsDBNull(3)) meterial.Publish = reader.GetString(3); if (!reader.IsDBNull(4)) meterial.MeterialCate = reader.GetString(4); if (!reader.IsDBNull(5)) meterial.Des = reader.GetString(5); if (!reader.IsDBNull(6)) meterial.Price = reader.GetDecimal(6); if (!reader.IsDBNull(7)) meterial.Vision = reader.GetInt32(7); reader.Close(); meterial.MarkOld(); return meterial; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public Core.Business.ControlPermissions2 Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectControlPermissions2); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.ControlPermissions2 controlPermissions2 = new Core.Business.ControlPermissions2(); if (!reader.IsDBNull(0)) controlPermissions2.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) controlPermissions2.ControlKey = reader.GetInt32(1); if (!reader.IsDBNull(2)) controlPermissions2.PermissionsKey = reader.GetInt32(2); reader.Close(); return controlPermissions2; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<Core.Business.VoteItem> GetVoteItemByVoteID(int id) { IList<Core.Business.VoteItem> voteItemlist = new List<Core.Business.VoteItem>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@voteid", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetVoteItemByVoteID); if (reader != null) { while (reader.Read()) { Core.Business.VoteItem voteItem = new Core.Business.VoteItem(); if (!reader.IsDBNull(0)) voteItem.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) voteItem.VoteID = reader.GetInt32(1); if (!reader.IsDBNull(2)) voteItem.IsMutiChoose = reader.GetInt32(2); if (!reader.IsDBNull(3)) voteItem.IsUserDefine = reader.GetInt32(3); if (!reader.IsDBNull(4)) voteItem.VoteItemContent = reader.GetString(4); voteItem.MarkOld(); voteItemlist.Add(voteItem); } reader.Close(); } return voteItemlist; }
public int GetCommentCountByFavoritesId(CY.UME.Core.Business.Favorites favorites) { int count = 0; if (favorites == null) { return count; } SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@FavoritesId", SqlDbType.BigInt, favorites.Id); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetFavoritesCommentCountByInstanceId); if (reader != null && !reader.IsClosed && reader.Read()) { if (!reader.IsDBNull(0)) count = reader.GetInt32(0); reader.Close(); } else { if (reader != null && !reader.IsClosed) reader.Close(); } return count; }
public IList<Core.Business.ObserveTotal> GetAllObserveTotal() { IList<Core.Business.ObserveTotal> observeTotallist = new List<Core.Business.ObserveTotal>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllObserveTotal); if(reader != null) { while(reader.Read()) { Core.Business.ObserveTotal observeTotal = new Core.Business.ObserveTotal(); if (!reader.IsDBNull(0)) observeTotal.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) observeTotal.UnitCode = reader.GetString(1); if (!reader.IsDBNull(2)) observeTotal.PeerCode = reader.GetString(2); if (!reader.IsDBNull(3)) observeTotal.Num = reader.GetInt32(3); if (!reader.IsDBNull(4)) observeTotal.NumFinish = reader.GetInt32(4); if (!reader.IsDBNull(5)) observeTotal.NumAvail = reader.GetInt32(5); if (!reader.IsDBNull(6)) observeTotal.Des = reader.GetString(6); observeTotal.MarkOld(); observeTotallist.Add(observeTotal); } reader.Close(); } return observeTotallist; }
public IList<Core.Business.TRGroup> GetAllTRGroup() { IList<Core.Business.TRGroup> tRGrouplist = new List<Core.Business.TRGroup>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllTRGroup); if (reader != null) { while (reader.Read()) { Core.Business.TRGroup tRGroup = new Core.Business.TRGroup(); if (!reader.IsDBNull(0)) tRGroup.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) tRGroup.TrGroupCode = reader.GetString(1); if (!reader.IsDBNull(2)) tRGroup.TrGoupName = reader.GetString(2); if (!reader.IsDBNull(3)) tRGroup.AddDate = reader.GetDateTime(3); if (!reader.IsDBNull(4)) tRGroup.BuildDate = reader.GetDateTime(4); tRGroup.MarkOld(); tRGrouplist.Add(tRGroup); } reader.Close(); } return tRGrouplist; }
/// <summary> /// ������ҵ��� /// </summary> /// <param name="EntCode"></param> /// <returns></returns> public IList<Group> getByEntCode(string EntCode) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@EntCode", SqlDbType.NVarChar, EntCode); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetGroupByEntCode); if (reader != null) { while (reader.Read()) { Core.Business.Group group = new Core.Business.Group(); if (!reader.IsDBNull(0)) group.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) group.Num = reader.GetInt32(1); if (!reader.IsDBNull(2)) group.Term = reader.GetInt32(2); if (!reader.IsDBNull(3)) group.YearCode = reader.GetString(3); if (!reader.IsDBNull(4)) group.EntCode = reader.GetString(4); if (!reader.IsDBNull(5)) group.GroupName = reader.GetString(5); group.MarkOld(); grouplist.Add(group); } reader.Close(); } return grouplist; }
public int getCount(string strWhere) { SqlServerUtility sql = new SqlServerUtility(); if (strWhere.Trim().Equals("")) { strWhere = "1=1"; } string sqlstr = "select count(*) from InstrumentPictureRepository where " + strWhere + ""; SqlDataReader reader = sql.ExecuteSqlReader(sqlstr); int count = 0; if (reader != null && !reader.IsClosed && reader.Read()) { if (!reader.IsDBNull(0)) count = reader.GetInt32(0); reader.Close(); return count; } else { if (reader != null && !reader.IsClosed) reader.Close(); return count; } }
public IList<CY.CSTS.Core.Business.VoteRole> GetByVoteId(int voteID) { IList<Core.Business.VoteRole> voteRolelist = new List<Core.Business.VoteRole>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@VoteID",SqlDbType.Int,voteID); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetByVoteID); if (reader != null) { while (reader.Read()) { Core.Business.VoteRole voteRole = new Core.Business.VoteRole(); if (!reader.IsDBNull(0)) voteRole.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) voteRole.DepartmentID = reader.GetInt32(1); if (!reader.IsDBNull(2)) voteRole.VoteID = reader.GetInt32(2); if (!reader.IsDBNull(3)) voteRole.RoleID = reader.GetInt32(3); voteRole.MarkOld(); voteRolelist.Add(voteRole); } reader.Close(); } return voteRolelist; }