예제 #1
0
        /// <summary>
        /// 添加公告、下载
        /// </summary>
        /// <param name="title"></param>
        /// <param name="cid"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public static bool AddBulletin(string title, int cid, string content, string attachment, string filename, DateTime date)
        {
            DateTime Date = Convert.ToDateTime(date.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss.fff"));
            try
            {
                string sql = "insert into ArticleWithAthmt (Sid,Title,Content,PostTime,Attachment,AttachmentName) values({0},{1},{2},{3},{4},{5})";

                using (var db = new en_scEntities())
                {
                    db.ExecuteStoreCommand(sql, new object[] { cid, title, content, Date, attachment, filename });
                    db.SaveChanges();
                }

                return true;
            }
            catch
            {
                return false;
                throw;
            }
        }
예제 #2
0
        /// <summary>
        /// 添加新闻
        /// </summary>
        /// <param name="title"></param>
        /// <param name="cid"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public static bool AddNews(string title, int cid, string author, string source, string content, bool ispic, bool isloop, string path, DateTime date)
        {
            DateTime Date = Convert.ToDateTime(date.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss.fff"));
            try
            {
                string sql = "insert into News (Sid,Title,Author,Source,Content,PostTime,IsPicNews,IsLoopPicNews,PicNewsPath) values({0},{1},{2},{3},{4},{5},{6},{7},{8})";

                using (var db = new en_scEntities())
                {
                    db.ExecuteStoreCommand(sql, new object[] {cid, title, author, source, content, Date, ispic, isloop, path});
                    db.SaveChanges();
                }

                return true;
            }
            catch
            {
                return false;
                throw;
            }
        }