예제 #1
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (cbDocumentTipe.Text == "" || txtDocumentNo.Text == "" || Tanggal.Text == "" || cbNamakontak.Text == "" || cbdepartment.Text == "" || txtDescription.Text == "")
            {
                MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            DokumenBLL DokumenBLL = new DokumenBLL();

            if (DokumenBLL.AddDokumen(this.GetData()) > 0)
            {
                this.ClearForm();
                MessageBox.Show("Document added successfully !");
                formreceived.LoadNoDokumen();
            }
            else
            {
                MessageBox.Show("Document failed to add !");
            }
            this.Close();
        }
예제 #2
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (cbDocumentTipe.Text == "" || txtDocumentNo.Text == "" || dtTanggalDokumen.Text == "" || cbNamakontak.Text == "" || cbdepartment.Text == "" || txtDescription.Text == "")
            {
                MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            DokumenBLL DokumenBLL = new DokumenBLL();

            if (this.documentform.isEdit == false)
            {
                if (DokumenBLL.AddDokumen(this.GetData()) > 0)
                {
                    this.ClearForm();
                    MessageBox.Show("Document added successfully !");
                    this.documentform.LoadDokumen();
                }
                else
                {
                    MessageBox.Show("Document failed to add !");
                }
            }
            else
            {
                if (DokumenBLL.EditDokumen(this.GetData()) == true)
                {
                    this.ClearForm();
                    MessageBox.Show("Document changed successfully !");
                    this.documentform.LoadDokumen();
                }
                else
                {
                    MessageBox.Show("Document failed to change !");
                }
            }
            Documents dokumens = new Documents();

            Switcher.SwitchNewDocument(dokumens);
        }