public bool RemoveKlasifikasiKontak(int id) { methodName = "RemoveKlasifikasiKontak"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; KlasifikasiKontak oDBKlasifikasiKontak = uow.KlasifikasiKontak.SingleOrDefault(m => m.Id == id); if (oDBKlasifikasiKontak != null) { traceID = 3; uow.KlasifikasiKontak.Remove(id); uow.Save(); } traceID = 5; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(true); }
public int AddKlasifikasiKontak(KlasifikasiKontak oData) { methodName = "AddKlasifikasiKontak"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; KlasifikasiKontak oNewKlasifikasiKontak = new KlasifikasiKontak(); oNewKlasifikasiKontak.MapFrom(oData); oNewKlasifikasiKontak = uow.KlasifikasiKontak.Add(oNewKlasifikasiKontak); uow.Save(); traceID = 3; oData.Id = oNewKlasifikasiKontak.Id; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(oData.Id); }
public bool EditKlasifikasiKontak(KlasifikasiKontak oData) { methodName = "EditKlasifikasiKontak"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { traceID = 2; var oDBData = uow.KlasifikasiKontak.Get(oData.Id); if (oDBData != null) { using (var trans = uow.BeginTransaction()) { try { traceID = 3; oDBData.MapFrom(oData); uow.KlasifikasiKontak.Update(oDBData); uow.Save(); traceID = 4; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } } return(true); }
private KlasifikasiKontak GetData() { KlasifikasiKontak oData = new KlasifikasiKontak(); if (this.TypeKontakSelected != null) { oData.IdTypeKontak = this.TypeKontakSelected.Id; oData.TypeKontak = this.TypeKontakSelected.Type; } oData.NamaKlasifikasiKontak = txtKlasifikasiKontak.Text; oData.CheckboxGender = ChkGender.IsChecked; oData.CheckboxPosition = ChkPosition.IsChecked; oData.CheckboxTransaksi = ChkTransaction.IsChecked; oData.CheckboxOutstanding = ChkOutstanding.IsChecked; oData.CheckboxPIC1 = ChkPIC1.IsChecked; oData.NamaPIC1 = txtPIC1.Text; oData.CheckboxGenderPIC1 = ChkGenderPIC1.IsChecked; oData.CheckboxPositionPIC1 = ChkPositionPIC1.IsChecked; oData.CheckboxPIC2 = ChkPIC2.IsChecked; oData.NamaPIC2 = txtPIC2.Text; oData.CheckboxGenderPIC2 = ChkGenderPIC2.IsChecked; oData.CheckboxPositionPIC2 = ChkPositionPIC2.IsChecked; oData.CheckboxPIC3 = ChkPIC3.IsChecked; oData.NamaPIC3 = txtPIC3.Text; oData.CheckboxGenderPIC3 = ChkGenderPIC3.IsChecked; oData.CheckboxPositionPIC3 = ChkPositionPIC3.IsChecked; oData.Note = txtNote.Text; if (this.ContactClasificationForm.KlasifikasiKontakSelected != null) { oData.Id = this.ContactClasificationForm.KlasifikasiKontakSelected.Id; } return(oData); }
private void CbClasification_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.KlasifikasiKontakSelected = null; if (cbClasification.SelectedItem != null) { this.KlasifikasiKontakSelected = (KlasifikasiKontak)cbClasification.SelectedItem; } }
private void ClearForm() { this.KlasifikasiKontakSelected = null; cbClasification.SelectedIndex = -1; txtVendorID.Text = ""; txtName.Text = ""; txtPhone.Text = ""; txtEmail.Text = ""; }
private void TvContactClasification_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <Object> e) { this.KlasifikasiKontakSelected = null; if (TvContactClasification.SelectedItem != null) { this.KlasifikasiKontakSelected = (KlasifikasiKontak)TvContactClasification.SelectedItem; this.LoadKlasifikasiKontakDetail(); } }
private void Delete_Click(object sender, RoutedEventArgs e) { if (this.KlasifikasiKontakSelected == null) { MessageBox.Show("Contact classification has not been selected !"); } else { KlasifikasiKontakBLL KlasifikasiKontakBLL = new KlasifikasiKontakBLL(); if (KlasifikasiKontakBLL.RemoveKlasifikasiKontak(this.KlasifikasiKontakSelected.Id) == true) { MessageBox.Show("Contact Classification successfully deleted"); this.LoadKlasifikasiKontak(); this.KlasifikasiKontakSelected = null; } } }
private void CbClasification_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.KlasifikasiKontakSelected = null; /*if (cbClasification.SelectedItem != null) * { * this.KlasifikasiKontakSelected = (KlasifikasiKontak)cbClasification.SelectedItem; * tabPIC1.IsEnabled = false; * tabPIC1.Header = "PIC 1"; * tabPIC2.IsEnabled = false; * tabPIC2.Header = "PIC 2"; * tabPIC3.IsEnabled = false; * tabPIC2.Header = "PIC 3"; * * if (this.KlasifikasiKontakSelected.CheckboxPIC1 == true) * { * tabPIC1.IsEnabled = true; * tabPIC1.Header = this.KlasifikasiKontakSelected.NamaPIC1; * if (this.KlasifikasiKontakSelected.CheckboxGenderPIC1 == true) * { * rdMalePIC1.Visibility = Visibility.Visible; * rdFemalePIC1.Visibility = Visibility.Visible; * } * if (this.KlasifikasiKontakSelected.CheckboxPositionPIC1 == true) * { * txtPositionPIC1.Visibility = Visibility.Visible; * } * } * if (this.KlasifikasiKontakSelected.CheckboxPIC2 == true) * { * tabPIC2.IsEnabled = true; * tabPIC2.Header = this.KlasifikasiKontakSelected.NamaPIC2; * if (this.KlasifikasiKontakSelected.CheckboxGenderPIC2 == true) * { * lblGenderPIC2.Visibility = Visibility.Visible; * rdMalePIC2.Visibility = Visibility.Visible; * rdFemalePIC2.Visibility = Visibility.Visible; * } * if (this.KlasifikasiKontakSelected.CheckboxPositionPIC2 == true) * { * lblPositionPIC2.Visibility = Visibility.Visible; * txtPositionPIC2.Visibility = Visibility.Visible; * } * } * if (this.KlasifikasiKontakSelected.CheckboxPIC3 == true) * { * tabPIC3.IsEnabled = true; * tabPIC3.Header = this.KlasifikasiKontakSelected.NamaPIC3; * if (this.KlasifikasiKontakSelected.CheckboxGenderPIC3 == true) * { * lblGenderPIC3.Visibility = Visibility.Visible; * rdMalePIC3.Visibility = Visibility.Visible; * rdFemalePIC3.Visibility = Visibility.Visible; * } * if (this.KlasifikasiKontakSelected.CheckboxPositionPIC3 == true) * { * lblPositionPIC3.Visibility = Visibility.Visible; * txtPositionPIC3.Visibility = Visibility.Visible; * } * } * * }*/ }
private void Init() { this.ClearForm(); this.KlasifikasiKontakSelected = null; this.LoadKlasifikasiKontak(); }