コード例 #1
0
ファイル: TopicDetails.cs プロジェクト: PawWaw/BD-II
        private void SaveButton_Click(object sender, EventArgs e)
        {
            searchCrit = new Topics();
            if (TopicTextbox.Text != "" && InfoRichTextbox.Text != "" && TeacherTextbox.Text != "")
            {
                searchCrit.Title       = TopicTextbox.Text;
                searchCrit.Description = InfoRichTextbox.Text;
                searchCrit.TeacherID   = LoginPanel.TeacherID;

                if (IDTextbox.Text != "")
                {
                    searchCrit.ID = Convert.ToInt32(IDTextbox.Text);
                }

                if (StatusCombobox.SelectedItem.ToString() == "Open")
                {
                    searchCrit.Status = "Open";
                }
                else if (StatusCombobox.SelectedItem.ToString() == "Closed")
                {
                    searchCrit.Status = "Close";
                }
                else
                {
                    searchCrit.Status = "Final";
                }

                if (opentype == 1)
                {
                    DependencyFacade.InsertTopic(searchCrit);
                }
                else
                {
                    DependencyFacade.UpdateTopics(searchCrit);
                }
                this.Hide();
            }
            else
            {
                MessageBox.Show("Wrong parameters of topic.", "Warning", MessageBoxButtons.OK);
            }
        }