Exemple #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;
 }
Exemple #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);
        }
Exemple #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; }
 }
Exemple #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; }
        }