private void btnDeleteAddress_Click(object sender, RoutedEventArgs e) { if (dgCustomerAddress.SelectedItem == null) { MessageBox.Show("Lütfen Gridden silinecek adresi seçiniz."); return; } Types.Banking.CustomerAddressContract customerAddress = new Types.Banking.CustomerAddressContract(); customerAddress = dgCustomerAddress.SelectedItem as Types.Banking.CustomerAddressContract; var connect = new Connector.Banking.GenericConnect <CustomerAddressResponse>(); var request = new Types.Banking.CustomerAddressRequest(); request.customerAddress = customerAddress; request.MethodName = "DelCustomerAddress"; var response = connect.Execute(request); if (response.IsSuccess == true) { MessageBox.Show("Adres silme işlemi başarı ile gerçekleştirildi."); this.Close(); return; } else { MessageBox.Show("Adres ekleme işlemi başarısız oldu."); return; } }
private void GetCustomerAddress(Types.Banking.CustomerAddressContract customerAddress) { customerAddresses = new List <Types.Banking.CustomerAddressContract>(); var connect = new Connector.Banking.GenericConnect <CustomerAddressResponse>(); var request = new Types.Banking.CustomerAddressRequest(); request.customerAddress = customerAddress; request.MethodName = "GetCustomerAddress"; var response = connect.Execute(request); if (response.IsSuccess == true) { foreach (var item in response.customerAddresses) { customerAddresses.Add(item); } dgCustomerAddress.ItemsSource = response.customerAddresses; dgCustomerAddress.Items.Refresh(); return; } else { return; } }
private void btnSaveAddress_Click(object sender, RoutedEventArgs e) { if (txtAddressId.Text != "") { //güncelleme if (txtAddressTitle.Text == "") { MessageBox.Show("Adres başlığı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error); txtAddressTitle.Focus(); return; } if (txtAddress.Text == "") { MessageBox.Show("Adres boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error); txtAddress.Focus(); return; } _customerAddress.Id = Convert.ToInt32(txtAddressId.Text); _customerAddress.Title = txtAddressTitle.Text; _customerAddress.Address = txtAddress.Text; var connect = new Connector.Banking.GenericConnect <CustomerAddressResponse>(); var request = new Types.Banking.CustomerAddressRequest(); request.customerAddress = _customerAddress; request.MethodName = "UpdCustomerAddress"; var response = connect.Execute(request); if (response.IsSuccess == true) { MessageBox.Show("Adres güncelleme işlemi başarı ile gerçekleştirildi."); this.Close(); return; } else { MessageBox.Show("Adres ekleme işlemi başarısız oldu."); return; } } else { //yeni adres if (txtAddressTitle.Text == "") { MessageBox.Show("Adres başlığı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error); txtAddressTitle.Focus(); return; } if (txtAddress.Text == "") { MessageBox.Show("Adres boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error); txtAddress.Focus(); return; } _customerAddress.Title = txtAddressTitle.Text; _customerAddress.Address = txtAddress.Text; var connect = new Connector.Banking.GenericConnect <CustomerAddressResponse>(); var request = new Types.Banking.CustomerAddressRequest(); request.customerAddress = _customerAddress; request.MethodName = "AddCustomerAddress"; var response = connect.Execute(request); if (response.IsSuccess == true) { MessageBox.Show("Adres ekleme işlemi başarı ile gerçekleştirildi."); this.Close(); return; } else { MessageBox.Show("Adres ekleme işlemi başarısız oldu."); return; } } }