Exemplo n.º 1
0
        private void savelevel_Click(object sender, RoutedEventArgs e)
        {
            string message = "";

            if (this.AccountDataForm == null)
            {
                message += "The Account Has Not Been Selected \n";
            }
            if (this.KlasifikasiAkunSelected == null)
            {
                message += "A Replacement Account Has Not Been Selected \n";
            }
            //var childs = this.AccountDataForm.KlasifikasiAkuns.Where(m => m.IdParentKategoriKA == this.AccountDataForm.KlasifikasiAkunSelected.Id);
            //if (childs != null && childs.Count() > 0)
            //    message += "Akun ini masih memliki child \n";
            if (!string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message);
                return;
            }

            KlasifikasiAkunBLL KlasifikasiAkunBLL = new KlasifikasiAkunBLL();

            if (KlasifikasiAkunBLL.RemoveKlasifikasiAkun(this.AccountDataForm.KlasifikasiAkunSelected.Id, this.KlasifikasiAkunSelected.Id) == true)
            {
                this.ClearForm();
                MessageBox.Show("Account was Successfully Deleted !");
                this.AccountDataForm.LoadKlasifikasiAkun();
            }
            else
            {
                MessageBox.Show("Account Failed to Delete !");
            }
        }
Exemplo n.º 2
0
        private void savelevel_Click(object sender, RoutedEventArgs e)
        {
            string message = "";

            if (string.IsNullOrEmpty(txtAccountName.Text))
            {
                message += "Account Name cannot be empty \n";
            }
            if (string.IsNullOrEmpty(txtAccountcode.Text))
            {
                message += "Account Code cannot be empty \n";
            }
            if (!string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message);
                return;
            }

            KlasifikasiAkunBLL KlasifikasiAkunBLL = new KlasifikasiAkunBLL();

            if (this.AccountDataForm.isEdit == false)
            {
                if (KlasifikasiAkunBLL.AddKlasifikasiAkun(this.GetData()) > 0)
                {
                    this.ClearForm();
                    MessageBox.Show("Account successfully added !");
                    this.AccountDataForm.LoadKlasifikasiAkun();
                }
                else
                {
                    MessageBox.Show("Account failed to add !");
                }
            }
            else
            {
                if (KlasifikasiAkunBLL.EditKlasifikasiAkun(this.GetData()) == true)
                {
                    this.ClearForm();
                    MessageBox.Show("Account successfully changed !");
                    this.AccountDataForm.LoadKlasifikasiAkun();
                }
                else
                {
                    MessageBox.Show("Account failed to change !");
                }
            }
            this.Close();
        }