//************************************************************************************************* // buttons here //************************************************************************************************* private void btnInsert_Click(object sender, RoutedEventArgs e) { conference_insert functionToAddRowOfDataToDataGrid = new conference_insert(); dc.SubmitChanges(); //dc.SaveChanges(); ConferenceProceeding newConferenceProceedingObject = new ConferenceProceeding() { ConfID = int.Parse(this.tbxConfID.Text), Title = tbxTitle.Text, Author = tbxAuthor.Text, CopiesTotal = int.Parse(this.tbxCopiesTotal.Text), CopiesAvailable = int.Parse(this.tbxCopiesAvailable.Text), CopiesOut = int.Parse(this.tbxCopiesOut.Text), SubjectArea = tbxSubjectArea.Text, YearOfPublication = tbxYearOfPublication.Text, Keyword = tbxKeyword.Text, ConfNumberID = int.Parse(this.tbxConfNumberID.Text), ShelfNumber = tbxShelfNumber.Text, Status = tbxStatus.Text, }; dc.ConferenceProceedings.InsertOnSubmit(newConferenceProceedingObject); dc.SubmitChanges(); //dc.ConferenceProceedings.Add(newConferenceProceedingObject); //dc.SaveChanges(); viewconferencedetails.datagrid.ItemsSource = dc.ConferenceProceedings.ToList(); this.Hide(); }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { ConferenceProceeding _updateconferenceproceeding = (from conferenceproceeding in dc.ConferenceProceedings where conferenceproceeding.ConfID == Id select conferenceproceeding).Single(); _updateconferenceproceeding.ConfID = int.Parse(this.tbxConfID.Text); _updateconferenceproceeding.Title = tbxTitle.Text; _updateconferenceproceeding.Author = tbxAuthor.Text; _updateconferenceproceeding.CopiesTotal = int.Parse(tbxCopiesTotal.Text); _updateconferenceproceeding.CopiesAvailable = int.Parse(tbxCopiesAvailable.Text); _updateconferenceproceeding.CopiesOut = int.Parse(tbxCopiesOut.Text); _updateconferenceproceeding.SubjectArea = tbxSubjectArea.Text; _updateconferenceproceeding.YearOfPublication = tbxYearOfPublication.Text; _updateconferenceproceeding.Keyword = tbxKeyword.Text; _updateconferenceproceeding.ConfNumberID = int.Parse(tbxConfNumberID.Text); _updateconferenceproceeding.Status = tbxStatus.Text; dc.SubmitChanges(); //dc.SaveChanges(); viewconferencedetails.datagrid.ItemsSource = dc.ConferenceProceedings.ToList(); this.Hide(); }
private void btnInsert_Click(object sender, RoutedEventArgs e) { ConferenceProceeding newConferenceProceedingObject = new ConferenceProceeding() { ConfID = int.Parse(this.tbxConfID.Text), Title = tbxTitle.Text, Author = tbxAuthor.Text, CopiesTotal = int.Parse(this.tbxCopiesTotal.Text), CopiesAvailable = int.Parse(this.tbxCopiesAvailable.Text), CopiesOut = int.Parse(this.tbxCopiesOut.Text), SubjectArea = tbxSubjectArea.Text, YearOfPublication = tbxYearOfPublication.Text, Keyword = tbxKeyword.Text, ConfNumberID = int.Parse(this.tbxConfNumberID.Text), ShelfNumber = tbxShelfNumber.Text, Status = tbxStatus.Text, }; dc.ConferenceProceedings.InsertOnSubmit(newConferenceProceedingObject); dc.SubmitChanges(); viewconferencedetails.datagrid.ItemsSource = dc.ConferenceProceedings.ToList(); //now clear textboxes after insert tbxConfID.Text = ""; tbxTitle.Text = ""; tbxAuthor.Text = ""; tbxCopiesTotal.Text = ""; tbxCopiesAvailable.Text = ""; tbxCopiesOut.Text = ""; tbxSubjectArea.Text = ""; tbxYearOfPublication.Text = ""; tbxKeyword.Text = ""; tbxConfNumberID.Text = ""; tbxShelfNumber.Text = ""; tbxStatus.Text = ""; }