示例#1
0
文件: NewsDB.cs 项目: xy19xiaoyu/TG
        public static int InsertNews(string title, string summary, string content, DateTime createdate, string createuser)
        {
            NEWSINFO ni = new NEWSINFO();
            ni.TITLE = title;
            ni.SUMMARY = summary;
            ni.NEWS_CONTENT = content;
            ni.CREATEDATE = createdate;
            ni.CREATEUSER = createuser;

            using (DataClasses1DataContext db = new DataClasses1DataContext())
            {
                db.Log = Console.Out;
                db.NEWSINFO.InsertOnSubmit(ni);
                db.SubmitChanges();
            }
            return ni.id;
        }
示例#2
0
文件: NewsDB.cs 项目: xy19xiaoyu/TG
 /// <summary>
 /// 修改咨询,回答咨询
 /// </summary>
 /// <param name="qid"></param>
 /// <param name="ansercontent"></param>
 /// <param name="anserdate"></param>
 /// <param name="anseruser"></param>
 /// <returns></returns>
 public static int UpdateQuestion(int qid, string ansercontent, DateTime anserdate, string anseruser)
 {
     using (DataClasses1DataContext db = new DataClasses1DataContext())
     {
         db.Log = Console.Out;
         var tb = db.QuestionInfo.SingleOrDefault<QuestionInfo>(s => s.ID == qid);
         if (tb == null)
         {
             return 0;
         }
         tb.AnserContent = ansercontent;
         tb.AnserDate = anserdate;
         tb.AnserUser = anseruser;
         tb.Status = 1;
         db.SubmitChanges();
     }
     return 1;
 }
示例#3
0
文件: NewsDB.cs 项目: xy19xiaoyu/TG
 /// <summary>
 /// 新增咨询
 /// </summary>
 /// <param name="title"></param>
 /// <param name="content"></param>
 /// <param name="createdate"></param>
 /// <param name="createuser"></param>
 /// <returns></returns>
 public static int InsertQuestion(string title, string content, DateTime createdate,int createuser)
 {
     QuestionInfo qi = new QuestionInfo();
     qi.TITLE = title;
     qi.QuestionContent = content;
     qi.CreateUser = createuser;
     qi.CreateDate = createdate;
     qi.Status = 0;
     using (DataClasses1DataContext db = new DataClasses1DataContext())
     {
         db.Log = Console.Out;
         db.QuestionInfo.InsertOnSubmit(qi);
         db.SubmitChanges();
     }
     return qi.ID;
 }