예제 #1
0
 public static bool AddBlogEntry(BlogEntry entry) {
     //
     bool added = false;
     try {
         _BlogData.Tables["BlogTable"].Rows.Add(new object[] { entry.Date,entry.UserID,entry.Comment });
         _BlogData.WriteXml(_BlogFile, XmlWriteMode.WriteSchema);
         added = true;
     }
     catch (Exception ex) { throw new ApplicationException(ex.Message); }
     return added;
 }
예제 #2
0
        public static bool AddBlogEntry(BlogEntry entry)
        {
            //
            bool added = false;

            try {
                _BlogData.Tables["BlogTable"].Rows.Add(new object[] { entry.Date, entry.UserID, entry.Comment });
                _BlogData.WriteXml(_BlogFile, XmlWriteMode.WriteSchema);
                added = true;
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message); }
            return(added);
        }
예제 #3
0
 private void OnBlogKeyUp(object sender, KeyEventArgs e)
 {
     //Event handler for new blog entry
     Cursor.Current = Cursors.WaitCursor;
     try {
         if (e.KeyCode == Keys.Enter)
         {
             BlogEntry entry = new BlogEntry();
             entry.Date    = DateTime.Now;
             entry.Comment = this.txtComment.Text;
             entry.UserID  = Environment.UserName;
             if (BlogGateway.AddBlogEntry(entry))
             {
                 this.txtComment.Clear();
                 lock (this.txtBlog) {
                     this.msViewRefresh.PerformClick();
                 }
             }
         }
     }
     catch (Exception ex) { reportError(ex); }
     finally { Cursor.Current = Cursors.Default; }
 }
예제 #4
0
        private void OnBlogKeyUp(object sender,KeyEventArgs e) {
            //Event handler for new blog entry
            Cursor.Current = Cursors.WaitCursor;
            try {
                if (e.KeyCode == Keys.Enter) {
                    BlogEntry entry = new BlogEntry();
                    entry.Date = DateTime.Now;
                    entry.Comment = this.txtComment.Text;
                    entry.UserID = Environment.UserName;
                    if (BlogGateway.AddBlogEntry(entry)) {
                        this.txtComment.Clear();
                        lock (this.txtBlog) {
                            this.msViewRefresh.PerformClick();
                        }

                    }
                }
            }
            catch (Exception ex) { reportError(ex); }
            finally { Cursor.Current = Cursors.Default; }
        }