Exemple #1
0
        public void Insert(Core.Business.InstrumentRecommend instrumentRecommend)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Autor", SqlDbType.UniqueIdentifier, instrumentRecommend.Autor);
            sql.AddParameter("@RecommendDate", SqlDbType.DateTime, instrumentRecommend.RecommendDate);
            sql.AddParameter("@Commend", SqlDbType.NVarChar, instrumentRecommend.Commend);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlInsertInstrumentRecommend);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                if (!reader.IsDBNull(0))
                {
                    instrumentRecommend.Id = reader.GetGuid(0);
                }

                reader.Close();
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
        public void Insert(Core.Business.ExhibitionInstrument exhibitionInstrument)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@InstrumentID", SqlDbType.UniqueIdentifier, exhibitionInstrument.InstrumentID);
            sql.AddParameter("@ExhibitionDate", SqlDbType.DateTime, exhibitionInstrument.ExhibitionDate);
            sql.AddParameter("@SequenceNumber", SqlDbType.Int, exhibitionInstrument.SequenceNumber);
            sql.AddParameter("@IsShowinHomePage", SqlDbType.Int, exhibitionInstrument.IsShowinHomePage);
            sql.AddOutputParameter("@Id", SqlDbType.UniqueIdentifier);
            SqlDataReader reader = sql.ExecuteSPReader("usp_InsertExhibitionInstrument");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                if (!reader.IsDBNull(0))
                {
                    exhibitionInstrument.Id = reader.GetGuid(0);
                }

                reader.Close();
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Exemple #3
0
        public void Update(Core.Business.InstrumentRecommend instrumentRecommend)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Autor", SqlDbType.UniqueIdentifier, instrumentRecommend.Autor);
            sql.AddParameter("@RecommendDate", SqlDbType.DateTime, instrumentRecommend.RecommendDate);
            sql.AddParameter("@Commend", SqlDbType.NVarChar, instrumentRecommend.Commend);
            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, instrumentRecommend.Id);
            sql.ExecuteSql(SqlUpdateInstrumentRecommend);
        }
        public void Update(Core.Business.ExhibitionInstrument exhibitionInstrument)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@InstrumentID", SqlDbType.UniqueIdentifier, exhibitionInstrument.InstrumentID);
            sql.AddParameter("@ExhibitionDate", SqlDbType.DateTime, exhibitionInstrument.ExhibitionDate);
            sql.AddParameter("@SequenceNumber", SqlDbType.Int, exhibitionInstrument.SequenceNumber);
            sql.AddParameter("@IsShowinHomePage", SqlDbType.Int, exhibitionInstrument.IsShowinHomePage);
            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, exhibitionInstrument.Id);
            sql.ExecuteSP("usp_UpdateExhibitionInstrument");
        }
Exemple #5
0
        public void Delete(Core.Business.InstrumentRecommend instrumentRecommend)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, instrumentRecommend.Id);
            sql.ExecuteSql(SqlDeleteInstrumentRecommend);
        }
        public void Delete(Core.Business.ExhibitionInstrument exhibitionInstrument)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, exhibitionInstrument.Id);
            sql.ExecuteSP("usp_DeleteExhibitionInstrument");
        }
        public IList <Core.Business.ExhibitionInstrument> GetExhibitionInstrumentByPage(string sqlwhere, int pagenumber, int pagesize)
        {
            IList <Core.Business.ExhibitionInstrument> exhibitionInstrumentlist = new List <Core.Business.ExhibitionInstrument>();
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Tables", SqlDbType.VarChar, "ExhibitionInstrument");
            sql.AddParameter("@PK", SqlDbType.VarChar, "Id");
            sql.AddParameter("@PageNumber", SqlDbType.Int, pagenumber);
            sql.AddParameter("@PageSize", SqlDbType.Int, pagesize);
            //sql.AddParameter("@LawSortID", SqlDbType.UniqueIdentifier, sortId);
            sql.AddParameter("@Filter", SqlDbType.VarChar, sqlwhere);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ExhibitionInstrument exhibitionInstrument = new Core.Business.ExhibitionInstrument();

                    if (!reader.IsDBNull(0))
                    {
                        exhibitionInstrument.Id = reader.GetGuid(0);
                    }
                    if (!reader.IsDBNull(1))
                    {
                        exhibitionInstrument.InstrumentID = reader.GetGuid(1);
                    }
                    if (!reader.IsDBNull(2))
                    {
                        exhibitionInstrument.ExhibitionDate = reader.GetDateTime(2);
                    }
                    if (!reader.IsDBNull(3))
                    {
                        exhibitionInstrument.SequenceNumber = reader.GetInt32(3);
                    }
                    if (!reader.IsDBNull(4))
                    {
                        exhibitionInstrument.IsShowinHomePage = reader.GetInt32(4);
                    }

                    exhibitionInstrument.MarkOld();
                    exhibitionInstrumentlist.Add(exhibitionInstrument);
                }
                reader.Close();
            }
            return(exhibitionInstrumentlist);
        }
        public Core.Business.ExhibitionInstrument Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0))
                {
                    exhibitionInstrument.Id = reader.GetGuid(0);
                }
                if (!reader.IsDBNull(1))
                {
                    exhibitionInstrument.InstrumentID = reader.GetGuid(1);
                }
                if (!reader.IsDBNull(2))
                {
                    exhibitionInstrument.ExhibitionDate = reader.GetDateTime(2);
                }
                if (!reader.IsDBNull(3))
                {
                    exhibitionInstrument.SequenceNumber = reader.GetInt32(3);
                }
                if (!reader.IsDBNull(4))
                {
                    exhibitionInstrument.IsShowinHomePage = reader.GetInt32(4);
                }

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

                return(null);
            }
        }
Exemple #9
0
        public Core.Business.InstrumentRecommend Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0))
                {
                    instrumentRecommend.Id = reader.GetGuid(0);
                }
                if (!reader.IsDBNull(1))
                {
                    instrumentRecommend.Autor = reader.GetGuid(1);
                }
                if (!reader.IsDBNull(2))
                {
                    instrumentRecommend.RecommendDate = reader.GetDateTime(2);
                }
                if (!reader.IsDBNull(3))
                {
                    instrumentRecommend.Commend = reader.GetString(3);
                }

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

                return(null);
            }
        }