Пример #1
0
        private void AccessoryBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            if (AccessoryBindingSource.Count <= 0)
            {
                id.Text             = "";
                kode_accessory.Text = "";
                nama_accessory.Text = "";

                Edit.Enabled  = false;
                Hapus.Enabled = false;

                return;
            }

            var current = AccessoryBindingSource.IndexOf(AccessoryBindingSource.Current);
            UnitAccessoryModel accessoryModel = ((UnitAccessoryModel)AccessoryXpCollection[current]);

            id.Text             = accessoryModel.id.ToString();
            kode_accessory.Text = accessoryModel.kode_accessory;
            nama_accessory.Text = accessoryModel.nama_accessory;

            Edit.Enabled  = true;
            Hapus.Enabled = true;

            kode_accessory.Enabled = false;
            nama_accessory.Enabled = false;
        }
Пример #2
0
        private void Hapus_Click(object sender, EventArgs e)
        {
            var current = AccessoryBindingSource.IndexOf(AccessoryBindingSource.Current);
            UnitAccessoryModel accessoryModel = ((UnitAccessoryModel)AccessoryXpCollection[current]);

            AccessoryXpCollection.Remove(accessoryModel);
            AccessoryUnitOfWork.CommitChanges();

            if (AccessoryBindingSource.Count <= 0)
            {
                Tambah.PerformClick();
            }
        }