private void postTodb(object sender, RoutedEventArgs e) { mainDal post = new mainDal(); announcement a = new announcement(); a.Title = this.titleBox.Text; a.Contents = this.contentBox.Text; DateTime d = DateTime.Now; a.Date = d.ToString(); post.post(a); this.Close(); }