public EditPraktik() { InitializeComponent(); provincies = Alamat.GetProvinsiList(); comboBox1.Items.AddRange(Provinsi.getAllName(provincies)); loadData(); }
public bool RemoveAlamat(int id) { methodName = "RemoveAlamat"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; Alamat oDBAlamat = uow.Alamat.SingleOrDefault(m => m.Id == id); if (oDBAlamat != null) { traceID = 3; uow.Alamat.Remove(id); uow.Save(); } traceID = 5; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(true); }
public bool EditAlamat(Alamat oData) { methodName = "EditAlamat"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { traceID = 2; var oDBData = uow.Alamat.Get(oData.Id); if (oDBData != null) { using (var trans = uow.BeginTransaction()) { try { traceID = 3; oDBData.MapFrom(oData); uow.Alamat.Update(oDBData); uow.Save(); traceID = 4; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } } return(true); }
public int AddAlamat(Alamat oData) { methodName = "AddAlamat"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; Alamat oNewAlamat = new Alamat(); oNewAlamat.MapFrom(oData); oNewAlamat = uow.Alamat.Add(oNewAlamat); uow.Save(); traceID = 3; oData.Id = oNewAlamat.Id; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(oData.Id); }
private void cbState_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.PropinsiSelected = null; if (cbState.SelectedItem != null) { this.PropinsiSelected = (Alamat)cbState.SelectedItem; } }
private void combo_change_select(object sender, EventArgs e) { comboBox2.Text = ""; string id = Provinsi.getIdFromName(provincies, comboBox1.Text); comboBox2.Items.Clear(); comboBox2.Items.AddRange(Alamat.GetKotaList(id)); }
private void ClearForm() { txtLocationName.Text = ""; txtPhone.Text = ""; txtEmail.Text = ""; cbCountry.SelectedIndex = -1; txtAddress.Text = ""; txtCity.Text = ""; cbState.SelectedIndex = -1; txtZipcode.Text = ""; txtMap.Text = ""; chkDefault.IsChecked = false; chkNotActive.IsChecked = false; this.NegaraSelected = null; this.PropinsiSelected = null; }
private void Loadlokasi() { this.ClearForm(); if (this.LocationForm != null && this.LocationForm.Lokasi != null) { txtLocationName.Text = this.LocationForm.Lokasi.NamaTempatLokasi; txtPhone.Text = this.LocationForm.Lokasi.NoTelpLokasi; txtEmail.Text = this.LocationForm.Lokasi.EmailLokasi; cbCountry.SelectedValue = this.LocationForm.Lokasi.IdNegara; txtAddress.Text = this.LocationForm.Lokasi.AlamatLokasi; txtCity.Text = this.LocationForm.Lokasi.KotaLokasi; cbState.SelectedValue = this.LocationForm.Lokasi.IdPropinsi; txtZipcode.Text = this.LocationForm.Lokasi.KodePosLokasi.ToString(); txtMap.Text = this.LocationForm.Lokasi.MapLocationLokasi; chkDefault.IsChecked = this.LocationForm.Lokasi.CheckboxDefault; chkNotActive.IsChecked = this.LocationForm.Lokasi.CheckboxNotActive; this.NegaraSelected = this.Alamats.Where(m => m.Id == this.LocationForm.Lokasi.IdNegara.GetValueOrDefault(0)).FirstOrDefault(); this.PropinsiSelected = this.Alamats.Where(m => m.Id == this.LocationForm.Lokasi.IdPropinsi.GetValueOrDefault(0)).FirstOrDefault(); } }
public void loadProvinsi() { //Ambil data api kemudian taruh di combobox comboBox1.Items.AddRange(Provinsi.getAllName(Alamat.GetProvinsiList())); }