Example #1
0
        public int Update(Domain.Announce announce)
        {
            string sql = "UPDATE [dbo].[T_Announce] SET [Title]=@Title,[Content]=@Content," +
                         "[AnnounceType]=@AnnounceType,[AnnounceScope]=@AnnounceScope WHERE [Id]=@Id";

            using (var dbOperator = new DbOperator(Provider, ConnectionString)) {
                dbOperator.AddParameter("Title", announce.Title);
                dbOperator.AddParameter("Content", announce.Content);
                dbOperator.AddParameter("AnnounceType", (int)announce.AnnounceType);
                dbOperator.AddParameter("AnnounceScope", (int)announce.AnnunceScope);
                dbOperator.AddParameter("Id", announce.Id);
                return(dbOperator.ExecuteNonQuery(sql));
            }
        }
Example #2
0
        public int Insert(Domain.Announce announce)
        {
            string sql = "INSERT INTO [dbo].[T_Announce]([Id],[Title],[Content],[PublishTime],[PublishAccount],[AnnounceType],[PublishRole],[AduiteStatus],[Company],[AnnounceScope]) " +
                         "VALUES(@Id,@Title,@Content,@PublishTime,@PublishAccount,@AnnounceType,@PublishRole,@AduiteStatus,@Company,@AnnounceScope)";

            using (var dbOperator = new DbOperator(Provider, ConnectionString)) {
                dbOperator.AddParameter("Id", announce.Id);
                dbOperator.AddParameter("Title", announce.Title);
                dbOperator.AddParameter("Content", announce.Content);
                dbOperator.AddParameter("PublishTime", announce.PublishTime);
                dbOperator.AddParameter("PublishAccount", announce.PublishAccount);
                dbOperator.AddParameter("AnnounceType", (int)announce.AnnounceType);
                dbOperator.AddParameter("PublishRole", (int)announce.PublishRole);
                dbOperator.AddParameter("AduiteStatus", (int)announce.AduiteStatus);
                dbOperator.AddParameter("Company", announce.Company);
                dbOperator.AddParameter("AnnounceScope", (int)announce.AnnunceScope);
                return(dbOperator.ExecuteNonQuery(sql));
            }
        }